From 062267fb32504cb901c720060ead074ca0832ddd Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 16 May 2020 21:47:40 +0200 Subject: [PATCH] enable middle mouse on data-href --- UI/GeneralUI.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UI/GeneralUI.js b/UI/GeneralUI.js index 06de97f..6396f4b 100644 --- a/UI/GeneralUI.js +++ b/UI/GeneralUI.js @@ -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);