From f483119a404c84f3f6dd8b93fdec9226c80818e1 Mon Sep 17 00:00:00 2001 From: Charles Renwick Date: Tue, 21 Nov 2017 10:26:30 -0500 Subject: [PATCH] Adds shortcut to open containers. Makes it more effective to open the first ten containers in the containers list. Keys 1-0 will open containers 1-10, if that container exists. Note: the plugin's popup panel does not autofocus when opened. This requires the user to focus on the panel by either clicking or pressing TAB before using shortcut keys. This behavior is consistent with the previous shortcuts for this addon. --- webextension/js/popup.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/webextension/js/popup.js b/webextension/js/popup.js index 37666c1..765be33 100644 --- a/webextension/js/popup.js +++ b/webextension/js/popup.js @@ -516,6 +516,12 @@ Logic.registerPanel(P_CONTAINERS_LIST, { previousElement.focus(); } } + function select(num) { + const element = selectables[num]; + if (element) { + element.click(); + } + } switch (e.keyCode) { case 40: next(); @@ -523,6 +529,36 @@ Logic.registerPanel(P_CONTAINERS_LIST, { case 38: previous(); break; + case 49: + select(1); + break; + case 50: + select(2); + break; + case 51: + select(3); + break; + case 52: + select(4); + break; + case 53: + select(5); + break; + case 53: + select(6); + break; + case 53: + select(7); + break; + case 53: + select(8); + break; + case 53: + select(99); + break; + case 48: + select(10); + break; } });