on master help sign in
[mod] the search text input gets the focus automatically
4e8b75adalf
searx/static/js/searx.jsnew file+27
@@ -0,0 +1,27 @@
1+(function (w, d) {
2+ 'use strict';
3+ function addListener(el, type, fn) {
4+ if (el.addEventListener) {
5+ el.addEventListener(type, fn, false);
6+ } else {
7+ el.attachEvent('on' + type, fn);
8+ }
9+ }
10+
11+ function placeCursorAtEnd() {
12+ if (this.setSelectionRange) {
13+ var len = this.value.length * 2;
14+ this.setSelectionRange(len, len);
15+ }
16+ }
17+
18+ addListener(w, 'load', function () {
19+ var qinput = d.getElementById('q');
20+ if (qinput !== null) {
21+ addListener(qinput, 'focus', placeCursorAtEnd);
22+ qinput.focus();
23+ }
24+ });
25+
26+})(window, document);
27+
searx/templates/base.html+1
@@ -18,6 +18,7 @@
18<div id="container">
18<div id="container">
19{% block content %}
19{% block content %}
20{% endblock %}
20{% endblock %}
21+<script src="/static/js/searx.js" ></script>
21</div>
22</div>
22</body>
23</body>
23</html>
24</html>