summaryrefslogtreecommitdiff
path: root/searx/static/js/searx.js
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-03-25 18:00:45 +0100
committerAdam Tauber <asciimoo@gmail.com>2014-03-25 18:00:45 +0100
commit20504a0e834a99fb1274ad907c0b62fb90eb96d3 (patch)
treee15473776d3311379c7a40234beaa7edbb97be53 /searx/static/js/searx.js
parent0207070cde9d6319a3403d1a1c6b1a37c8d3c60c (diff)
parenta76525d1f3256105d45ee0a0f1301a8cc0b2e4c6 (diff)
Merge branch 'autocompleter' of https://github.com/pointhi/searx into autocomplete
Diffstat (limited to 'searx/static/js/searx.js')
-rw-r--r--searx/static/js/searx.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/static/js/searx.js b/searx/static/js/searx.js
index 7b224a17f..2b2e0c98c 100644
--- a/searx/static/js/searx.js
+++ b/searx/static/js/searx.js
@@ -1,3 +1,21 @@
+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';
function addListener(el, type, fn) {