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 %} +
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 %} -
+
-
+