summaryrefslogtreecommitdiff
path: root/searx/templates
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/templates
parent0207070cde9d6319a3403d1a1c6b1a37c8d3c60c (diff)
parenta76525d1f3256105d45ee0a0f1301a8cc0b2e4c6 (diff)
Merge branch 'autocompleter' of https://github.com/pointhi/searx into autocomplete
Diffstat (limited to 'searx/templates')
-rw-r--r--searx/templates/base.html8
-rw-r--r--searx/templates/opensearch.xml15
2 files changed, 22 insertions, 1 deletions
diff --git a/searx/templates/base.html b/searx/templates/base.html
index d1892245b..d86982a59 100644
--- a/searx/templates/base.html
+++ b/searx/templates/base.html
@@ -13,11 +13,19 @@
{% block head %}
<link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
{% endblock %}
+ <script type="text/javascript">
+ searx = {};
+ searx.autocompleter = {% if client.autocompleter %}true{% else %}false{% endif %};
+ </script>
</head>
<body>
<div id="container">
{% block content %}
{% endblock %}
+{% if client.autocompleter %}
+<script src="{{ url_for('static', filename='js/mootools-core-1.4.5-min.js') }}" ></script>
+<script src="{{ url_for('static', filename='js/mootools-autocompleter-1.1.2-min.js') }}" ></script>
+{% endif %}
<script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
</div>
</body>
diff --git a/searx/templates/opensearch.xml b/searx/templates/opensearch.xml
index 68b030b3a..403d18bb5 100644
--- a/searx/templates/opensearch.xml
+++ b/searx/templates/opensearch.xml
@@ -6,9 +6,22 @@
<LongName>searx metasearch</LongName>
{% if method == 'get' %}
<Url type="text/html" method="get" template="{{ host }}?q={searchTerms}"/>
+ {% if client.autocompleter %}
+ <Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
+ <Param name="format" value="x-suggestions" />
+ <Param name="q" value="{searchTerms}" />
+ </Url>
+ {% endif %}
{% else %}
<Url type="text/html" method="post" template="{{ host }}">
- <Param name="q" value="{searchTerms}" />
+ <Param name="q" value="{searchTerms}" />
+ </Url>
+ {% if client.autocompleter %}
+ <!-- TODO, POST REQUEST doesn't work -->
+ <Url type="application/x-suggestions+json" method="get" template="{{ host }}autocompleter">
+ <Param name="format" value="x-suggestions" />
+ <Param name="q" value="{searchTerms}" />
</Url>
+ {% endif %}
{% endif %}
</OpenSearchDescription>