From 04727a2043025597293fed47392f3b748a654a01 Mon Sep 17 00:00:00 2001 From: dalf Date: Tue, 31 Dec 2013 12:58:10 +0100 Subject: [PATCH 1/3] [mod] more html5 compliant --- searx/templates/results.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/searx/templates/results.html b/searx/templates/results.html index a939bde22..2f018881c 100644 --- a/searx/templates/results.html +++ b/searx/templates/results.html @@ -6,7 +6,7 @@
{% if suggestions %} -
Suggestions: {% for suggestion in suggestions %}
{% endfor %}
+
Suggestions: {% for suggestion in suggestions %}
{% endfor %}
{% endif %}
Number of results: {{ number_of_results }} @@ -18,14 +18,14 @@ {% include 'result_templates/default.html' %} {% endif %} {% endfor %} -
+
-
+
From 6d5154f00816173878f76efdf9a6e49982ba130a Mon Sep 17 00:00:00 2001 From: dalf Date: Tue, 31 Dec 2013 13:33:45 +0100 Subject: [PATCH 2/3] [mod] the search text input gets the focus automatically --- searx/templates/base.html | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/templates/base.html b/searx/templates/base.html index 9aa40297e..8175836ec 100644 --- a/searx/templates/base.html +++ b/searx/templates/base.html @@ -18,6 +18,7 @@
{% block content %} {% endblock %} +
From 4e8b75a0fbddb64e079dfd88658f344fa624f27c Mon Sep 17 00:00:00 2001 From: dalf Date: Tue, 31 Dec 2013 13:33:45 +0100 Subject: [PATCH 3/3] [mod] the search text input gets the focus automatically --- searx/static/js/searx.js | 27 +++++++++++++++++++++++++++ searx/templates/base.html | 1 + 2 files changed, 28 insertions(+) create mode 100644 searx/static/js/searx.js diff --git a/searx/static/js/searx.js b/searx/static/js/searx.js new file mode 100644 index 000000000..5eb880f65 --- /dev/null +++ b/searx/static/js/searx.js @@ -0,0 +1,27 @@ +(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) { + addListener(qinput, 'focus', placeCursorAtEnd); + qinput.focus(); + } + }); + +})(window, document); + diff --git a/searx/templates/base.html b/searx/templates/base.html index 9aa40297e..8175836ec 100644 --- a/searx/templates/base.html +++ b/searx/templates/base.html @@ -18,6 +18,7 @@
{% block content %} {% endblock %} +