forked from zaclys/searxng
[fix] do not autocomplete for pressing enter when mouse is on the completion list - fixes #340
This commit is contained in:
parent
47cddcab8b
commit
08fdfc73fb
@ -78,7 +78,13 @@ if(searx.autocompleter) {
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
var original_search_value = '';
|
||||
if(searx.autocompleter) {
|
||||
$("#q").on('keydown', function(e) {
|
||||
if(e.which == 13) {
|
||||
original_search_value = $('#q').val();
|
||||
}
|
||||
});
|
||||
$('#q').typeahead(null, {
|
||||
name: 'search-results',
|
||||
displayKey: function(result) {
|
||||
@ -87,6 +93,9 @@ $(document).ready(function(){
|
||||
source: searx.searchResults.ttAdapter()
|
||||
});
|
||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||
if(original_search_value) {
|
||||
$('#q').val(original_search_value);
|
||||
}
|
||||
$("#search_form").submit();
|
||||
});
|
||||
}
|
||||
|
4
searx/static/themes/oscar/js/searx.min.js
vendored
4
searx/static/themes/oscar/js/searx.min.js
vendored
File diff suppressed because one or more lines are too long
@ -25,7 +25,13 @@ if(searx.autocompleter) {
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
var original_search_value = '';
|
||||
if(searx.autocompleter) {
|
||||
$("#q").on('keydown', function(e) {
|
||||
if(e.which == 13) {
|
||||
original_search_value = $('#q').val();
|
||||
}
|
||||
});
|
||||
$('#q').typeahead(null, {
|
||||
name: 'search-results',
|
||||
displayKey: function(result) {
|
||||
@ -34,6 +40,9 @@ $(document).ready(function(){
|
||||
source: searx.searchResults.ttAdapter()
|
||||
});
|
||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||
if(original_search_value) {
|
||||
$('#q').val(original_search_value);
|
||||
}
|
||||
$("#search_form").submit();
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user