summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-01 18:10:30 +0300
committerAndrew Dolgov <[email protected]>2018-12-01 18:10:30 +0300
commit44d3aedd382f6b9f38776fd2f2a8119f4160da55 (patch)
tree4c671ed5c712fd4ee827fada255a8ed0ad7731c6 /js
parentff708a9357ec16b4f6a49d242ce62063c9345136 (diff)
prefs: hotkey handler to App
Diffstat (limited to 'js')
-rwxr-xr-xjs/prefs.js51
1 files changed, 25 insertions, 26 deletions
diff --git a/js/prefs.js b/js/prefs.js
index 032098f6f..15007d014 100755
--- a/js/prefs.js
+++ b/js/prefs.js
@@ -65,7 +65,7 @@ const App = {
});
},
initSecondStage: function() {
- document.onkeydown = pref_hotkey_handler;
+ document.onkeydown = this.hotkeyHandler;
setLoadingProgress(50);
notify("");
@@ -87,6 +87,30 @@ const App = {
}
setInterval(hotkeyPrefixTimeout, 5 * 1000);
+ },
+ hotkeyHandler: function (event) {
+ if (event.target.nodeName == "INPUT" || event.target.nodeName == "TEXTAREA") return;
+
+ const action_name = keyeventToAction(event);
+
+ if (action_name) {
+ switch (action_name) {
+ case "feed_subscribe":
+ quickAddFeed();
+ return false;
+ case "create_label":
+ addLabel();
+ return false;
+ case "create_filter":
+ quickAddFilter();
+ return false;
+ case "help_dialog":
+ Utils.helpDialog("main");
+ return false;
+ default:
+ console.log("unhandled action: " + action_name + "; keycode: " + event.which);
+ }
+ }
}
}
@@ -747,31 +771,6 @@ function validatePrefsReset() {
return false;
}
-function pref_hotkey_handler(e) {
- if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
-
- const action_name = keyeventToAction(e);
-
- if (action_name) {
- switch (action_name) {
- case "feed_subscribe":
- quickAddFeed();
- return false;
- case "create_label":
- addLabel();
- return false;
- case "create_filter":
- quickAddFilter();
- return false;
- case "help_dialog":
- Utils.helpDialog("main");
- return false;
- default:
- console.log("unhandled action: " + action_name + "; keycode: " + e.which);
- }
- }
-}
-
function removeCategory(id, item) {
if (confirm(__("Remove category %s? Any nested feeds would be placed into Uncategorized.").replace("%s", item.name))) {