From bcb353cc30b36712197739ece9061a12007f4df8 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 15 Jul 2021 00:37:14 +0200 Subject: [PATCH] allow ctrl-clicking primary tabs --- copyparty/web/browser.js | 9 +++++---- copyparty/web/util.js | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index de23d065..ecc7a2be 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -167,12 +167,13 @@ ebi('tree').innerHTML = ( function opclick(e) { - ev(e); - var dest = this.getAttribute('data-dest'); - goto(dest); - swrite('opmode', dest || null); + if (ctrl(e)) + return; + + ev(e); + goto(dest); var input = QS('.opview.act input:not([type="hidden"])') if (input && !is_touch) diff --git a/copyparty/web/util.js b/copyparty/web/util.js index efffe3a7..13676d23 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -53,6 +53,11 @@ var ebi = document.getElementById.bind(document), mknod = document.createElement.bind(document); +function ctrl(e) { + return e && (e.ctrlKey || e.metaKey); +} + + function ev(e) { e = e || window.event; if (!e)