]> git.wh0rd.org - tt-rss.git/commitdiff
disable hotkey processing while searchbox is focused
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 25 Aug 2005 13:31:52 +0000 (14:31 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 25 Aug 2005 13:31:52 +0000 (14:31 +0100)
backend.php
functions.js

index d29cc280b335faae1020a638213dfe73c52cf829..dd38641ac096fdf12355e771a1bbe89063067646 100644 (file)
                $feed_last_updated = "Updated: " . $line["last_updated"];
 
                print "<tr><td class=\"search\" colspan=\"3\">
-                       Search: <input id=\"searchbox\" onchange=\"javascript:search($feed);\">
+                       Search: <input id=\"searchbox\"
+                       onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
+                       onchange=\"javascript:search($feed);\">
                        <a class=\"button\" href=\"javascript:resetSearch()\">Reset</a>
                        </td></tr>"; 
                print "<tr>
index 0b05ae2e8a0d71d2a220ba4d79d933832253df96..f33b3970d356307bc325a603b61022f75a69eb4e 100644 (file)
@@ -1,3 +1,13 @@
+var hotkeys_enabled = true;
+
+function disableHotkeys() {
+       hotkeys_enabled = false;
+}
+
+function enableHotkeys() {
+       hotkeys_enabled = true;
+}
+
 function notify_callback() {
        var container = document.getElementById('notify');
        if (xmlhttp.readyState == 4) {
@@ -56,8 +66,11 @@ function printLockingError() {
 var seq = "";
 
 function hotkey_handler(e) {
+
        var keycode;
 
+       if (!hotkeys_enabled) return;
+
        if (window.event) {
                keycode = window.event.keyCode;
        } else if (e) {