From e9fb9f2705f9d91bfcb57016061d10c77e8ad0c0 Mon Sep 17 00:00:00 2001 From: rinagorsha Date: Sat, 8 Apr 2023 23:24:49 +0300 Subject: [PATCH 1/3] [mod] Update input when selecting autocomplete prediction with keyboard - Update input when selecting autocomplete prediction with keyboard - Search immediately by pressing enter key - Search immediately by clicking on an autocomplete suggestion Related: - https://github.com/searxng/searxng/issues/778 --- .../static/themes/simple/src/js/main/search.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js index 9ba3914be..ceb17958b 100644 --- a/searx/static/themes/simple/src/js/main/search.js +++ b/searx/static/themes/simple/src/js/main/search.js @@ -65,6 +65,24 @@ } }); }, + _Select: function (item) { + AutoComplete.defaults._Select.call(this, item); + var form = item.closest('form'); + if (form) { + form.submit(); + } + }, + KeyboardMappings: Object.assign({}, AutoComplete.defaults.KeyboardMappings, { + "KeyUpAndDown_up": Object.assign({}, AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up, { + Callback: function (event) { + AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this, event); + var liActive = this.DOMResults.querySelector("li.active"); + if (liActive) { + AutoComplete.defaults._Select.call(this, liActive); + } + }, + }), + }), }, "#" + qinput_id); } From 962b4c719fa7ca32470fa4d092130c3d27c2d45f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 10 Apr 2023 15:42:11 +0200 Subject: [PATCH 2/3] [mod] Update input when selecting by TAB When the user press [TAB] the input form should be filled with the highlighted item from the autocomplete list, but not release a search / with other words: what we now have by pressing once on [ENTER] should be mapped to the [TAB] key and pressing [ENTER] once should release a search query. [1] [1] https://github.com/searxng/searxng/issues/778#issuecomment-1016593816 Signed-off-by: Markus Heiser --- searx/static/themes/simple/src/js/main/search.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js index ceb17958b..cb2a9d882 100644 --- a/searx/static/themes/simple/src/js/main/search.js +++ b/searx/static/themes/simple/src/js/main/search.js @@ -82,6 +82,21 @@ } }, }), + "Tab": Object.assign({}, AutoComplete.defaults.KeyboardMappings.Enter, { + Conditions: [{ + Is: 9, + Not: false + }], + Callback: function (event) { + if (this.DOMResults.getAttribute("class").indexOf("open") != -1) { + var liActive = this.DOMResults.querySelector("li.active"); + if (liActive !== null) { + AutoComplete.defaults._Select.call(this, liActive); + event.preventDefault(); + } + } + }, + }) }), }, "#" + qinput_id); } From c678b826254d29b5a2243fea9c01b76541409b77 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 10 Apr 2023 16:18:49 +0200 Subject: [PATCH 3/3] [build] /static --- searx/static/themes/simple/js/searxng.min.js | Bin 25114 -> 25894 bytes .../themes/simple/js/searxng.min.js.map | Bin 90143 -> 92498 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/searx/static/themes/simple/js/searxng.min.js b/searx/static/themes/simple/js/searxng.min.js index 43b7ebe4e692ec19fba8ae25d21854189d42d8d1..281cde634d4a2aea9cf68dc15a2e89e70eff7132 100644 GIT binary patch delta 580 zcmbV~F-ycS6vw&6Z{RLBB@nVXw8i1LI*51<>Lhxm?dus$lV02^hKLQ0Y@>nQE z@KRa^G+2pZ3wMCW%2=>S#;GZ?F%4u&kUHeHj53LYRu$Wa+sKF_IS_d+^}_mx(N)J2 z*2;w@u43PJ>)zr1B6IEJB%kOcG&g!)=4(lRfOwC?+_ZIz&P06er=^Zj8cl$@;XeAY z`ZWFtYgs=VYhGvD^*ZM7ju;R8J?neT`RqO%mKzEZ X0M83pfyVIbPjt`PhO6ky(t9EwmO0yG delta 14 WcmZ2>igDHv#tns*n`>=WY5)K;O$KNH diff --git a/searx/static/themes/simple/js/searxng.min.js.map b/searx/static/themes/simple/js/searxng.min.js.map index 3a866901dc38beb1bed6424b43ae3bca222dff83..77ab9c3fec56177a4287f4116b14fbf77bea3c82 100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