mirror of
				https://github.com/searxng/searxng.git
				synced 2025-11-03 19:17:07 -05: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();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										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(){
 | 
					$(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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user