diff --git a/searx/static/themes/simple/src/js/head/00_init.js b/searx/static/themes/simple/src/js/head/00_init.js
index 21b1754bf33..099f47959f8 100644
--- a/searx/static/themes/simple/src/js/head/00_init.js
+++ b/searx/static/themes/simple/src/js/head/00_init.js
@@ -6,31 +6,31 @@
*/
/* global DocumentTouch:readonly */
(function(w, d) {
- 'use strict';
+ 'use strict';
- // add data- properties
- var script = d.currentScript || (function() {
- var scripts = d.getElementsByTagName('script');
- return scripts[scripts.length - 1];
- })();
+ // add data- properties
+ var script = d.currentScript || (function() {
+ var scripts = d.getElementsByTagName('script');
+ return scripts[scripts.length - 1];
+ })();
- // try to detect touch screen
- w.searxng = {
- touch: (("ontouchstart" in w) || w.DocumentTouch && document instanceof DocumentTouch) || false,
- method: script.getAttribute('data-method'),
- autocompleter: script.getAttribute('data-autocompleter') === 'true',
- search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true',
- infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true',
- hotkeys: script.getAttribute('data-hotkeys') === 'true',
- static_path: script.getAttribute('data-static-path'),
- translations: JSON.parse(script.getAttribute('data-translations')),
- };
+ // try to detect touch screen
+ w.searxng = {
+ touch: (("ontouchstart" in w) || w.DocumentTouch && document instanceof DocumentTouch) || false,
+ method: script.getAttribute('data-method'),
+ autocompleter: script.getAttribute('data-autocompleter') === 'true',
+ search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true',
+ infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true',
+ hotkeys: script.getAttribute('data-hotkeys') === 'true',
+ static_path: script.getAttribute('data-static-path'),
+ translations: JSON.parse(script.getAttribute('data-translations')),
+ };
- // update the css
- var hmtlElement = d.getElementsByTagName("html")[0];
- hmtlElement.classList.remove('no-js');
- hmtlElement.classList.add('js');
- if (w.searxng.touch) {
- hmtlElement.classList.add('touch');
- }
+ // update the css
+ var hmtlElement = d.getElementsByTagName("html")[0];
+ hmtlElement.classList.remove('no-js');
+ hmtlElement.classList.add('js');
+ if (w.searxng.touch) {
+ hmtlElement.classList.add('touch');
+ }
})(window, document);
\ No newline at end of file
diff --git a/searx/static/themes/simple/src/js/main/00_toolkit.js b/searx/static/themes/simple/src/js/main/00_toolkit.js
index 7dc50108bd0..0151e2498ad 100644
--- a/searx/static/themes/simple/src/js/main/00_toolkit.js
+++ b/searx/static/themes/simple/src/js/main/00_toolkit.js
@@ -61,12 +61,12 @@ window.searxng = (function(w, d) {
searxng.http = function(method, url) {
var req = new XMLHttpRequest(),
- resolve = function() {},
- reject = function() {},
- promise = {
- then: function(callback) { resolve = callback; return promise; },
- catch: function(callback) { reject = callback; return promise; }
- };
+ resolve = function() {},
+ reject = function() {},
+ promise = {
+ then: function(callback) { resolve = callback; return promise; },
+ catch: function(callback) { reject = callback; return promise; }
+ };
try {
req.open(method, url, true);
@@ -100,8 +100,8 @@ window.searxng = (function(w, d) {
searxng.loadStyle = function(src) {
var path = searxng.static_path + src,
- id = "style_" + src.replace('.', '_'),
- s = d.getElementById(id);
+ id = "style_" + src.replace('.', '_'),
+ s = d.getElementById(id);
if (s === null) {
s = d.createElement('link');
s.setAttribute('id', id);
@@ -114,8 +114,8 @@ window.searxng = (function(w, d) {
searxng.loadScript = function(src, callback) {
var path = searxng.static_path + src,
- id = "script_" + src.replace('.', '_'),
- s = d.getElementById(id);
+ id = "script_" + src.replace('.', '_'),
+ s = d.getElementById(id);
if (s === null) {
s = d.createElement('script');
s.setAttribute('id', id);
@@ -142,11 +142,11 @@ window.searxng = (function(w, d) {
searxng.insertAfter = function(newNode, referenceNode) {
referenceNode.parentNode.insertAfter(newNode, referenceNode.nextSibling);
- };
+ };
searxng.on('.close', 'click', function() {
this.parentNode.classList.add('invisible');
});
-
+
return searxng;
})(window, document);
diff --git a/searx/static/themes/simple/src/js/main/keyboard.js b/searx/static/themes/simple/src/js/main/keyboard.js
index 788d289ef88..a9156c33756 100644
--- a/searx/static/themes/simple/src/js/main/keyboard.js
+++ b/searx/static/themes/simple/src/js/main/keyboard.js
@@ -174,7 +174,7 @@ searxng.ready(function() {
function highlightResult(which) {
return function(noScroll) {
var current = document.querySelector('.result[data-vim-selected]'),
- effectiveWhich = which;
+ effectiveWhich = which;
if (current === null) {
// no selection : choose the first one
current = document.querySelector('.result');
@@ -194,7 +194,7 @@ searxng.ready(function() {
next = effectiveWhich;
} else {
switch (effectiveWhich) {
- case 'visible':
+ case 'visible':
var top = document.documentElement.scrollTop || document.body.scrollTop;
var bot = top + document.documentElement.clientHeight;
@@ -208,24 +208,24 @@ searxng.ready(function() {
}
}
break;
- case 'down':
+ case 'down':
next = current.nextElementSibling;
if (next === null) {
next = results[0];
}
break;
- case 'up':
+ case 'up':
next = current.previousElementSibling;
if (next === null) {
next = results[results.length - 1];
}
break;
- case 'bottom':
+ case 'bottom':
next = results[results.length - 1];
break;
- case 'top':
+ case 'top':
/* falls through */
- default:
+ default:
next = results[0];
}
}
@@ -280,10 +280,10 @@ searxng.ready(function() {
return;
}
var wtop = document.documentElement.scrollTop || document.body.scrollTop,
- wheight = document.documentElement.clientHeight,
- etop = sel.offsetTop,
- ebot = etop + sel.clientHeight,
- offset = 120;
+ wheight = document.documentElement.clientHeight,
+ etop = sel.offsetTop,
+ ebot = etop + sel.clientHeight,
+ offset = 120;
// first element ?
if ((sel.previousElementSibling === null) && (ebot < wheight)) {
// set to the top of page if the first element
@@ -386,23 +386,23 @@ searxng.ready(function() {
html += '';
- divElement.innerHTML = html;
+ divElement.innerHTML = html;
}
function toggleHelp() {
var helpPanel = document.querySelector('#vim-hotkeys-help');
if (helpPanel === undefined || helpPanel === null) {
- // first call
+ // first call
helpPanel = document.createElement('div');
- helpPanel.id = 'vim-hotkeys-help';
- helpPanel.className='dialog-modal';
+ helpPanel.id = 'vim-hotkeys-help';
+ helpPanel.className='dialog-modal';
+ initHelpContent(helpPanel);
initHelpContent(helpPanel);
- initHelpContent(helpPanel);
initHelpContent(helpPanel);
var body = document.getElementsByTagName('body')[0];
body.appendChild(helpPanel);
} else {
- // togggle hidden
+ // togggle hidden
helpPanel.classList.toggle('invisible');
return;
}
diff --git a/searx/static/themes/simple/src/js/main/preferences.js b/searx/static/themes/simple/src/js/main/preferences.js
index b19026a4339..c40bbda222c 100644
--- a/searx/static/themes/simple/src/js/main/preferences.js
+++ b/searx/static/themes/simple/src/js/main/preferences.js
@@ -1,28 +1,28 @@
/* SPDX-License-Identifier: AGPL-3.0-or-later */
(function (w, d, searxng) {
- 'use strict';
+ 'use strict';
- searxng.ready(function() {
- let engine_descriptions = null;
- function load_engine_descriptions() {
- if (engine_descriptions == null) {
- searxng.http("GET", "engine_descriptions.json").then(function(content) {
- engine_descriptions = JSON.parse(content);
- for (const [engine_name, description] of Object.entries(engine_descriptions)) {
- let elements = d.querySelectorAll('[data-engine-name="' + engine_name + '"] .engine-description');
- for(const element of elements) {
- let source = ' (' + searxng.translations['Source'] + ': ' + description[1] + ')';
- element.innerHTML = description[0] + source;
- }
- }
- });
+ searxng.ready(function() {
+ let engine_descriptions = null;
+ function load_engine_descriptions() {
+ if (engine_descriptions == null) {
+ searxng.http("GET", "engine_descriptions.json").then(function(content) {
+ engine_descriptions = JSON.parse(content);
+ for (const [engine_name, description] of Object.entries(engine_descriptions)) {
+ let elements = d.querySelectorAll('[data-engine-name="' + engine_name + '"] .engine-description');
+ for(const element of elements) {
+ let source = ' (' + searxng.translations['Source'] + ': ' + description[1] + ')';
+ element.innerHTML = description[0] + source;
}
- }
+ }
+ });
+ }
+ }
- if (d.querySelector('body[class="preferences_endpoint"]')) {
- for(const el of d.querySelectorAll('[data-engine-name]')) {
- searxng.on(el, 'mouseenter', load_engine_descriptions);
- }
- }
- });
+ if (d.querySelector('body[class="preferences_endpoint"]')) {
+ for(const el of d.querySelectorAll('[data-engine-name]')) {
+ searxng.on(el, 'mouseenter', load_engine_descriptions);
+ }
+ }
+ });
})(window, document, window.searxng);
diff --git a/searx/static/themes/simple/src/js/main/results.js b/searx/static/themes/simple/src/js/main/results.js
index e4b139fe01c..696200b1119 100644
--- a/searx/static/themes/simple/src/js/main/results.js
+++ b/searx/static/themes/simple/src/js/main/results.js
@@ -70,7 +70,7 @@
searxng.image_thumbnail_layout.align();
searxng.scrollPageToSelected();
}
- searxng.on('.result-detail-close', 'click', e => {
+ searxng.on('.result-detail-close', 'click', e => {
e.preventDefault();
searxng.closeDetail();
});
@@ -79,8 +79,8 @@
w.addEventListener('scroll', function() {
var e = d.getElementById('backToTop'),
- scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
- results = d.getElementById('results');
+ scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
+ results = d.getElementById('results');
if (e !== null) {
if (scrollTop >= 100) {
results.classList.add('scrolling');
diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js
index 0244a90eab8..3a8c9661d46 100644
--- a/searx/static/themes/simple/src/js/main/search.js
+++ b/searx/static/themes/simple/src/js/main/search.js
@@ -23,9 +23,9 @@
var cs = document.getElementById('clear_search');
var updateClearButton = function() {
if (qinput.value.length === 0) {
- cs.classList.add("empty");
+ cs.classList.add("empty");
} else {
- cs.classList.remove("empty");
+ cs.classList.remove("empty");
}
};
@@ -54,7 +54,7 @@
if (qinput !== null) {
// clear button
createClearButton(qinput);
-
+
// autocompleter
if (searxng.autocompleter) {
searxng.autocomplete = AutoComplete.call(w, {
diff --git a/searx/static/themes/simple/svg4web.svgo.js b/searx/static/themes/simple/svg4web.svgo.js
index 5b985adfe4b..83f74cde1ed 100644
--- a/searx/static/themes/simple/svg4web.svgo.js
+++ b/searx/static/themes/simple/svg4web.svgo.js
@@ -15,5 +15,5 @@ module.exports = {
// Optimize SVG for WEB usage
'convertStyleToAttrs',
'removeXMLNS'
- ],
+ ],
};