diff options
| author | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-02-15 19:09:17 +0100 |
|---|---|---|
| committer | Cqoicebordel <Cqoicebordel@users.noreply.github.com> | 2015-02-15 19:09:17 +0100 |
| commit | d740e7384a95c6a7d80e5f492f4dd7edb312175e (patch) | |
| tree | 9cf8a96ec7d0834603290dde93ef5f45a68ef08a /searx/static/themes/pix-art/js | |
| parent | 3ff269c84c936a3ffc2e8e3168a4ac017047015b (diff) | |
New Theme, Pix-art.
First commit
Diffstat (limited to 'searx/static/themes/pix-art/js')
| -rw-r--r-- | searx/static/themes/pix-art/js/searx.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/searx/static/themes/pix-art/js/searx.js b/searx/static/themes/pix-art/js/searx.js new file mode 100644 index 000000000..9be969bb3 --- /dev/null +++ b/searx/static/themes/pix-art/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); + |