Merge remote-tracking branch 'dalf/master'

This commit is contained in:
asciimoo 2014-01-01 20:56:50 +01:00
commit 11fdd8e8ac
3 changed files with 31 additions and 3 deletions

27
searx/static/js/searx.js Normal file
View File

@ -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);

View File

@ -18,6 +18,7 @@
<div id="container">
{% block content %}
{% endblock %}
<script src="/static/js/searx.js" ></script>
</div>
</body>
</html>

View File

@ -6,7 +6,7 @@
</div>
<div id="results">
{% if suggestions %}
<div id="suggestions">Suggestions: {% for suggestion in suggestions %}<form method="post" action=""><input type="hidden" name="q" value="{{suggestion}}"><input type="submit" value="{{ suggestion }}" /></form>{% endfor %}</div>
<div id="suggestions">Suggestions: {% for suggestion in suggestions %}<form method="post" action="/"><input type="hidden" name="q" value="{{suggestion}}"><input type="submit" value="{{ suggestion }}" /></form>{% endfor %}</div>
{% endif %}
<div>
Number of results: {{ number_of_results }}
@ -18,14 +18,14 @@
{% include 'result_templates/default.html' %}
{% endif %}
{% endfor %}
<form method="post" action="">
<form method="post" action="/">
<div class="left">
<input type="hidden" name="q" value="{{ q }}" />
<input type="hidden" name="format" value="csv" />
<input type="submit" value="download results in csv" />
</div>
</form>
<form method="post" action="">
<form method="post" action="/">
<div class="">
<input type="hidden" name="q" value="{{ q }}" />
<input type="hidden" name="format" value="json" />