mirror of
https://github.com/searxng/searxng.git
synced 2024-12-11 03:46:28 +00:00
a71b326d9e
- more smartphone friendly - more text browser friendly - next button always on the right - in case of small screen supporting touch event, categories are displayed on one line with a scroll
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
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': false,
|
|
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();
|
|
}
|
|
});
|
|
|
|
if (!!('ontouchstart' in window)) {
|
|
document.getElementsByTagName("html")[0].className += " touch";
|
|
}
|
|
|
|
})(window, document);
|
|
|