forked from zaclys/searxng
[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
|
@ -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);
|
}, "#" + qinput_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue