diff options
| author | Pydo <pydo@tutanota.com> | 2016-10-01 10:46:18 -0400 |
|---|---|---|
| committer | Pydo <pydo@tutanota.com> | 2016-10-01 10:46:18 -0400 |
| commit | 55a5b686ed6dc0b9a6bfc45e0eaf1f70e24f2aea (patch) | |
| tree | 96e953057dd3fc29681039f7ac5b282dac189ee8 /searx/static/themes/legacy/js | |
| parent | 6f87bf2a1c76f1b94ad2119df7fb938c2307e370 (diff) | |
| parent | 295fc9ce96d8cca9c6c4776a00e5fb0942eb6f4d (diff) | |
Merge branch 'master' of https://github.com/asciimoo/searx into feature/seedpeer-engine-integration
Resolved conflict searx/settings.yml
Diffstat (limited to 'searx/static/themes/legacy/js')
| -rw-r--r-- | searx/static/themes/legacy/js/searx.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/searx/static/themes/legacy/js/searx.js b/searx/static/themes/legacy/js/searx.js new file mode 100644 index 000000000..d6d5b74bb --- /dev/null +++ b/searx/static/themes/legacy/js/searx.js @@ -0,0 +1,49 @@ +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); + |