From 4aeafea2837795bdda930bfbe90d26f943e6fcce Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Nov 2010 13:52:01 +0300 Subject: [PATCH] rework hotkey blocking on INPUT elements --- feedlist.js | 1 - functions.js | 14 -------------- prefs.js | 14 +------------- tt-rss.js | 15 +-------------- viewfeed.js | 1 - 5 files changed, 2 insertions(+), 43 deletions(-) diff --git a/feedlist.js b/feedlist.js index 05a16d865..a39748f1c 100644 --- a/feedlist.js +++ b/feedlist.js @@ -82,7 +82,6 @@ function viewfeed(feed, subop, is_cat, offset) { _infscroll_request_sent = timestamp; } - enableHotkeys(); hideAuxDlg(); closeInfoBox(); diff --git a/functions.js b/functions.js index 935740b94..8e02b7932 100644 --- a/functions.js +++ b/functions.js @@ -1,4 +1,3 @@ -var hotkeys_enabled = true; var notify_silent = false; var loading_progress = 0; var sanity_check_done = false; @@ -84,15 +83,6 @@ function format_exception_error(location, e) { return msg; } - -function disableHotkeys() { - hotkeys_enabled = false; -} - -function enableHotkeys() { - hotkeys_enabled = true; -} - function param_escape(arg) { if (typeof encodeURIComponent != 'undefined') return encodeURIComponent(arg); @@ -398,8 +388,6 @@ function closeErrorBox() { if (Element.visible("errorBoxShadow")) { Element.hide("dialog_overlay"); Element.hide("errorBoxShadow"); - - enableHotkeys(); } return false; @@ -407,8 +395,6 @@ function closeErrorBox() { function closeInfoBox(cleanup) { try { - enableHotkeys(); - dialog = dijit.byId("infoBox"); if (dialog) dialog.hide(); diff --git a/prefs.js b/prefs.js index 3a36c2876..4851611a3 100644 --- a/prefs.js +++ b/prefs.js @@ -964,8 +964,7 @@ function validatePrefsReset() { function pref_hotkey_handler(e) { try { - - if (dijit.getEnclosingWidget(e.target)) return; + if (e.target.nodeName == "INPUT") return; var keycode; var shift_key = false; @@ -994,17 +993,6 @@ function pref_hotkey_handler(e) { closeInfoBox(); } - var dialog = dijit.byId("infoBox"); - var dialog_visible = false; - - if (dialog) - dialog_visible = Element.visible(dialog.domNode); - - if (dialog_visible || !hotkeys_enabled) { - console.log("hotkeys disabled"); - return; - } - if (keycode == 16) return; // ignore lone shift if (keycode == 17) return; // ignore lone ctrl diff --git a/tt-rss.js b/tt-rss.js index 4386fe2ee..c20994076 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -636,11 +636,9 @@ function rescoreCurrentFeed() { } function hotkey_handler(e) { - try { - var widget = dijit.getEnclosingWidget(e.target); - if (widget && Element.visible(widget.domNode)) return; + if (e.target.nodeName == "INPUT") return; var keycode; var shift_key = false; @@ -669,17 +667,6 @@ function hotkey_handler(e) { closeInfoBox(); } - var dialog = dijit.byId("infoBox"); - var dialog_visible = false; - - if (dialog) - dialog_visible = Element.visible(dialog.domNode); - - if (dialog_visible || !hotkeys_enabled) { - console.log("hotkeys disabled"); - return; - } - if (keycode == 16) return; // ignore lone shift if (keycode == 17) return; // ignore lone ctrl diff --git a/viewfeed.js b/viewfeed.js index 2b837be73..e9c6e8e54 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -363,7 +363,6 @@ function view(id) { console.log("cache check result: " + (cached_article != false)); - enableHotkeys(); hideAuxDlg(); var query = "?op=view&id=" + param_escape(id);