From 92f923effe8a2caa28d583c8fcbc292c0a95f321 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 28 Jun 2021 15:34:10 +0200 Subject: [PATCH] hotkey for adjusting tree width --- README.md | 4 +++- copyparty/web/browser.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f1945760..9e81b5d1 100644 --- a/README.md +++ b/README.md @@ -193,9 +193,11 @@ the browser has the following hotkeys * `U/O` skip 10sec back/forward * `J/L` prev/next song * `P` play/pause (also starts playing the folder) +* when tree-sidebar is open: + * `A/D` adjust tree width * in the grid view: * `S` toggle multiselect - * `A/D` zoom + * shift+`A/D` zoom ## tree-mode diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 7ff49d68..7ce4b9c8 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1729,10 +1729,14 @@ document.onkeydown = function (e) { if (!document.activeElement || document.activeElement != document.body && document.activeElement.nodeName.toLowerCase() != 'a') return; - if (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey || e.isComposing) + if (e.ctrlKey || e.altKey || e.metaKey || e.isComposing) return; var k = (e.code + ''), pos = -1, n; + + if (e.shiftKey && k != 'KeyA' && k != 'KeyD') + return; + if (k.indexOf('Digit') === 0) pos = parseInt(k.slice(-1)) * 0.1; @@ -1768,6 +1772,14 @@ document.onkeydown = function (e) { if (k == 'KeyT') return ebi('thumbs').click(); + if (!treectl.hidden && (!e.shiftKey || !thegrid.en)) { + if (k == 'KeyA') + return QS('#twig').click(); + + if (k == 'KeyD') + return QS('#twobytwo').click(); + } + if (thegrid.en) { if (k == 'KeyS') return ebi('gridsel').click();