|
@@ -3,17 +3,10 @@
|
|
(function (w, d, searxng) {
|
|
(function (w, d, searxng) {
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
- var firstFocus = true, qinput_id = "q", qinput;
|
|
|
|
|
|
+ var qinput_id = "q", qinput;
|
|
|
|
|
|
const isMobile = window.matchMedia("only screen and (max-width: 50em)").matches;
|
|
const isMobile = window.matchMedia("only screen and (max-width: 50em)").matches;
|
|
|
|
|
|
- function placeCursorAtEnd (element) {
|
|
|
|
- if (element.setSelectionRange) {
|
|
|
|
- var len = element.value.length;
|
|
|
|
- element.setSelectionRange(len, len);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
function submitIfQuery () {
|
|
function submitIfQuery () {
|
|
if (qinput.value.length > 0) {
|
|
if (qinput.value.length > 0) {
|
|
var search = document.getElementById('search');
|
|
var search = document.getElementById('search');
|
|
@@ -45,15 +38,6 @@
|
|
searxng.ready(function () {
|
|
searxng.ready(function () {
|
|
qinput = d.getElementById(qinput_id);
|
|
qinput = d.getElementById(qinput_id);
|
|
|
|
|
|
- function placeCursorAtEndOnce () {
|
|
|
|
- if (firstFocus) {
|
|
|
|
- placeCursorAtEnd(qinput);
|
|
|
|
- firstFocus = false;
|
|
|
|
- } else {
|
|
|
|
- // e.preventDefault();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (qinput !== null) {
|
|
if (qinput !== null) {
|
|
// clear button
|
|
// clear button
|
|
createClearButton(qinput);
|
|
createClearButton(qinput);
|
|
@@ -84,8 +68,6 @@
|
|
}, "#" + qinput_id);
|
|
}, "#" + qinput_id);
|
|
}
|
|
}
|
|
|
|
|
|
- qinput.addEventListener('focus', placeCursorAtEndOnce, false);
|
|
|
|
-
|
|
|
|
if (!isMobile && document.querySelector('.index_endpoint')) {
|
|
if (!isMobile && document.querySelector('.index_endpoint')) {
|
|
qinput.focus();
|
|
qinput.focus();
|
|
}
|
|
}
|