Merge pull request #1320 from dalf/theme-fix-click-on-search-input

Theme fix click on search input
dependabot/pip/master/sphinx-6.1.3
Paul Braeuning 2 years ago committed by GitHub
commit 7bc3d17b11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -317,7 +317,12 @@ searxng.ready(function () {
function searchInputFocus () {
window.scrollTo(0, 0);
document.querySelector('#q').focus();
var q = document.querySelector('#q');
q.focus();
if (q.setSelectionRange) {
var len = q.value.length;
q.setSelectionRange(len, len);
}
}
function openResult (newTab) {

@ -3,17 +3,10 @@
(function (w, d, searxng) {
'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;
function placeCursorAtEnd (element) {
if (element.setSelectionRange) {
var len = element.value.length;
element.setSelectionRange(len, len);
}
}
function submitIfQuery () {
if (qinput.value.length > 0) {
var search = document.getElementById('search');
@ -45,15 +38,6 @@
searxng.ready(function () {
qinput = d.getElementById(qinput_id);
function placeCursorAtEndOnce () {
if (firstFocus) {
placeCursorAtEnd(qinput);
firstFocus = false;
} else {
// e.preventDefault();
}
}
if (qinput !== null) {
// clear button
createClearButton(qinput);
@ -84,8 +68,6 @@
}, "#" + qinput_id);
}
qinput.addEventListener('focus', placeCursorAtEndOnce, false);
if (!isMobile && document.querySelector('.index_endpoint')) {
qinput.focus();
}

Loading…
Cancel
Save