mirror of
https://github.com/searxng/searxng.git
synced 2024-11-26 21:01:01 +00:00
[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
This commit is contained in:
parent
3372fcdb49
commit
e9fb9f2705
1 changed files with 18 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue