Sfoglia il codice sorgente

Fix Vim mode on Firefox

Firefox automatically opens a built-in quick search when user
starts typing without selected input and the Vim shortcuts
are not triggered
Richard Nespithal 6 anni fa
parent
commit
0314349b08
No account linked to committer's email
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2
    1
      searx/static/plugins/js/vim_hotkeys.js

+ 2
- 1
searx/static/plugins/js/vim_hotkeys.js Vedi File

@@ -104,7 +104,7 @@ $(document).ready(function() {
104 104
         }
105 105
     };
106 106
 
107
-    $(document).keyup(function(e) {
107
+    $(document).keydown(function(e) {
108 108
         // check for modifiers so we don't break browser's hotkeys
109 109
         if (vimKeys.hasOwnProperty(e.keyCode)
110 110
             && !e.ctrlKey
@@ -118,6 +118,7 @@ $(document).ready(function() {
118 118
                 }
119 119
             } else {
120 120
                 if (e.target === document.body) {
121
+                    e.preventDefault();
121 122
                     vimKeys[e.keyCode].fun();
122 123
                 }
123 124
             }