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.
This commit is contained in:
Charles Renwick 2017-11-21 10:26:30 -05:00
parent abd2b73fca
commit f483119a40

View file

@ -516,6 +516,12 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
previousElement.focus(); previousElement.focus();
} }
} }
function select(num) {
const element = selectables[num];
if (element) {
element.click();
}
}
switch (e.keyCode) { switch (e.keyCode) {
case 40: case 40:
next(); next();
@ -523,6 +529,36 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
case 38: case 38:
previous(); previous();
break; 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;
} }
}); });