From ecd293c8a90f0adef5f3e07f8c99c94a3beae63a Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Wed, 19 Mar 2014 20:19:44 +0100 Subject: add front-part of autocompleter function --- searx/static/js/searx.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'searx/static/js/searx.js') diff --git a/searx/static/js/searx.js b/searx/static/js/searx.js index 7b224a17f..15e6012c2 100644 --- a/searx/static/js/searx.js +++ b/searx/static/js/searx.js @@ -1,3 +1,20 @@ +window.addEvent('domready', function() { + new Autocompleter.Request.JSON('q', '/', { + postVar:'q', + postData:{ + 'autocompleter': 1, + '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) { -- cgit v1.2.3 From 8abf4ab993cd4a81dc97f85fb8a30a6c875221f7 Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Thu, 20 Mar 2014 10:28:24 +0100 Subject: adding initial code for backend-part of autocompleter including test-code --- searx/static/js/searx.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'searx/static/js/searx.js') diff --git a/searx/static/js/searx.js b/searx/static/js/searx.js index 15e6012c2..8687a9066 100644 --- a/searx/static/js/searx.js +++ b/searx/static/js/searx.js @@ -1,8 +1,7 @@ window.addEvent('domready', function() { - new Autocompleter.Request.JSON('q', '/', { + new Autocompleter.Request.JSON('q', '/autocompleter', { postVar:'q', postData:{ - 'autocompleter': 1, 'format': 'json' }, ajaxOptions:{ -- cgit v1.2.3 From c8cf95aa56590800c4f2d39a39d0a70537e7382e Mon Sep 17 00:00:00 2001 From: Thomas Pointhuber Date: Fri, 21 Mar 2014 11:11:31 +0100 Subject: deactivate autocompleter by default --- searx/static/js/searx.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'searx/static/js/searx.js') diff --git a/searx/static/js/searx.js b/searx/static/js/searx.js index 8687a9066..2b2e0c98c 100644 --- a/searx/static/js/searx.js +++ b/searx/static/js/searx.js @@ -1,18 +1,20 @@ -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 - }); -}); +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'; -- cgit v1.2.3