Browse Source

Suppress hotkeys entered in text inputs. Fix #58.

Add:
    static/js/index.js
        -Suppress hotkey (`h`, `j` `k`, and `l`) events when the keys are
        entered in text input-fields.
tags/v1.0^2
Severyn Kozak 10 years ago
parent
commit
4d56f145be
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      static/js/index.js

+ 3
- 2
static/js/index.js View File

@@ -11,6 +11,7 @@ var resultsDiv = $("div#results")[0];


var typingTimer, scrollTimer, lastValue; var typingTimer, scrollTimer, lastValue;
var searchResultsPage = 1; var searchResultsPage = 1;

/* /*
* Set all page callbacks. * Set all page callbacks.
*/ */
@@ -115,9 +116,9 @@ var searchResultsPage = 1;
$(window).keypress(function(key){ $(window).keypress(function(key){
for(var hotkey in hotkeyActions){ for(var hotkey in hotkeyActions){
var keyChar = String.fromCharCode(key.keyCode); var keyChar = String.fromCharCode(key.keyCode);
if(keyChar == hotkey) {
if(keyChar == hotkey &&
!($(key.target).is("textarea") || $(key.target).is("input")))
hotkeyActions[keyChar](); hotkeyActions[keyChar]();
}
} }
}); });
}()); }());


Loading…
Cancel
Save