diff --git a/searx/static/themes/simple/img/img_load_error.svg b/searx/static/themes/simple/img/img_load_error.svg
index 27ff0f056..5e3a0d62b 100644
--- a/searx/static/themes/simple/img/img_load_error.svg
+++ b/searx/static/themes/simple/img/img_load_error.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/searx/static/themes/simple/img/searxng.svg b/searx/static/themes/simple/img/searxng.svg
index e965ed242..685d55d5d 100644
--- a/searx/static/themes/simple/img/searxng.svg
+++ b/searx/static/themes/simple/img/searxng.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/searx/static/themes/simple/js/searxng.min.js b/searx/static/themes/simple/js/searxng.min.js
index f853d294d..f466b3c56 100644
--- a/searx/static/themes/simple/js/searxng.min.js
+++ b/searx/static/themes/simple/js/searxng.min.js
@@ -4,7 +4,7 @@
* (C) Copyright Contributors to the searx project (2014 - 2021).
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-window.searxng=function(t,i){"use strict";if(t.Element){(function(e){e.matches=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.msMatchesSelector||function(e){var t=this,n=(t.parentNode||t.document).querySelectorAll(e),r=-1;while(n[++r]&&n[r]!=t);return!!n[r]}})(Element.prototype)}function s(e,t,n){try{e.call(t,n)}catch(e){console.log(e)}}var a=window.searxng||{};a.on=function(r,e,o,t){t=t||false;if(typeof r!=="string"){r.addEventListener(e,o,t)}else{i.addEventListener(e,function(e){var t=e.target||e.srcElement,n=false;while(t&&t.matches&&t!==i&&!(n=t.matches(r)))t=t.parentElement;if(n)s(o,t,e)},t)}};a.ready=function(e){if(document.readyState!="loading"){e.call(t)}else{t.addEventListener("DOMContentLoaded",e.bind(t))}};a.http=function(r,o,i=null){return new Promise(function(e,t){try{var n=new XMLHttpRequest;n.open(r,o,true);n.timeout=2e4;n.onload=function(){if(n.status==200){e(n.response,n.responseType)}else{t(Error(n.statusText))}};n.onerror=function(){t(Error("Network Error"))};n.onabort=function(){t(Error("Transaction is aborted"))};n.ontimeout=function(){t(Error("Timeout"))};if(i){n.send(i)}else{n.send()}}catch(e){t(e)}})};a.loadStyle=function(e){var t=a.settings.theme_static_path+"/"+e,n="style_"+e.replace(".","_"),r=i.getElementById(n);if(r===null){r=i.createElement("link");r.setAttribute("id",n);r.setAttribute("rel","stylesheet");r.setAttribute("type","text/css");r.setAttribute("href",t);i.body.appendChild(r)}};a.loadScript=function(e,t){var n=a.settings.theme_static_path+"/"+e,r="script_"+e.replace(".","_"),o=i.getElementById(r);if(o===null){o=i.createElement("script");o.setAttribute("id",r);o.setAttribute("src",n);o.onload=t;o.onerror=function(){o.setAttribute("error","1")};i.body.appendChild(o)}else if(!o.hasAttribute("error")){try{t.apply(o,[])}catch(e){console.log(e)}}else{console.log("callback not executed : script '"+n+"' not loaded.")}};a.insertBefore=function(e,t){t.parentNode.insertBefore(e,t)};a.insertAfter=function(e,t){t.parentNode.insertAfter(e,t.nextSibling)};a.on(".close","click",function(){this.parentNode.classList.add("invisible")});function e(){for(var e of i.getElementsByTagName("body")[0].classList.values()){if(e.endsWith("_endpoint")){return e.split("_")[0]}}return""}a.endpoint=e();return a}(window,document);searxng.ready(function(){"use strict";searxng.infinite_scroll_supported="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype;if(searxng.endpoint!=="results"){return}if(!searxng.infinite_scroll_supported){console.log("IntersectionObserver not supported");return}let i=document;var s=i.getElementById("results").classList.contains("only_template_images");function n(){var e=i.createElement("div");e.classList.add("loader");return e}function r(t,e){t.textContent="";e.forEach(e=>t.appendChild(e))}function o(o){var e=i.querySelector("#pagination form.next_page");if(!e){return}r(i.querySelector("#pagination"),[n()]);var t=new FormData(e);searxng.http("POST",i.querySelector("#search").getAttribute("action"),t).then(function(e){var t=(new DOMParser).parseFromString(e,"text/html");var n=t.querySelectorAll("#urls article");var r=t.querySelector("#pagination");i.querySelector("#pagination").remove();if(n.length>0&&!s){i.querySelector("#urls").appendChild(i.createElement("hr"))}n.forEach(e=>{i.querySelector("#urls").appendChild(e)});if(r){i.querySelector("#results").appendChild(r);o()}}).catch(function(e){console.log(e);var t=i.createElement("div");t.textContent=searxng.settings.translations.error_loading_next_page;t.classList.add("dialog-error");t.setAttribute("role","alert");r(i.querySelector("#pagination"),[t])})}if(searxng.settings.infinite_scroll&&searxng.infinite_scroll_supported){const a={rootMargin:"20rem"};const l="article.result:last-child";const u=new IntersectionObserver(e=>{const t=e[0];if(t.isIntersecting){u.unobserve(t.target);o(()=>u.observe(i.querySelector(l),a))}});u.observe(i.querySelector(l),a)}});searxng.ready(function(){function e(e){while(e!==undefined){if(e.classList.contains("detail")){return true}if(e.classList.contains("result")){return false}e=e.parentNode}return false}function n(e){while(e!==undefined){if(e.classList.contains("result")){return e}e=e.parentNode}return undefined}function r(e){return e&&e.classList.contains("result-images")}searxng.on(".result","click",function(t){if(!e(t.target)){i(this)(true,true);let e=n(t.target);if(r(e)){t.preventDefault();searxng.selectImage(e)}}});searxng.on(".result a","focus",function(t){if(!e(t.target)){let e=n(t.target);if(e&&e.getAttribute("data-vim-selected")===null){i(e)(true)}if(r(e)){searxng.selectImage(e)}}},true);var t={Escape:{key:"ESC",fun:a,des:"remove focus from the focused input",cat:"Control"},h:{key:"h",fun:v,des:"toggle help window",cat:"Other"},i:{key:"i",fun:m,des:"focus on the search input",cat:"Control"},n:{key:"n",fun:u(),des:"go to next page",cat:"Results"},o:{key:"o",fun:g(false),des:"open search result",cat:"Results"},p:{key:"p",fun:c(),des:"go to previous page",cat:"Results"},r:{key:"r",fun:s,des:"reload page from the server",cat:"Control"},t:{key:"t",fun:g(true),des:"open the result in a new tab",cat:"Results"}};var o={default:Object.assign({ArrowLeft:{key:"←",fun:i("up"),des:"select previous search result",cat:"Results"},ArrowRight:{key:"→",fun:i("down"),des:"select next search result",cat:"Results"}},t),vim:Object.assign({b:{key:"b",fun:f(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},f:{key:"f",fun:f(window.innerHeight),des:"scroll one page down",cat:"Navigation"},u:{key:"u",fun:f(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},d:{key:"d",fun:f(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},g:{key:"g",fun:h(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},v:{key:"v",fun:h(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},k:{key:"k",fun:i("up"),des:"select previous search result",cat:"Results"},j:{key:"j",fun:i("down"),des:"select next search result",cat:"Results"}},t)};var d=o[searxng.settings.hotkeys]||o.default;searxng.on(document,"keydown",function(e){if(Object.prototype.hasOwnProperty.call(d,e.key)&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.metaKey){var t=e.target.tagName.toLowerCase();if(e.key==="Escape"){d[e.key].fun(e)}else{if(e.target===document.body||t==="a"||t==="button"){e.preventDefault();d[e.key].fun()}}}});function i(f){return function(e,t){var n=document.querySelector(".result[data-vim-selected]"),r=f;if(n===null){n=document.querySelector(".result");if(n===null){return}if(f==="down"||f==="up"){r=n}}var o,i=document.querySelectorAll(".result");i=Array.from(i);if(typeof r!=="string"){o=r}else{switch(r){case"visible":var s=document.documentElement.scrollTop||document.body.scrollTop;var a=s+document.documentElement.clientHeight;for(var l=0;ls){break}}break;case"down":o=i[i.indexOf(n)+1]||n;break;case"up":o=i[i.indexOf(n)-1]||n;break;case"bottom":o=i[i.length-1];break;case"top":default:o=i[0]}}if(o){n.removeAttribute("data-vim-selected");o.setAttribute("data-vim-selected","true");if(!t){var d=o.querySelector("h3 a")||o.querySelector("a");if(d!==null){d.focus()}}if(!e){p()}}}}function s(){document.location.reload(true)}function a(e){const t=e.target.tagName.toLowerCase();if(document.activeElement&&(t==="input"||t==="select"||t==="textarea")){document.activeElement.blur()}else{searxng.closeDetail()}}function l(t){return function(){var e=document.querySelector(t);if(e){e.click()}}}function u(){return l('nav#pagination .next_page button[type="submit"]')}function c(){return l('nav#pagination .previous_page button[type="submit"]')}function p(){var e=document.querySelector(".result[data-vim-selected]");if(e===null){return}var t=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.clientHeight,r=e.offsetTop,o=r+e.clientHeight,i=120;if(e.previousElementSibling===null&&or-i){window.scroll(window.scrollX,r-i)}else{var s=t+n;if(s a")}if(e!==null){var t=e.getAttribute("href");if(n){window.open(t)}else{window.location.href=t}}}}function y(e){var n={};for(var t in d){var r=d[t];n[r.cat]=n[r.cat]||[];n[r.cat].push(r)}var o=Object.keys(n).sort(function(e,t){return n[t].length-n[e].length});if(o.length===0){return}var i='×';i+="
element\n return false;\n }\n el = el.parentNode;\n }\n return false;\n }\n\n function getResultElement (el) {\n while (el !== undefined) {\n if (el.classList.contains('result')) {\n return el;\n }\n el = el.parentNode;\n }\n return undefined;\n }\n\n function isImageResult (resultElement) {\n return resultElement && resultElement.classList.contains('result-images');\n }\n\n searxng.on('.result', 'click', function (e) {\n if (!isElementInDetail(e.target)) {\n highlightResult(this)(true, true);\n let resultElement = getResultElement(e.target);\n if (isImageResult(resultElement)) {\n e.preventDefault();\n searxng.selectImage(resultElement);\n }\n }\n });\n\n searxng.on('.result a', 'focus', function (e) {\n if (!isElementInDetail(e.target)) {\n let resultElement = getResultElement(e.target);\n if (resultElement && resultElement.getAttribute(\"data-vim-selected\") === null) {\n highlightResult(resultElement)(true);\n }\n if (isImageResult(resultElement)) {\n searxng.selectImage(resultElement);\n }\n }\n }, true);\n\n /* common base for layouts */\n var baseKeyBinding = {\n 'Escape': {\n key: 'ESC',\n fun: removeFocus,\n des: 'remove focus from the focused input',\n cat: 'Control'\n },\n 'h': {\n key: 'h',\n fun: toggleHelp,\n des: 'toggle help window',\n cat: 'Other'\n },\n 'i': {\n key: 'i',\n fun: searchInputFocus,\n des: 'focus on the search input',\n cat: 'Control'\n },\n 'n': {\n key: 'n',\n fun: GoToNextPage(),\n des: 'go to next page',\n cat: 'Results'\n },\n 'o': {\n key: 'o',\n fun: openResult(false),\n des: 'open search result',\n cat: 'Results'\n },\n 'p': {\n key: 'p',\n fun: GoToPreviousPage(),\n des: 'go to previous page',\n cat: 'Results'\n },\n 'r': {\n key: 'r',\n fun: reloadPage,\n des: 'reload page from the server',\n cat: 'Control'\n },\n 't': {\n key: 't',\n fun: openResult(true),\n des: 'open the result in a new tab',\n cat: 'Results'\n },\n };\n var keyBindingLayouts = {\n\n \"default\": Object.assign(\n { /* SearXNG layout */\n 'ArrowLeft': {\n key: '←',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 'ArrowRight': {\n key: '→',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n }, baseKeyBinding),\n\n 'vim': Object.assign(\n { /* Vim-like Key Layout. */\n 'b': {\n key: 'b',\n fun: scrollPage(-window.innerHeight),\n des: 'scroll one page up',\n cat: 'Navigation'\n },\n 'f': {\n key: 'f',\n fun: scrollPage(window.innerHeight),\n des: 'scroll one page down',\n cat: 'Navigation'\n },\n 'u': {\n key: 'u',\n fun: scrollPage(-window.innerHeight / 2),\n des: 'scroll half a page up',\n cat: 'Navigation'\n },\n 'd': {\n key: 'd',\n fun: scrollPage(window.innerHeight / 2),\n des: 'scroll half a page down',\n cat: 'Navigation'\n },\n 'g': {\n key: 'g',\n fun: scrollPageTo(-document.body.scrollHeight, 'top'),\n des: 'scroll to the top of the page',\n cat: 'Navigation'\n },\n 'v': {\n key: 'v',\n fun: scrollPageTo(document.body.scrollHeight, 'bottom'),\n des: 'scroll to the bottom of the page',\n cat: 'Navigation'\n },\n 'k': {\n key: 'k',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 'j': {\n key: 'j',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n }, baseKeyBinding)\n }\n\n var keyBindings = keyBindingLayouts[searxng.settings.hotkeys] || keyBindingLayouts.default;\n\n searxng.on(document, \"keydown\", function (e) {\n // check for modifiers so we don't break browser's hotkeys\n if (\n Object.prototype.hasOwnProperty.call(keyBindings, e.key)\n && !e.ctrlKey && !e.altKey\n && !e.shiftKey && !e.metaKey\n ) {\n var tagName = e.target.tagName.toLowerCase();\n if (e.key === 'Escape') {\n keyBindings[e.key].fun(e);\n } else {\n if (e.target === document.body || tagName === 'a' || tagName === 'button') {\n e.preventDefault();\n keyBindings[e.key].fun();\n }\n }\n }\n });\n\n function highlightResult (which) {\n return function (noScroll, keepFocus) {\n var current = document.querySelector('.result[data-vim-selected]'),\n effectiveWhich = which;\n if (current === null) {\n // no selection : choose the first one\n current = document.querySelector('.result');\n if (current === null) {\n // no first one : there are no results\n return;\n }\n // replace up/down actions by selecting first one\n if (which === \"down\" || which === \"up\") {\n effectiveWhich = current;\n }\n }\n\n var next, results = document.querySelectorAll('.result');\n results = Array.from(results); // convert NodeList to Array for further use\n\n if (typeof effectiveWhich !== 'string') {\n next = effectiveWhich;\n } else {\n switch (effectiveWhich) {\n case 'visible':\n var top = document.documentElement.scrollTop || document.body.scrollTop;\n var bot = top + document.documentElement.clientHeight;\n\n for (var i = 0; i < results.length; i++) {\n next = results[i];\n var etop = next.offsetTop;\n var ebot = etop + next.clientHeight;\n\n if ((ebot <= bot) && (etop > top)) {\n break;\n }\n }\n break;\n case 'down':\n next = results[results.indexOf(current) + 1] || current;\n break;\n case 'up':\n next = results[results.indexOf(current) - 1] || current;\n break;\n case 'bottom':\n next = results[results.length - 1];\n break;\n case 'top':\n /* falls through */\n default:\n next = results[0];\n }\n }\n\n if (next) {\n current.removeAttribute('data-vim-selected');\n next.setAttribute('data-vim-selected', 'true');\n if (!keepFocus) {\n var link = next.querySelector('h3 a') || next.querySelector('a');\n if (link !== null) {\n link.focus();\n }\n }\n if (!noScroll) {\n scrollPageToSelected();\n }\n }\n };\n }\n\n function reloadPage () {\n document.location.reload(true);\n }\n\n function removeFocus (e) {\n const tagName = e.target.tagName.toLowerCase();\n if (document.activeElement && (tagName === 'input' || tagName === 'select' || tagName === 'textarea')) {\n document.activeElement.blur();\n } else {\n searxng.closeDetail();\n }\n }\n\n function pageButtonClick (css_selector) {\n return function () {\n var button = document.querySelector(css_selector);\n if (button) {\n button.click();\n }\n };\n }\n\n function GoToNextPage () {\n return pageButtonClick('nav#pagination .next_page button[type=\"submit\"]');\n }\n\n function GoToPreviousPage () {\n return pageButtonClick('nav#pagination .previous_page button[type=\"submit\"]');\n }\n\n function scrollPageToSelected () {\n var sel = document.querySelector('.result[data-vim-selected]');\n if (sel === null) {\n return;\n }\n var wtop = document.documentElement.scrollTop || document.body.scrollTop,\n wheight = document.documentElement.clientHeight,\n etop = sel.offsetTop,\n ebot = etop + sel.clientHeight,\n offset = 120;\n // first element ?\n if ((sel.previousElementSibling === null) && (ebot < wheight)) {\n // set to the top of page if the first element\n // is fully included in the viewport\n window.scroll(window.scrollX, 0);\n return;\n }\n if (wtop > (etop - offset)) {\n window.scroll(window.scrollX, etop - offset);\n } else {\n var wbot = wtop + wheight;\n if (wbot < (ebot + offset)) {\n window.scroll(window.scrollX, ebot - wheight + offset);\n }\n }\n }\n\n function scrollPage (amount) {\n return function () {\n window.scrollBy(0, amount);\n highlightResult('visible')();\n };\n }\n\n function scrollPageTo (position, nav) {\n return function () {\n window.scrollTo(0, position);\n highlightResult(nav)();\n };\n }\n\n function searchInputFocus () {\n window.scrollTo(0, 0);\n var q = document.querySelector('#q');\n q.focus();\n if (q.setSelectionRange) {\n var len = q.value.length;\n q.setSelectionRange(len, len);\n }\n }\n\n function openResult (newTab) {\n return function () {\n var link = document.querySelector('.result[data-vim-selected] h3 a');\n if (link === null) {\n link = document.querySelector('.result[data-vim-selected] > a');\n }\n if (link !== null) {\n var url = link.getAttribute('href');\n if (newTab) {\n window.open(url);\n } else {\n window.location.href = url;\n }\n }\n };\n }\n\n function initHelpContent (divElement) {\n var categories = {};\n\n for (var k in keyBindings) {\n var key = keyBindings[k];\n categories[key.cat] = categories[key.cat] || [];\n categories[key.cat].push(key);\n }\n\n var sorted = Object.keys(categories).sort(function (a, b) {\n return categories[b].length - categories[a].length;\n });\n\n if (sorted.length === 0) {\n return;\n }\n\n var html = '×';\n html += '
How to navigate SearXNG with hotkeys
';\n html += '
';\n\n for (var i = 0; i < sorted.length; i++) {\n var cat = categories[sorted[i]];\n\n var lastCategory = i === (sorted.length - 1);\n var first = i % 2 === 0;\n\n if (first) {\n html += '
';\n }\n html += '
';\n\n html += '
' + cat[0].cat + '
';\n html += '
';\n\n for (var cj in cat) {\n html += '
' + cat[cj].key + ' ' + cat[cj].des + '
';\n }\n\n html += '
';\n html += '
'; // col-sm-*\n\n if (!first || lastCategory) {\n html += '
element\n return false;\n }\n el = el.parentNode;\n }\n return false;\n }\n\n function getResultElement (el) {\n while (el !== undefined) {\n if (el.classList.contains('result')) {\n return el;\n }\n el = el.parentNode;\n }\n return undefined;\n }\n\n function isImageResult (resultElement) {\n return resultElement && resultElement.classList.contains('result-images');\n }\n\n searxng.on('.result', 'click', function (e) {\n if (!isElementInDetail(e.target)) {\n highlightResult(this)(true, true);\n let resultElement = getResultElement(e.target);\n if (isImageResult(resultElement)) {\n e.preventDefault();\n searxng.selectImage(resultElement);\n }\n }\n });\n\n searxng.on('.result a', 'focus', function (e) {\n if (!isElementInDetail(e.target)) {\n let resultElement = getResultElement(e.target);\n if (resultElement && resultElement.getAttribute(\"data-vim-selected\") === null) {\n highlightResult(resultElement)(true);\n }\n if (isImageResult(resultElement)) {\n searxng.selectImage(resultElement);\n }\n }\n }, true);\n\n /* common base for layouts */\n var baseKeyBinding = {\n 'Escape': {\n key: 'ESC',\n fun: removeFocus,\n des: 'remove focus from the focused input',\n cat: 'Control'\n },\n 'c': {\n key: 'c',\n fun: copyURLToClipboard,\n des: 'copy url of the selected result to the clipboard',\n cat: 'Results'\n },\n 'h': {\n key: 'h',\n fun: toggleHelp,\n des: 'toggle help window',\n cat: 'Other'\n },\n 'i': {\n key: 'i',\n fun: searchInputFocus,\n des: 'focus on the search input',\n cat: 'Control'\n },\n 'n': {\n key: 'n',\n fun: GoToNextPage(),\n des: 'go to next page',\n cat: 'Results'\n },\n 'o': {\n key: 'o',\n fun: openResult(false),\n des: 'open search result',\n cat: 'Results'\n },\n 'p': {\n key: 'p',\n fun: GoToPreviousPage(),\n des: 'go to previous page',\n cat: 'Results'\n },\n 'r': {\n key: 'r',\n fun: reloadPage,\n des: 'reload page from the server',\n cat: 'Control'\n },\n 't': {\n key: 't',\n fun: openResult(true),\n des: 'open the result in a new tab',\n cat: 'Results'\n },\n };\n var keyBindingLayouts = {\n\n \"default\": Object.assign(\n { /* SearXNG layout */\n 'ArrowLeft': {\n key: '←',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 'ArrowRight': {\n key: '→',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n }, baseKeyBinding),\n\n 'vim': Object.assign(\n { /* Vim-like Key Layout. */\n 'b': {\n key: 'b',\n fun: scrollPage(-window.innerHeight),\n des: 'scroll one page up',\n cat: 'Navigation'\n },\n 'f': {\n key: 'f',\n fun: scrollPage(window.innerHeight),\n des: 'scroll one page down',\n cat: 'Navigation'\n },\n 'u': {\n key: 'u',\n fun: scrollPage(-window.innerHeight / 2),\n des: 'scroll half a page up',\n cat: 'Navigation'\n },\n 'd': {\n key: 'd',\n fun: scrollPage(window.innerHeight / 2),\n des: 'scroll half a page down',\n cat: 'Navigation'\n },\n 'g': {\n key: 'g',\n fun: scrollPageTo(-document.body.scrollHeight, 'top'),\n des: 'scroll to the top of the page',\n cat: 'Navigation'\n },\n 'v': {\n key: 'v',\n fun: scrollPageTo(document.body.scrollHeight, 'bottom'),\n des: 'scroll to the bottom of the page',\n cat: 'Navigation'\n },\n 'k': {\n key: 'k',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 'j': {\n key: 'j',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n 'y': {\n key: 'y',\n fun: copyURLToClipboard,\n des: 'copy url of the selected result to the clipboard',\n cat: 'Results'\n },\n }, baseKeyBinding)\n }\n\n var keyBindings = keyBindingLayouts[searxng.settings.hotkeys] || keyBindingLayouts.default;\n\n searxng.on(document, \"keydown\", function (e) {\n // check for modifiers so we don't break browser's hotkeys\n if (\n Object.prototype.hasOwnProperty.call(keyBindings, e.key)\n && !e.ctrlKey && !e.altKey\n && !e.shiftKey && !e.metaKey\n ) {\n var tagName = e.target.tagName.toLowerCase();\n if (e.key === 'Escape') {\n keyBindings[e.key].fun(e);\n } else {\n if (e.target === document.body || tagName === 'a' || tagName === 'button') {\n e.preventDefault();\n keyBindings[e.key].fun();\n }\n }\n }\n });\n\n function highlightResult (which) {\n return function (noScroll, keepFocus) {\n var current = document.querySelector('.result[data-vim-selected]'),\n effectiveWhich = which;\n if (current === null) {\n // no selection : choose the first one\n current = document.querySelector('.result');\n if (current === null) {\n // no first one : there are no results\n return;\n }\n // replace up/down actions by selecting first one\n if (which === \"down\" || which === \"up\") {\n effectiveWhich = current;\n }\n }\n\n var next, results = document.querySelectorAll('.result');\n results = Array.from(results); // convert NodeList to Array for further use\n\n if (typeof effectiveWhich !== 'string') {\n next = effectiveWhich;\n } else {\n switch (effectiveWhich) {\n case 'visible':\n var top = document.documentElement.scrollTop || document.body.scrollTop;\n var bot = top + document.documentElement.clientHeight;\n\n for (var i = 0; i < results.length; i++) {\n next = results[i];\n var etop = next.offsetTop;\n var ebot = etop + next.clientHeight;\n\n if ((ebot <= bot) && (etop > top)) {\n break;\n }\n }\n break;\n case 'down':\n next = results[results.indexOf(current) + 1] || current;\n break;\n case 'up':\n next = results[results.indexOf(current) - 1] || current;\n break;\n case 'bottom':\n next = results[results.length - 1];\n break;\n case 'top':\n /* falls through */\n default:\n next = results[0];\n }\n }\n\n if (next) {\n current.removeAttribute('data-vim-selected');\n next.setAttribute('data-vim-selected', 'true');\n if (!keepFocus) {\n var link = next.querySelector('h3 a') || next.querySelector('a');\n if (link !== null) {\n link.focus();\n }\n }\n if (!noScroll) {\n scrollPageToSelected();\n }\n }\n };\n }\n\n function reloadPage () {\n document.location.reload(true);\n }\n\n function removeFocus (e) {\n const tagName = e.target.tagName.toLowerCase();\n if (document.activeElement && (tagName === 'input' || tagName === 'select' || tagName === 'textarea')) {\n document.activeElement.blur();\n } else {\n searxng.closeDetail();\n }\n }\n\n function pageButtonClick (css_selector) {\n return function () {\n var button = document.querySelector(css_selector);\n if (button) {\n button.click();\n }\n };\n }\n\n function GoToNextPage () {\n return pageButtonClick('nav#pagination .next_page button[type=\"submit\"]');\n }\n\n function GoToPreviousPage () {\n return pageButtonClick('nav#pagination .previous_page button[type=\"submit\"]');\n }\n\n function scrollPageToSelected () {\n var sel = document.querySelector('.result[data-vim-selected]');\n if (sel === null) {\n return;\n }\n var wtop = document.documentElement.scrollTop || document.body.scrollTop,\n wheight = document.documentElement.clientHeight,\n etop = sel.offsetTop,\n ebot = etop + sel.clientHeight,\n offset = 120;\n // first element ?\n if ((sel.previousElementSibling === null) && (ebot < wheight)) {\n // set to the top of page if the first element\n // is fully included in the viewport\n window.scroll(window.scrollX, 0);\n return;\n }\n if (wtop > (etop - offset)) {\n window.scroll(window.scrollX, etop - offset);\n } else {\n var wbot = wtop + wheight;\n if (wbot < (ebot + offset)) {\n window.scroll(window.scrollX, ebot - wheight + offset);\n }\n }\n }\n\n function scrollPage (amount) {\n return function () {\n window.scrollBy(0, amount);\n highlightResult('visible')();\n };\n }\n\n function scrollPageTo (position, nav) {\n return function () {\n window.scrollTo(0, position);\n highlightResult(nav)();\n };\n }\n\n function searchInputFocus () {\n window.scrollTo(0, 0);\n var q = document.querySelector('#q');\n q.focus();\n if (q.setSelectionRange) {\n var len = q.value.length;\n q.setSelectionRange(len, len);\n }\n }\n\n function openResult (newTab) {\n return function () {\n var link = document.querySelector('.result[data-vim-selected] h3 a');\n if (link === null) {\n link = document.querySelector('.result[data-vim-selected] > a');\n }\n if (link !== null) {\n var url = link.getAttribute('href');\n if (newTab) {\n window.open(url);\n } else {\n window.location.href = url;\n }\n }\n };\n }\n\n function initHelpContent (divElement) {\n var categories = {};\n\n for (var k in keyBindings) {\n var key = keyBindings[k];\n categories[key.cat] = categories[key.cat] || [];\n categories[key.cat].push(key);\n }\n\n var sorted = Object.keys(categories).sort(function (a, b) {\n return categories[b].length - categories[a].length;\n });\n\n if (sorted.length === 0) {\n return;\n }\n\n var html = '×';\n html += '
How to navigate SearXNG with hotkeys
';\n html += '
';\n\n for (var i = 0; i < sorted.length; i++) {\n var cat = categories[sorted[i]];\n\n var lastCategory = i === (sorted.length - 1);\n var first = i % 2 === 0;\n\n if (first) {\n html += '
';\n }\n html += '
';\n\n html += '
' + cat[0].cat + '
';\n html += '
';\n\n for (var cj in cat) {\n html += '
' + cat[cj].key + ' ' + cat[cj].des + '
';\n }\n\n html += '
';\n html += '
'; // col-sm-*\n\n if (!first || lastCategory) {\n html += '