mirror of
https://github.com/searxng/searxng.git
synced 2025-07-13 08:19:17 +02:00
oscar template: implement autocompleter
This commit is contained in:
parent
4b7164f04a
commit
14b0604bc0
4 changed files with 219 additions and 1 deletions
|
@ -7,6 +7,15 @@
|
|||
|
||||
*/
|
||||
|
||||
if(searx.autocompleter) {
|
||||
searx.searchResults = new Bloodhound({
|
||||
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
|
||||
queryTokenizer: Bloodhound.tokenizers.whitespace,
|
||||
remote: '/autocompleter?q=%QUERY'
|
||||
});
|
||||
searx.searchResults.initialize();
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('.btn-toggle .btn').click(function() {
|
||||
var btnClass = 'btn-' + $(this).data('btn-class');
|
||||
|
@ -42,4 +51,14 @@ $(document).ready(function(){
|
|||
$(".select-all-on-click").click(function () {
|
||||
$(this).select();
|
||||
});
|
||||
});
|
||||
|
||||
if(searx.autocompleter) {
|
||||
$('#q').typeahead(null, {
|
||||
name: 'search-results',
|
||||
displayKey: function(result) {
|
||||
return result;
|
||||
},
|
||||
source: searx.searchResults.ttAdapter()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue