mirror of
https://github.com/searxng/searxng
synced 2024-11-18 15:26:25 +00:00
[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(){
|
$(document).ready(function(){
|
||||||
|
var original_search_value = '';
|
||||||
if(searx.autocompleter) {
|
if(searx.autocompleter) {
|
||||||
|
$("#q").on('keydown', function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
original_search_value = $('#q').val();
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#q').typeahead(null, {
|
$('#q').typeahead(null, {
|
||||||
name: 'search-results',
|
name: 'search-results',
|
||||||
displayKey: function(result) {
|
displayKey: function(result) {
|
||||||
@ -87,6 +93,9 @@ $(document).ready(function(){
|
|||||||
source: searx.searchResults.ttAdapter()
|
source: searx.searchResults.ttAdapter()
|
||||||
});
|
});
|
||||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||||
|
if(original_search_value) {
|
||||||
|
$('#q').val(original_search_value);
|
||||||
|
}
|
||||||
$("#search_form").submit();
|
$("#search_form").submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
BIN
searx/static/themes/oscar/js/searx.min.js
vendored
BIN
searx/static/themes/oscar/js/searx.min.js
vendored
Binary file not shown.
@ -25,7 +25,13 @@ if(searx.autocompleter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
var original_search_value = '';
|
||||||
if(searx.autocompleter) {
|
if(searx.autocompleter) {
|
||||||
|
$("#q").on('keydown', function(e) {
|
||||||
|
if(e.which == 13) {
|
||||||
|
original_search_value = $('#q').val();
|
||||||
|
}
|
||||||
|
});
|
||||||
$('#q').typeahead(null, {
|
$('#q').typeahead(null, {
|
||||||
name: 'search-results',
|
name: 'search-results',
|
||||||
displayKey: function(result) {
|
displayKey: function(result) {
|
||||||
@ -34,6 +40,9 @@ $(document).ready(function(){
|
|||||||
source: searx.searchResults.ttAdapter()
|
source: searx.searchResults.ttAdapter()
|
||||||
});
|
});
|
||||||
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
$('#q').bind('typeahead:selected', function(ev, suggestion) {
|
||||||
|
if(original_search_value) {
|
||||||
|
$('#q').val(original_search_value);
|
||||||
|
}
|
||||||
$("#search_form").submit();
|
$("#search_form").submit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user