enable middle mouse on data-href

This commit is contained in:
Dennis Eichhorn 2020-05-16 21:47:40 +02:00
parent 3d0fbc5778
commit 062267fb32

View File

@ -66,14 +66,18 @@ export class GeneralUI
continue;
}
e[i].addEventListener('click', function(event) {
e[i].addEventListener('mouseup', function(event) {
if (event.button !== 0 && event.button !== 1) {
return;
}
jsOMS.preventAll(event);
history.pushState(null, null, window.location);
let uri = this.getAttribute('data-href');
uri = uri === null ? this.getAttribute('href') : uri;
if (this.getAttribute('target') === '_blank' || this.getAttribute(['data-target']) === '_blank') {
if (this.getAttribute('target') === '_blank' || this.getAttribute(['data-target']) === '_blank' || event.button === 1) {
window.open(UriFactory.build(uri), '_blank');
} else {
window.location = UriFactory.build(uri);