瀏覽代碼

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 年之前
父節點
當前提交
4d56f145be
共有 1 個檔案被更改,包括 3 行新增2 行删除
  1. +3
    -2
      static/js/index.js

+ 3
- 2
static/js/index.js 查看文件

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

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

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


Loading…
取消
儲存