summaryrefslogtreecommitdiff
path: root/searx/static/themes/pix-art/js
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-15 19:09:17 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-15 19:09:17 +0100
commitd740e7384a95c6a7d80e5f492f4dd7edb312175e (patch)
tree9cf8a96ec7d0834603290dde93ef5f45a68ef08a /searx/static/themes/pix-art/js
parent3ff269c84c936a3ffc2e8e3168a4ac017047015b (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.js49
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);
+