-
- if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
-
- let keycode = false;
- let shift_key = false;
-
- const cmdline = $('cmdline');
-
- try {
- shift_key = e.shiftKey;
- } catch (e) {
-
- }
-
- if (window.event) {
- keycode = window.event.keyCode;
- } else if (e) {
- keycode = e.which;
- }
-
- let keychar = String.fromCharCode(keycode);
-
- if (keycode == 27) { // escape
- hotkey_prefix = false;
- }
-
- if (keycode == 16) return; // ignore lone shift
- if (keycode == 17) return; // ignore lone ctrl
-
- if (!shift_key) keychar = keychar.toLowerCase();
-
- var hotkeys = getInitParam("hotkeys");
-
- if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
-
- const date = new Date();
- const ts = Math.round(date.getTime() / 1000);
-
- hotkey_prefix = keychar;
- hotkey_prefix_pressed = ts;
-
- cmdline.innerHTML = keychar;
- Element.show(cmdline);
-
- return true;
- }
-
- Element.hide(cmdline);
-
- let hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
- hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
- hotkey_prefix = false;
-
- let hotkey_action = false;
- var hotkeys = getInitParam("hotkeys");
-
- for (const sequence in hotkeys[1]) {
- if (sequence == hotkey) {
- hotkey_action = hotkeys[1][sequence];
- break;
- }
- }
-
- switch (hotkey_action) {
- case "feed_subscribe":
- quickAddFeed();
- return false;
- case "create_label":
- addLabel();
- return false;
- case "create_filter":
- quickAddFilter();
- return false;
- case "help_dialog":
- //helpDialog("prefs");
- return false;
- default:
- console.log("unhandled action: " + hotkey_action + "; hotkey: " + hotkey);