mirror of
https://github.com/searxng/searxng.git
synced 2025-07-16 09:49:21 +02:00
add multi theming support
This commit is contained in:
parent
3386e21cdf
commit
08eaffe245
41 changed files with 104 additions and 29 deletions
45
searx/static/default/js/searx.js
Normal file
45
searx/static/default/js/searx.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
if(searx.autocompleter) {
|
||||
window.addEvent('domready', function() {
|
||||
new Autocompleter.Request.JSON('q', '/autocompleter', {
|
||||
postVar:'q',
|
||||
postData:{
|
||||
'format': 'json'
|
||||
},
|
||||
ajaxOptions:{
|
||||
timeout: 5 // Correct option?
|
||||
},
|
||||
'minLength': 4,
|
||||
// 'selectMode': 'type-ahead',
|
||||
cache: true,
|
||||
delay: 300
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
(function (w, d) {
|
||||
'use strict';
|
||||
function addListener(el, type, fn) {
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener(type, fn, false);
|
||||
} else {
|
||||
el.attachEvent('on' + type, fn);
|
||||
}
|
||||
}
|
||||
|
||||
function placeCursorAtEnd() {
|
||||
if (this.setSelectionRange) {
|
||||
var len = this.value.length * 2;
|
||||
this.setSelectionRange(len, len);
|
||||
}
|
||||
}
|
||||
|
||||
addListener(w, 'load', function () {
|
||||
var qinput = d.getElementById('q');
|
||||
if (qinput !== null && qinput.value === "") {
|
||||
addListener(qinput, 'focus', placeCursorAtEnd);
|
||||
qinput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
})(window, document);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue