diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2025-05-22 11:51:30 +0200 |
|---|---|---|
| committer | Bnyro <bnyro@tutanota.com> | 2025-05-22 15:16:54 +0200 |
| commit | 861f9c4be52a4844631fb72c3c0dcf8fb6cc77fc (patch) | |
| tree | e51ae64a5226cc72760008b909dbc5c5c90561eb /searx/static/themes/simple/js/searxng.min.js | |
| parent | 32823ecb69b115a6726475d6421f0a1c0327fafa (diff) | |
[build] /static
Diffstat (limited to 'searx/static/themes/simple/js/searxng.min.js')
| -rw-r--r-- | searx/static/themes/simple/js/searxng.min.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/static/themes/simple/js/searxng.min.js b/searx/static/themes/simple/js/searxng.min.js index f2c49fb32..ce8fd6aa7 100644 --- a/searx/static/themes/simple/js/searxng.min.js +++ b/searx/static/themes/simple/js/searxng.min.js @@ -3,12 +3,12 @@ * (C) Copyright Contributors to the SearXNG project. * (C) Copyright Contributors to the searx project (2014 - 2021). * SPDX-License-Identifier: AGPL-3.0-or-later - */window.searxng=function(h,d){h.Element&&function(r){r.matches=r.matches||r.matchesSelector||r.webkitMatchesSelector||r.msMatchesSelector||function(a){for(var l=this,n=(l.parentNode||l.document).querySelectorAll(a),e=-1;n[++e]&&n[e]!=l;);return!!n[e]}}(Element.prototype);function u(r,a,l){try{r.call(a,l)}catch(n){console.log(n)}}var p=window.searxng||{};p.on=function(r,a,l,n){n=n||!1,typeof r!="string"?r.addEventListener(a,l,n):d.addEventListener(a,function(e){for(var t=e.target||e.srcElement,o=!1;t&&t.matches&&t!==d&&!(o=t.matches(r));)t=t.parentElement;o&&u(l,t,e)},n)},p.ready=function(r){document.readyState!="loading"?r.call(h):h.addEventListener("DOMContentLoaded",r.bind(h))},p.http=function(r,a,l=null){return new Promise(function(n,e){try{var t=new XMLHttpRequest;t.open(r,a,!0),t.timeout=2e4,t.onload=function(){t.status==200?n(t.response,t.responseType):e(Error(t.statusText))},t.onerror=function(){e(Error("Network Error"))},t.onabort=function(){e(Error("Transaction is aborted"))},t.ontimeout=function(){e(Error("Timeout"))},l?t.send(l):t.send()}catch(o){e(o)}})},p.loadStyle=function(r){var a=p.settings.theme_static_path+"/"+r,l="style_"+r.replace(".","_"),n=d.getElementById(l);n===null&&(n=d.createElement("link"),n.setAttribute("id",l),n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href",a),d.body.appendChild(n))},p.loadScript=function(r,a){var l=p.settings.theme_static_path+"/"+r,n="script_"+r.replace(".","_"),e=d.getElementById(n);if(e===null)e=d.createElement("script"),e.setAttribute("id",n),e.setAttribute("src",l),e.onload=a,e.onerror=function(){e.setAttribute("error","1")},d.body.appendChild(e);else if(e.hasAttribute("error"))console.log("callback not executed : script '"+l+"' not loaded.");else try{a.apply(e,[])}catch(t){console.log(t)}},p.insertBefore=function(r,a){a.parentNode.insertBefore(r,a)},p.insertAfter=function(r,a){a.parentNode.insertAfter(r,a.nextSibling)},p.on(".close","click",function(){this.parentNode.classList.add("invisible")});function m(){for(var r of d.getElementsByTagName("body")[0].classList.values())if(r.endsWith("_endpoint"))return r.split("_")[0];return""}return p.endpoint=m(),p}(window,document);searxng.ready(function(){if(searxng.infinite_scroll_supported="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype,searxng.endpoint!=="results")return;if(!searxng.infinite_scroll_supported){console.log("IntersectionObserver not supported");return}let h=document;var d=h.getElementById("results").classList.contains("only_template_images");function u(){var r=h.createElement("div");return r.classList.add("loader"),r}function p(r,a){r.textContent="",a.forEach(l=>r.appendChild(l))}function m(r){var a=h.querySelector("#pagination form.next_page");if(a){p(h.querySelector("#pagination"),[u()]);var l=new FormData(a);searxng.http("POST",h.querySelector("#search").getAttribute("action"),l).then(function(n){var e=new DOMParser().parseFromString(n,"text/html"),t=e.querySelectorAll("#urls article"),o=e.querySelector("#pagination");h.querySelector("#pagination").remove(),t.length>0&&!d&&h.querySelector("#urls").appendChild(h.createElement("hr")),t.forEach(c=>{h.querySelector("#urls").appendChild(c)}),o&&(h.querySelector("#results").appendChild(o),r())}).catch(function(n){console.log(n);var e=h.createElement("div");e.textContent=searxng.settings.translations.error_loading_next_page,e.classList.add("dialog-error"),e.setAttribute("role","alert"),p(h.querySelector("#pagination"),[e])})}}if(searxng.settings.infinite_scroll&&searxng.infinite_scroll_supported){const r={rootMargin:"20rem"},a="article.result:last-child",l=new IntersectionObserver(n=>{const e=n[0];e.isIntersecting&&(l.unobserve(e.target),m(()=>l.observe(h.querySelector(a),r)))});l.observe(h.querySelector(a),r)}});searxng.ready(function(){function h(i){for(;i!==void 0;){if(i.classList.contains("detail"))return!0;if(i.classList.contains("result"))return!1;i=i.parentNode}return!1}function d(i){for(;i!==void 0;){if(i.classList.contains("result"))return i;i=i.parentNode}}function u(i){return i&&i.classList.contains("result-images")}searxng.on(".result","click",function(i){if(!h(i.target)){a(this)(!0,!0);let f=d(i.target);u(f)&&(i.preventDefault(),searxng.selectImage(f))}}),searxng.on(".result a","focus",function(i){if(!h(i.target)){let f=d(i.target);f&&f.getAttribute("data-vim-selected")===null&&a(f)(!0),u(f)&&searxng.selectImage(f)}},!0);var p={Escape:{key:"ESC",fun:n,des:"remove focus from the focused input",cat:"Control"},c:{key:"c",fun:O,des:"copy url of the selected result to the clipboard",cat:"Results"},h:{key:"h",fun:_,des:"toggle help window",cat:"Other"},i:{key:"i",fun:v,des:"focus on the search input",cat:"Control"},n:{key:"n",fun:t(),des:"go to next page",cat:"Results"},o:{key:"o",fun:b(!1),des:"open search result",cat:"Results"},p:{key:"p",fun:o(),des:"go to previous page",cat:"Results"},r:{key:"r",fun:l,des:"reload page from the server",cat:"Control"},t:{key:"t",fun:b(!0),des:"open the result in a new tab",cat:"Results"}},m={default:Object.assign({ArrowLeft:{key:"←",fun:a("up"),des:"select previous search result",cat:"Results"},ArrowRight:{key:"→",fun:a("down"),des:"select next search result",cat:"Results"}},p),vim:Object.assign({b:{key:"b",fun:s(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},f:{key:"f",fun:s(window.innerHeight),des:"scroll one page down",cat:"Navigation"},u:{key:"u",fun:s(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},d:{key:"d",fun:s(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},g:{key:"g",fun:g(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},v:{key:"v",fun:g(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},k:{key:"k",fun:a("up"),des:"select previous search result",cat:"Results"},j:{key:"j",fun:a("down"),des:"select next search result",cat:"Results"},y:{key:"y",fun:O,des:"copy url of the selected result to the clipboard",cat:"Results"}},p)},r=m[searxng.settings.hotkeys]||m.default;searxng.on(document,"keydown",function(i){if(Object.prototype.hasOwnProperty.call(r,i.key)&&!i.ctrlKey&&!i.altKey&&!i.shiftKey&&!i.metaKey){var f=i.target.tagName.toLowerCase();i.key==="Escape"?r[i.key].fun(i):(i.target===document.body||f==="a"||f==="button")&&(i.preventDefault(),r[i.key].fun())}});function a(i){return function(f,M){var E=document.querySelector(".result[data-vim-selected]"),A=i;if(E===null){if(E=document.querySelector(".result"),E===null)return;(i==="down"||i==="up")&&(A=E)}var y,w=document.querySelectorAll(".result");if(w=Array.from(w),typeof A!="string")y=A;else switch(A){case"visible":for(var T=document.documentElement.scrollTop||document.body.scrollTop,x=T+document.documentElement.clientHeight,I=0;I<w.length;I++){y=w[I];var R=y.offsetTop,N=R+y.clientHeight;if(N<=x&&R>T)break}break;case"down":y=w[w.indexOf(E)+1]||E;break;case"up":y=w[w.indexOf(E)-1]||E;break;case"bottom":y=w[w.length-1];break;case"top":default:y=w[0]}if(y){if(E.removeAttribute("data-vim-selected"),y.setAttribute("data-vim-selected","true"),!M){var D=y.querySelector("h3 a")||y.querySelector("a");D!==null&&D.focus()}f||c()}}}function l(){document.location.reload(!0)}function n(i){const f=i.target.tagName.toLowerCase();document.activeElement&&(f==="input"||f==="select"||f==="textarea")?document.activeElement.blur():searxng.closeDetail()}function e(i){return function(){var f=document.querySelector(i);f&&f.click()}}function t(){return e('nav#pagination .next_page button[type="submit"]')}function o(){return e('nav#pagination .previous_page button[type="submit"]')}function c(){var i=document.querySelector(".result[data-vim-selected]");if(i!==null){var f=document.documentElement.scrollTop||document.body.scrollTop,M=document.documentElement.clientHeight,E=i.offsetTop,A=E+i.clientHeight,y=120;if(i.previousElementSibling===null&&A<M){window.scroll(window.scrollX,0);return}if(f>E-y)window.scroll(window.scrollX,E-y);else{var w=f+M;w<A+y&&window.scroll(window.scrollX,A-M+y)}}}function s(i){return function(){window.scrollBy(0,i),a("visible")()}}function g(i,f){return function(){window.scrollTo(0,i),a(f)()}}function v(){window.scrollTo(0,0);var i=document.querySelector("#q");if(i.focus(),i.setSelectionRange){var f=i.value.length;i.setSelectionRange(f,f)}}function b(i){return function(){var f=document.querySelector(".result[data-vim-selected] h3 a");if(f===null&&(f=document.querySelector(".result[data-vim-selected] > a")),f!==null){var M=f.getAttribute("href");i?window.open(M):window.location.href=M}}}function k(i){var f={};for(var M in r){var E=r[M];f[E.cat]=f[E.cat]||[],f[E.cat].push(E)}var A=Object.keys(f).sort(function(N,D){return f[D].length-f[N].length});if(A.length!==0){var y='<a href="#" class="close" aria-label="close" title="close">×</a>';y+="<h3>How to navigate SearXNG with hotkeys</h3>",y+="<table>";for(var w=0;w<A.length;w++){var T=f[A[w]],x=w===A.length-1,I=w%2===0;I&&(y+="<tr>"),y+="<td>",y+="<h4>"+T[0].cat+"</h4>",y+='<ul class="list-unstyled">';for(var R in T)y+="<li><kbd>"+T[R].key+"</kbd> "+T[R].des+"</li>";y+="</ul>",y+="</td>",(!I||x)&&(y+="</tr>")}y+="</table>",i.innerHTML=y}}function _(){var i=document.querySelector("#vim-hotkeys-help");if(i==null){i=document.createElement("div"),i.id="vim-hotkeys-help",i.className="dialog-modal",k(i);var f=document.getElementsByTagName("body")[0];f.appendChild(i)}else{i.classList.toggle("invisible");return}}function O(){var i=document.querySelector(".result[data-vim-selected] h3 a");if(i===null)return;const f=i.getAttribute("href");navigator.clipboard.writeText(f)}searxng.scrollPageToSelected=c,searxng.selectNext=a("down"),searxng.selectPrevious=a("up")});(function(h,d,u){u.ready(function(){u.on(".searxng_init_map","click",function(p){this.classList.remove("searxng_init_map");var m=this.dataset.leafletTarget,r=parseFloat(this.dataset.mapLon),a=parseFloat(this.dataset.mapLat),l=parseFloat(this.dataset.mapZoom),n=JSON.parse(this.dataset.mapBoundingbox),e=JSON.parse(this.dataset.mapGeojson);u.loadStyle("css/leaflet.css"),u.loadScript("js/leaflet.js",function(){var t=null;if(n){var o=L.latLng(n[0],n[2]),c=L.latLng(n[1],n[3]);t=L.latLngBounds(o,c)}var s=L.map(m),g="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",v='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',b=new L.TileLayer(g,{minZoom:1,maxZoom:19,attribution:v}),k="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",_='Wikimedia maps | Maps data © <a href="https://openstreetmap.org">OpenStreetMap contributors</a>',O=new L.TileLayer(k,{minZoom:1,maxZoom:19,attribution:_});t?setTimeout(function(){s.fitBounds(t,{maxZoom:17})},0):r&&a&&(l?s.setView(new L.latLng(a,r),l):s.setView(new L.latLng(a,r),8)),s.addLayer(b);var i={"OSM Mapnik":b,"OSM Wikimedia":O};L.control.layers(i).addTo(s),e&&L.geoJson(e).addTo(s)}),p.preventDefault()})})})(window,document,window.searxng);(function(h,d,u){u.endpoint==="preferences"&&u.ready(function(){let p=null;function m(){p==null&&u.http("GET","engine_descriptions.json").then(function(t){p=JSON.parse(t);for(const[o,c]of Object.entries(p)){let s=d.querySelectorAll('[data-engine-name="'+o+'"] .engine-description');for(const g of s){let v=" (<i>"+u.settings.translations.Source+": "+c[1]+"</i>)";g.innerHTML=c[0]+v}}})}for(const t of d.querySelectorAll("[data-engine-name]"))u.on(t,"mouseenter",m);const r=d.querySelectorAll(".enable-all-engines"),a=d.querySelectorAll(".disable-all-engines"),l=d.querySelectorAll("tbody input[type=checkbox][class~=checkbox-onoff]"),n=t=>{for(const o of l)o.offsetParent!==null&&(o.checked=!t)};for(const t of r)u.on(t,"click",()=>n(!0));for(const t of a)u.on(t,"click",()=>n(!1));const e=d.querySelector("#copy-hash");u.on(e,"click",t=>{t.preventDefault(),navigator.clipboard.writeText(e.dataset.hash),e.innerText=e.dataset.copiedText})})})(window,document,window.searxng);/*! + */window.searxng=function(h,s){h.Element&&function(o){o.matches=o.matches||o.matchesSelector||o.webkitMatchesSelector||o.msMatchesSelector||function(l){for(var n=this,r=(n.parentNode||n.document).querySelectorAll(l),t=-1;r[++t]&&r[t]!=n;);return!!r[t]}}(Element.prototype);function i(o,l,n){try{o.call(l,n)}catch(r){console.log(r)}}var p=window.searxng||{};p.on=function(o,l,n,r){r=r||!1,typeof o!="string"?o.addEventListener(l,n,r):s.addEventListener(l,function(t){for(var a=t.target||t.srcElement,f=!1;a&&a.matches&&a!==s&&!(f=a.matches(o));)a=a.parentElement;f&&i(n,a,t)},r)},p.ready=function(o){document.readyState!="loading"?o.call(h):h.addEventListener("DOMContentLoaded",o.bind(h))},p.http=function(o,l,n=null){return new Promise(function(r,t){try{var a=new XMLHttpRequest;a.open(o,l,!0),a.timeout=2e4,a.onload=function(){a.status==200?r(a.response,a.responseType):t(Error(a.statusText))},a.onerror=function(){t(Error("Network Error"))},a.onabort=function(){t(Error("Transaction is aborted"))},a.ontimeout=function(){t(Error("Timeout"))},n?a.send(n):a.send()}catch(f){t(f)}})},p.loadStyle=function(o){var l=p.settings.theme_static_path+"/"+o,n="style_"+o.replace(".","_"),r=s.getElementById(n);r===null&&(r=s.createElement("link"),r.setAttribute("id",n),r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),r.setAttribute("href",l),s.body.appendChild(r))},p.loadScript=function(o,l){var n=p.settings.theme_static_path+"/"+o,r="script_"+o.replace(".","_"),t=s.getElementById(r);if(t===null)t=s.createElement("script"),t.setAttribute("id",r),t.setAttribute("src",n),t.onload=l,t.onerror=function(){t.setAttribute("error","1")},s.body.appendChild(t);else if(t.hasAttribute("error"))console.log("callback not executed : script '"+n+"' not loaded.");else try{l.apply(t,[])}catch(a){console.log(a)}},p.insertBefore=function(o,l){l.parentNode.insertBefore(o,l)},p.insertAfter=function(o,l){l.parentNode.insertAfter(o,l.nextSibling)},p.on(".close","click",function(){this.parentNode.classList.add("invisible")});function g(){for(var o of s.getElementsByTagName("body")[0].classList.values())if(o.endsWith("_endpoint"))return o.split("_")[0];return""}return p.endpoint=g(),p}(window,document);searxng.ready(function(){if(searxng.infinite_scroll_supported="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype,searxng.endpoint!=="results")return;if(!searxng.infinite_scroll_supported){console.log("IntersectionObserver not supported");return}let h=document;var s=h.getElementById("results").classList.contains("only_template_images");function i(){var o=h.createElement("div");return o.classList.add("loader"),o}function p(o,l){o.textContent="",l.forEach(n=>o.appendChild(n))}function g(o){var l=h.querySelector("#pagination form.next_page");if(l){p(h.querySelector("#pagination"),[i()]);var n=new FormData(l);searxng.http("POST",h.querySelector("#search").getAttribute("action"),n).then(function(r){var t=new DOMParser().parseFromString(r,"text/html"),a=t.querySelectorAll("#urls article"),f=t.querySelector("#pagination");h.querySelector("#pagination").remove(),a.length>0&&!s&&h.querySelector("#urls").appendChild(h.createElement("hr")),a.forEach(b=>{h.querySelector("#urls").appendChild(b)}),f&&(h.querySelector("#results").appendChild(f),o())}).catch(function(r){console.log(r);var t=h.createElement("div");t.textContent=searxng.settings.translations.error_loading_next_page,t.classList.add("dialog-error"),t.setAttribute("role","alert"),p(h.querySelector("#pagination"),[t])})}}if(searxng.settings.infinite_scroll&&searxng.infinite_scroll_supported){const o={rootMargin:"20rem"},l="article.result:last-child",n=new IntersectionObserver(r=>{const t=r[0];t.isIntersecting&&(n.unobserve(t.target),g(()=>n.observe(h.querySelector(l),o)))});n.observe(h.querySelector(l),o)}});searxng.ready(function(){function h(e){for(;e!==void 0;){if(e.classList.contains("detail"))return!0;if(e.classList.contains("result"))return!1;e=e.parentNode}return!1}function s(e){for(;e!==void 0;){if(e.classList.contains("result"))return e;e=e.parentNode}}function i(e){return e&&e.classList.contains("result-images")}searxng.on(".result","click",function(e){if(!h(e.target)){l(this)(!0,!0);let u=s(e.target);i(u)&&(e.preventDefault(),searxng.selectImage(u))}}),searxng.on(".result a","focus",function(e){if(!h(e.target)){let u=s(e.target);u&&u.getAttribute("data-vim-selected")===null&&l(u)(!0),i(u)&&searxng.selectImage(u)}},!0);var p={Escape:{key:"ESC",fun:r,des:"remove focus from the focused input",cat:"Control"},c:{key:"c",fun:A,des:"copy url of the selected result to the clipboard",cat:"Results"},h:{key:"h",fun:T,des:"toggle help window",cat:"Other"},i:{key:"i",fun:m,des:"focus on the search input",cat:"Control"},n:{key:"n",fun:a(),des:"go to next page",cat:"Results"},o:{key:"o",fun:y(!1),des:"open search result",cat:"Results"},p:{key:"p",fun:f(),des:"go to previous page",cat:"Results"},r:{key:"r",fun:n,des:"reload page from the server",cat:"Control"},t:{key:"t",fun:y(!0),des:"open the result in a new tab",cat:"Results"}},g={default:Object.assign({ArrowLeft:{key:"←",fun:l("up"),des:"select previous search result",cat:"Results"},ArrowRight:{key:"→",fun:l("down"),des:"select next search result",cat:"Results"}},p),vim:Object.assign({b:{key:"b",fun:c(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},f:{key:"f",fun:c(window.innerHeight),des:"scroll one page down",cat:"Navigation"},u:{key:"u",fun:c(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},d:{key:"d",fun:c(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},g:{key:"g",fun:d(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},v:{key:"v",fun:d(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},k:{key:"k",fun:l("up"),des:"select previous search result",cat:"Results"},j:{key:"j",fun:l("down"),des:"select next search result",cat:"Results"},y:{key:"y",fun:A,des:"copy url of the selected result to the clipboard",cat:"Results"}},p)},o=g[searxng.settings.hotkeys]||g.default;searxng.on(document,"keydown",function(e){if(Object.prototype.hasOwnProperty.call(o,e.key)&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.metaKey){var u=e.target.tagName.toLowerCase();e.key==="Escape"?o[e.key].fun(e):(e.target===document.body||u==="a"||u==="button")&&(e.preventDefault(),o[e.key].fun())}});function l(e){return function(u,_){var E=document.querySelector(".result[data-vim-selected]"),k=e;if(E===null){if(E=document.querySelector(".result"),E===null)return;(e==="down"||e==="up")&&(k=E)}var v,w=document.querySelectorAll(".result");if(w=Array.from(w),typeof k!="string")v=k;else switch(k){case"visible":for(var q=document.documentElement.scrollTop||document.body.scrollTop,B=q+document.documentElement.clientHeight,x=0;x<w.length;x++){v=w[x];var I=v.offsetTop,M=I+v.clientHeight;if(M<=B&&I>q)break}break;case"down":v=w[w.indexOf(E)+1]||E;break;case"up":v=w[w.indexOf(E)-1]||E;break;case"bottom":v=w[w.length-1];break;case"top":default:v=w[0]}if(v){if(E.removeAttribute("data-vim-selected"),v.setAttribute("data-vim-selected","true"),!_){var C=v.querySelector("h3 a")||v.querySelector("a");C!==null&&C.focus()}u||b()}}}function n(){document.location.reload(!0)}function r(e){const u=e.target.tagName.toLowerCase();document.activeElement&&(u==="input"||u==="select"||u==="textarea")?document.activeElement.blur():searxng.closeDetail()}function t(e){return function(){var u=document.querySelector(e);u&&u.click()}}function a(){return t('nav#pagination .next_page button[type="submit"]')}function f(){return t('nav#pagination .previous_page button[type="submit"]')}function b(){var e=document.querySelector(".result[data-vim-selected]");if(e!==null){var u=document.documentElement.scrollTop||document.body.scrollTop,_=document.documentElement.clientHeight,E=e.offsetTop,k=E+e.clientHeight,v=120;if(e.previousElementSibling===null&&k<_){window.scroll(window.scrollX,0);return}if(u>E-v)window.scroll(window.scrollX,E-v);else{var w=u+_;w<k+v&&window.scroll(window.scrollX,k-_+v)}}}function c(e){return function(){window.scrollBy(0,e),l("visible")()}}function d(e,u){return function(){window.scrollTo(0,e),l(u)()}}function m(){window.scrollTo(0,0);var e=document.querySelector("#q");if(e.focus(),e.setSelectionRange){var u=e.value.length;e.setSelectionRange(u,u)}}function y(e){return function(){var u=document.querySelector(".result[data-vim-selected] h3 a");if(u===null&&(u=document.querySelector(".result[data-vim-selected] > a")),u!==null){var _=u.getAttribute("href");e?window.open(_):window.location.href=_}}}function S(e){var u={};for(var _ in o){var E=o[_];u[E.cat]=u[E.cat]||[],u[E.cat].push(E)}var k=Object.keys(u).sort(function(M,C){return u[C].length-u[M].length});if(k.length!==0){var v='<a href="#" class="close" aria-label="close" title="close">×</a>';v+="<h3>How to navigate SearXNG with hotkeys</h3>",v+="<table>";for(var w=0;w<k.length;w++){var q=u[k[w]],B=w===k.length-1,x=w%2===0;x&&(v+="<tr>"),v+="<td>",v+="<h4>"+q[0].cat+"</h4>",v+='<ul class="list-unstyled">';for(var I in q)v+="<li><kbd>"+q[I].key+"</kbd> "+q[I].des+"</li>";v+="</ul>",v+="</td>",(!x||B)&&(v+="</tr>")}v+="</table>",e.innerHTML=v}}function T(){var e=document.querySelector("#vim-hotkeys-help");if(e==null){e=document.createElement("div"),e.id="vim-hotkeys-help",e.className="dialog-modal",S(e);var u=document.getElementsByTagName("body")[0];u.appendChild(e)}else{e.classList.toggle("invisible");return}}function A(){var e=document.querySelector(".result[data-vim-selected] h3 a");if(e===null)return;const u=e.getAttribute("href");navigator.clipboard.writeText(u)}searxng.scrollPageToSelected=b,searxng.selectNext=l("down"),searxng.selectPrevious=l("up")});(function(h,s,i){i.ready(function(){i.on(".searxng_init_map","click",function(p){this.classList.remove("searxng_init_map");var g=this.dataset.leafletTarget,o=parseFloat(this.dataset.mapLon),l=parseFloat(this.dataset.mapLat),n=parseFloat(this.dataset.mapZoom),r=JSON.parse(this.dataset.mapBoundingbox),t=JSON.parse(this.dataset.mapGeojson);i.loadStyle("css/leaflet.css"),i.loadScript("js/leaflet.js",function(){var a=null;if(r){var f=L.latLng(r[0],r[2]),b=L.latLng(r[1],r[3]);a=L.latLngBounds(f,b)}var c=L.map(g),d="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",m='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',y=new L.TileLayer(d,{minZoom:1,maxZoom:19,attribution:m}),S="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",T='Wikimedia maps | Maps data © <a href="https://openstreetmap.org">OpenStreetMap contributors</a>',A=new L.TileLayer(S,{minZoom:1,maxZoom:19,attribution:T});a?setTimeout(function(){c.fitBounds(a,{maxZoom:17})},0):o&&l&&(n?c.setView(new L.latLng(l,o),n):c.setView(new L.latLng(l,o),8)),c.addLayer(y);var e={"OSM Mapnik":y,"OSM Wikimedia":A};L.control.layers(e).addTo(c),t&&L.geoJson(t).addTo(c)}),p.preventDefault()})})})(window,document,window.searxng);(function(h,s,i){i.endpoint==="preferences"&&i.ready(function(){let p=null;function g(){p==null&&i.http("GET","engine_descriptions.json").then(function(a){p=JSON.parse(a);for(const[f,b]of Object.entries(p)){let c=s.querySelectorAll('[data-engine-name="'+f+'"] .engine-description');for(const d of c){let m=" (<i>"+i.settings.translations.Source+": "+b[1]+"</i>)";d.innerHTML=b[0]+m}}})}for(const a of s.querySelectorAll("[data-engine-name]"))i.on(a,"mouseenter",g);const o=s.querySelectorAll(".enable-all-engines"),l=s.querySelectorAll(".disable-all-engines"),n=s.querySelectorAll("tbody input[type=checkbox][class~=checkbox-onoff]"),r=a=>{for(const f of n)f.offsetParent!==null&&(f.checked=!a)};for(const a of o)i.on(a,"click",()=>r(!0));for(const a of l)i.on(a,"click",()=>r(!1));const t=s.querySelector("#copy-hash");i.on(t,"click",a=>{a.preventDefault(),navigator.clipboard.writeText(t.dataset.hash),t.innerText=t.dataset.copiedText})})})(window,document,window.searxng);/*! * swiped-events.js - v@version@ * Pure JavaScript swipe events * https://github.com/john-doherty/swiped-events * @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element * @author John Doherty <www.johndoherty.info> * @license MIT - */(function(h,d){typeof h.CustomEvent!="function"&&(h.CustomEvent=function(s,g){g=g||{bubbles:!1,cancelable:!1,detail:void 0};var v=d.createEvent("CustomEvent");return v.initCustomEvent(s,g.bubbles,g.cancelable,g.detail),v},h.CustomEvent.prototype=h.Event.prototype),d.addEventListener("touchstart",t,!1),d.addEventListener("touchmove",o,!1),d.addEventListener("touchend",e,!1);var u=null,p=null,m=null,r=null,a=null,l=null,n=0;function e(s){if(l===s.target){var g=parseInt(c(l,"data-swipe-threshold","20"),10),v=c(l,"data-swipe-unit","px"),b=parseInt(c(l,"data-swipe-timeout","500"),10),k=Date.now()-a,_="",O=s.changedTouches||s.touches||[];if(v==="vh"&&(g=Math.round(g/100*d.documentElement.clientHeight)),v==="vw"&&(g=Math.round(g/100*d.documentElement.clientWidth)),Math.abs(m)>Math.abs(r)?Math.abs(m)>g&&k<b&&(m>0?_="swiped-left":_="swiped-right"):Math.abs(r)>g&&k<b&&(r>0?_="swiped-up":_="swiped-down"),_!==""){var i={dir:_.replace(/swiped-/,""),touchType:(O[0]||{}).touchType||"direct",fingers:n,xStart:parseInt(u,10),xEnd:parseInt((O[0]||{}).clientX||-1,10),yStart:parseInt(p,10),yEnd:parseInt((O[0]||{}).clientY||-1,10)};l.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:i})),l.dispatchEvent(new CustomEvent(_,{bubbles:!0,cancelable:!0,detail:i}))}u=null,p=null,a=null}}function t(s){s.target.getAttribute("data-swipe-ignore")!=="true"&&(l=s.target,a=Date.now(),u=s.touches[0].clientX,p=s.touches[0].clientY,m=0,r=0,n=s.touches.length)}function o(s){if(!(!u||!p)){var g=s.touches[0].clientX,v=s.touches[0].clientY;m=u-g,r=p-v}}function c(s,g,v){for(;s&&s!==d.documentElement;){var b=s.getAttribute(g);if(b)return b;s=s.parentNode}return v}})(window,document);(function(h,d,u){u.endpoint==="results"&&u.ready(function(){d.querySelectorAll("#urls img").forEach(l=>l.addEventListener("error",()=>{l.src=window.searxng.settings.theme_static_path+"/img/img_load_error.svg"},{once:!0})),d.querySelector("#search_url button#copy_url")&&(d.querySelector("#search_url button#copy_url").style.display="block"),u.on(".btn-collapse","click",function(){var l=this.getAttribute("data-btn-text-collapsed"),n=this.getAttribute("data-btn-text-not-collapsed"),e=this.getAttribute("data-target"),t=d.querySelector(e),o=this.innerHTML;this.classList.contains("collapsed")?o=o.replace(l,n):o=o.replace(n,l),this.innerHTML=o,this.classList.toggle("collapsed"),t.classList.toggle("invisible")}),u.on(".media-loader","click",function(){var l=this.getAttribute("data-target"),n=d.querySelector(l+" > iframe"),e=n.getAttribute("src");(e==null||e===!1)&&n.setAttribute("src",n.getAttribute("data-src"))}),u.on("#copy_url","click",function(){var l=this.parentElement.querySelector("pre");navigator.clipboard.writeText(l.innerText),this.innerText=this.dataset.copiedText});let p;const m=d.createElement("div");m.classList.add("loader");const r=new Image,a=(l,n)=>{p&&clearTimeout(p),p=setTimeout(()=>{r.src=l},1e3),r.onload=()=>{n(),m.remove()},r.onerror=()=>{m.remove()}};u.selectImage=l=>{if(d.getElementById("results").classList.add("image-detail-open"),window.location.hash="#image-viewer",u.scrollPageToSelected(),!l)return;const n=l.querySelector(".result-images-source img");if(!n)return;const e=n.getAttribute("data-src");if(!e)return;const t=l.querySelector(".image_thumbnail");n.src=t.src,l.querySelector(".detail").appendChild(m),a(e,()=>{n.src=e,n.removeAttribute("data-src")})},u.closeDetail=function(){d.getElementById("results").classList.remove("image-detail-open"),window.location.hash=="#image-viewer"&&window.history.back(),u.scrollPageToSelected()},u.on(".result-detail-close","click",l=>{l.preventDefault(),u.closeDetail()}),u.on(".result-detail-previous","click",l=>{l.preventDefault(),u.selectPrevious(!1)}),u.on(".result-detail-next","click",l=>{l.preventDefault(),u.selectNext(!1)}),window.addEventListener("hashchange",()=>{window.location.hash!="#image-viewer"&&u.closeDetail()}),d.querySelectorAll(".swipe-horizontal").forEach(l=>{l.addEventListener("swiped-left",function(){u.selectNext(!1)}),l.addEventListener("swiped-right",function(){u.selectPrevious(!1)})}),h.addEventListener("scroll",function(){var l=d.getElementById("backToTop"),n=document.documentElement.scrollTop||document.body.scrollTop,e=d.getElementById("results");l!==null&&(n>=100?e.classList.add("scrolling"):e.classList.remove("scrolling"))},!0)})})(window,document,window.searxng);function P(h){return h&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default")?h.default:h}function C(h){throw new Error('Could not dynamically require "'+h+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var q={exports:{}},H;function B(){return H||(H=1,function(h,d){(function(u){h.exports=u()})(function(){return function(){function u(p,m,r){function a(e,t){if(!m[e]){if(!p[e]){var o=typeof C=="function"&&C;if(!t&&o)return o(e,!0);if(l)return l(e,!0);var c=new Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}var s=m[e]={exports:{}};p[e][0].call(s.exports,function(g){var v=p[e][1][g];return a(v||g)},s,s.exports,u,p,m,r)}return m[e].exports}for(var l=typeof C=="function"&&C,n=0;n<r.length;n++)a(r[n]);return a}return u}()({1:[function(u,p,m){var r;(function(n){n[n.AND=0]="AND",n[n.OR=1]="OR"})(r||(r={}));var a;(function(n){n[n.KEYDOWN=0]="KEYDOWN",n[n.KEYUP=1]="KEYUP"})(a||(a={}));var l=function(){function n(e,t){if(e===void 0&&(e={}),t===void 0&&(t="[data-autocomplete]"),Array.isArray(t))t.forEach(function(s){new n(e,s)});else if(typeof t=="string"){var o=document.querySelectorAll(t);Array.prototype.forEach.call(o,function(s){new n(e,s)})}else{var c=n.merge(n.defaults,e,{DOMResults:document.createElement("div")});return n.prototype.create(c,t),c}}return n.prototype.create=function(e,t){if(e.Input=t,e.Input.nodeName.match(/^INPUT$/i)&&(e.Input.hasAttribute("type")===!1||e.Input.getAttribute("type").match(/^TEXT|SEARCH$/i))){e.Input.setAttribute("autocomplete","off"),e._Position(e),e.Input.parentNode.appendChild(e.DOMResults),e.$Listeners={blur:e._Blur.bind(e),destroy:n.prototype.destroy.bind(null,e),focus:e._Focus.bind(e),keyup:n.prototype.event.bind(null,e,a.KEYUP),keydown:n.prototype.event.bind(null,e,a.KEYDOWN),position:e._Position.bind(e)};for(var o in e.$Listeners)e.Input.addEventListener(o,e.$Listeners[o])}},n.prototype.getEventsByType=function(e,t){var o={};for(var c in e.KeyboardMappings){var s=a.KEYUP;e.KeyboardMappings[c].Event!==void 0&&(s=e.KeyboardMappings[c].Event),s==t&&(o[c]=e.KeyboardMappings[c])}return o},n.prototype.event=function(e,t,o){var c=function(b){(v===!0&&g.Operator==r.AND||v===!1&&g.Operator==r.OR)&&(b=n.merge({Not:!1},b),b.hasOwnProperty("Is")?b.Is==o.keyCode?v=!b.Not:v=b.Not:b.hasOwnProperty("From")&&b.hasOwnProperty("To")&&(o.keyCode>=b.From&&o.keyCode<=b.To?v=!b.Not:v=b.Not))};for(var s in n.prototype.getEventsByType(e,t)){var g=n.merge({Operator:r.AND},e.KeyboardMappings[s]),v=r.AND==g.Operator;g.Conditions.forEach(c),v===!0&&g.Callback.call(e,o)}},n.prototype.makeRequest=function(e,t,o){var c=Object.getOwnPropertyNames(e.HttpHeaders),s=new XMLHttpRequest,g=e._HttpMethod(),v=e._Url(),b=e._Pre(),k=encodeURIComponent(e._QueryArg())+"="+encodeURIComponent(b);g.match(/^GET$/i)&&(v.indexOf("?")!==-1?v+="&"+k:v+="?"+k),s.open(g,v,!0);for(var _=c.length-1;_>=0;_--)s.setRequestHeader(c[_],e.HttpHeaders[c[_]]);return s.onreadystatechange=function(){s.readyState==4&&s.status==200?(e.$Cache[b]=s.response,t(s.response)):s.status>=400&&o()},s},n.prototype.ajax=function(e,t,o){o===void 0&&(o=!0),e.$AjaxTimer&&window.clearTimeout(e.$AjaxTimer),o===!0?e.$AjaxTimer=window.setTimeout(n.prototype.ajax.bind(null,e,t,!1),e.Delay):(e.Request&&e.Request.abort(),e.Request=t,e.Request.send(e._QueryArg()+"="+e._Pre()))},n.prototype.cache=function(e,t,o){var c=e._Cache(e._Pre());if(c===void 0){var s=n.prototype.makeRequest(e,t,o);n.prototype.ajax(e,s)}else t(c)},n.prototype.destroy=function(e){for(var t in e.$Listeners)e.Input.removeEventListener(t,e.$Listeners[t]);e.DOMResults.parentNode.removeChild(e.DOMResults)},n.merge=function(){for(var e={},t,o=0;o<arguments.length;o++)for(t in arguments[o])e[t]=arguments[o][t];return e},n.defaults={Delay:150,EmptyMessage:"No result here",Highlight:{getRegex:function(e){return new RegExp(e,"ig")},transform:function(e){return"<strong>"+e+"</strong>"}},HttpHeaders:{"Content-type":"application/x-www-form-urlencoded"},Limit:0,MinChars:0,HttpMethod:"GET",QueryArg:"q",Url:null,KeyboardMappings:{Enter:{Conditions:[{Is:13,Not:!1}],Callback:function(e){if(this.DOMResults.getAttribute("class").indexOf("open")!=-1){var t=this.DOMResults.querySelector("li.active");t!==null&&(e.preventDefault(),this._Select(t),this.DOMResults.setAttribute("class","autocomplete"))}},Operator:r.AND,Event:a.KEYDOWN},KeyUpAndDown_down:{Conditions:[{Is:38,Not:!1},{Is:40,Not:!1}],Callback:function(e){e.preventDefault()},Operator:r.OR,Event:a.KEYDOWN},KeyUpAndDown_up:{Conditions:[{Is:38,Not:!1},{Is:40,Not:!1}],Callback:function(e){e.preventDefault();var t=this.DOMResults.querySelector("li:first-child:not(.locked)"),o=this.DOMResults.querySelector("li:last-child:not(.locked)"),c=this.DOMResults.querySelector("li.active");if(c){var s=Array.prototype.indexOf.call(c.parentNode.children,c),g=s+(e.keyCode-39),v=this.DOMResults.getElementsByTagName("li").length;g<0?g=v-1:g>=v&&(g=0),c.classList.remove("active"),c.parentElement.children.item(g).classList.add("active")}else o&&e.keyCode==38?o.classList.add("active"):t&&t.classList.add("active")},Operator:r.OR,Event:a.KEYUP},AlphaNum:{Conditions:[{Is:13,Not:!0},{From:35,To:40,Not:!0}],Callback:function(){var e=this.Input.getAttribute("data-autocomplete-old-value"),t=this._Pre();t!==""&&t.length>=this._MinChars()?((!e||t!=e)&&this.DOMResults.setAttribute("class","autocomplete open"),n.prototype.cache(this,(function(o){this._Render(this._Post(o)),this._Open()}).bind(this),this._Error)):this._Close()},Operator:r.AND,Event:a.KEYUP}},DOMResults:null,Request:null,Input:null,_EmptyMessage:function(){var e="";return this.Input.hasAttribute("data-autocomplete-empty-message")?e=this.Input.getAttribute("data-autocomplete-empty-message"):this.EmptyMessage!==!1?e=this.EmptyMessage:e="",e},_Limit:function(){var e=this.Input.getAttribute("data-autocomplete-limit");return isNaN(e)||e===null?this.Limit:parseInt(e,10)},_MinChars:function(){var e=this.Input.getAttribute("data-autocomplete-minchars");return isNaN(e)||e===null?this.MinChars:parseInt(e,10)},_Highlight:function(e){return e.replace(this.Highlight.getRegex(this._Pre()),this.Highlight.transform)},_HttpMethod:function(){return this.Input.hasAttribute("data-autocomplete-method")?this.Input.getAttribute("data-autocomplete-method"):this.HttpMethod},_QueryArg:function(){return this.Input.hasAttribute("data-autocomplete-param-name")?this.Input.getAttribute("data-autocomplete-param-name"):this.QueryArg},_Url:function(){return this.Input.hasAttribute("data-autocomplete")?this.Input.getAttribute("data-autocomplete"):this.Url},_Blur:function(e){if(e===void 0&&(e=!1),e)this._Close();else{var t=this;setTimeout(function(){t._Blur(!0)},150)}},_Cache:function(e){return this.$Cache[e]},_Focus:function(){var e=this.Input.getAttribute("data-autocomplete-old-value");(!e||this.Input.value!=e)&&this._MinChars()<=this.Input.value.length&&this.DOMResults.setAttribute("class","autocomplete open")},_Open:function(){var e=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(t){t.getAttribute("class")!="locked"&&(t.onclick=function(){e._Select(t)})})},_Close:function(){this.DOMResults.setAttribute("class","autocomplete")},_Position:function(){this.DOMResults.setAttribute("class","autocomplete"),this.DOMResults.setAttribute("style","top:"+(this.Input.offsetTop+this.Input.offsetHeight)+"px;left:"+this.Input.offsetLeft+"px;width:"+this.Input.clientWidth+"px;")},_Render:function(e){var t;typeof e=="string"?t=this._RenderRaw(e):t=this._RenderResponseItems(e),this.DOMResults.hasChildNodes()&&this.DOMResults.removeChild(this.DOMResults.childNodes[0]),this.DOMResults.appendChild(t)},_RenderResponseItems:function(e){var t=document.createElement("ul"),o=document.createElement("li"),c=this._Limit();c<0?e=e.reverse():c===0&&(c=e.length);for(var s=0;s<Math.min(Math.abs(c),e.length);s++)o.innerHTML=e[s].Label,o.setAttribute("data-autocomplete-value",e[s].Value),t.appendChild(o),o=document.createElement("li");return t},_RenderRaw:function(e){var t=document.createElement("ul"),o=document.createElement("li");if(e.length>0)this.DOMResults.innerHTML=e;else{var c=this._EmptyMessage();c!==""&&(o.innerHTML=c,o.setAttribute("class","locked"),t.appendChild(o))}return t},_Post:function(e){try{var t=[],o=JSON.parse(e);if(Object.keys(o).length===0)return"";if(Array.isArray(o))for(var c=0;c<Object.keys(o).length;c++)t[t.length]={Value:o[c],Label:this._Highlight(o[c])};else for(var s in o)t.push({Value:s,Label:this._Highlight(o[s])});return t}catch{return e}},_Pre:function(){return this.Input.value},_Select:function(e){e.hasAttribute("data-autocomplete-value")?this.Input.value=e.getAttribute("data-autocomplete-value"):this.Input.value=e.innerHTML,this.Input.setAttribute("data-autocomplete-old-value",this.Input.value)},_Error:function(){},$AjaxTimer:null,$Cache:{},$Listeners:{}},n}();p.exports=l},{}]},{},[1])(1)})}(q)),q.exports}var K=B();const S=P(K);(function(h,d,u){var p="q",m;const r=window.matchMedia("only screen and (max-width: 50em)").matches;function a(){if(m.value.length>0){var n=document.getElementById("search");setTimeout(n.submit.bind(n),0)}}function l(n){var e=document.getElementById("clear_search"),t=function(){n.value.length===0?e.classList.add("empty"):e.classList.remove("empty")};t(),e.addEventListener("click",function(o){n.value="",n.focus(),t(),o.preventDefault()}),n.addEventListener("input",t,!1)}u.ready(function(){m=d.getElementById(p),m!==null&&(l(m),u.settings.autocomplete&&(u.autocomplete=S.call(h,{Url:"./autocompleter",EmptyMessage:u.settings.translations.no_item_found,HttpMethod:u.settings.method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:u.settings.autocomplete_min,Delay:300,_Position:function(){},_Open:function(){var t=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(o){o.getAttribute("class")!="locked"&&(o.onmousedown=function(){t._Select(o)})})},_Select:function(t){S.defaults._Select.call(this,t);var o=t.closest("form");o&&o.submit()},_MinChars:function(){return this.Input.value.indexOf("!")>-1?0:S.defaults._MinChars.call(this)},KeyboardMappings:Object.assign({},S.defaults.KeyboardMappings,{KeyUpAndDown_up:Object.assign({},S.defaults.KeyboardMappings.KeyUpAndDown_up,{Callback:function(t){S.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this,t);var o=this.DOMResults.querySelector("li.active");o&&S.defaults._Select.call(this,o)}}),Tab:Object.assign({},S.defaults.KeyboardMappings.Enter,{Conditions:[{Is:9,Not:!1}],Callback:function(t){if(this.DOMResults.getAttribute("class").indexOf("open")!=-1){var o=this.DOMResults.querySelector("li.active");o!==null&&(S.defaults._Select.call(this,o),t.preventDefault())}}})})},"#"+p)),S.prototype.ajax=function(t,o,c){c===void 0&&(c=!0),t.$AjaxTimer&&window.clearTimeout(t.$AjaxTimer),c===!0?t.$AjaxTimer=window.setTimeout(S.prototype.ajax.bind(null,t,o,!1),t.Delay):(t.Request&&t.Request.abort(),t.Request=o,t.Request.send(encodeURIComponent(t._QueryArg())+"="+encodeURIComponent(t._Pre())))},!r&&document.querySelector(".index_endpoint")&&m.focus()),m!==null&&u.settings.search_on_category_select&&d.querySelector(".search_filters")!=null&&(u.on(d.getElementById("safesearch"),"change",a),u.on(d.getElementById("time_range"),"change",a),u.on(d.getElementById("language"),"change",a));const n=d.querySelectorAll("button.category_button");for(let t of n)u.on(t,"click",o=>{if(o.shiftKey){o.preventDefault(),t.classList.toggle("selected");return}const c=d.querySelectorAll("button.category_button.selected");for(let s of c)s.classList.remove("selected");t.classList.add("selected")});const e=d.querySelector("#search");e!=null&&u.on(e,"submit",t=>{t.preventDefault();const o=d.querySelector("#selected-categories");if(o){let c=[];for(let s of n)s.classList.contains("selected")&&c.push(s.name.replace("category_",""));o.value=c.join(",")}e.submit()})})})(window,document,window.searxng); + */(function(h,s){typeof h.CustomEvent!="function"&&(h.CustomEvent=function(c,d){d=d||{bubbles:!1,cancelable:!1,detail:void 0};var m=s.createEvent("CustomEvent");return m.initCustomEvent(c,d.bubbles,d.cancelable,d.detail),m},h.CustomEvent.prototype=h.Event.prototype),s.addEventListener("touchstart",a,!1),s.addEventListener("touchmove",f,!1),s.addEventListener("touchend",t,!1);var i=null,p=null,g=null,o=null,l=null,n=null,r=0;function t(c){if(n===c.target){var d=parseInt(b(n,"data-swipe-threshold","20"),10),m=b(n,"data-swipe-unit","px"),y=parseInt(b(n,"data-swipe-timeout","500"),10),S=Date.now()-l,T="",A=c.changedTouches||c.touches||[];if(m==="vh"&&(d=Math.round(d/100*s.documentElement.clientHeight)),m==="vw"&&(d=Math.round(d/100*s.documentElement.clientWidth)),Math.abs(g)>Math.abs(o)?Math.abs(g)>d&&S<y&&(g>0?T="swiped-left":T="swiped-right"):Math.abs(o)>d&&S<y&&(o>0?T="swiped-up":T="swiped-down"),T!==""){var e={dir:T.replace(/swiped-/,""),touchType:(A[0]||{}).touchType||"direct",fingers:r,xStart:parseInt(i,10),xEnd:parseInt((A[0]||{}).clientX||-1,10),yStart:parseInt(p,10),yEnd:parseInt((A[0]||{}).clientY||-1,10)};n.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:e})),n.dispatchEvent(new CustomEvent(T,{bubbles:!0,cancelable:!0,detail:e}))}i=null,p=null,l=null}}function a(c){c.target.getAttribute("data-swipe-ignore")!=="true"&&(n=c.target,l=Date.now(),i=c.touches[0].clientX,p=c.touches[0].clientY,g=0,o=0,r=c.touches.length)}function f(c){if(!(!i||!p)){var d=c.touches[0].clientX,m=c.touches[0].clientY;g=i-d,o=p-m}}function b(c,d,m){for(;c&&c!==s.documentElement;){var y=c.getAttribute(d);if(y)return y;c=c.parentNode}return m}})(window,document);(function(h,s,i){i.endpoint==="results"&&i.ready(function(){s.querySelectorAll("#urls img").forEach(n=>n.addEventListener("error",()=>{n.src=window.searxng.settings.theme_static_path+"/img/img_load_error.svg"},{once:!0})),s.querySelector("#search_url button#copy_url")&&(s.querySelector("#search_url button#copy_url").style.display="block"),i.on(".btn-collapse","click",function(){var n=this.getAttribute("data-btn-text-collapsed"),r=this.getAttribute("data-btn-text-not-collapsed"),t=this.getAttribute("data-target"),a=s.querySelector(t),f=this.innerHTML;this.classList.contains("collapsed")?f=f.replace(n,r):f=f.replace(r,n),this.innerHTML=f,this.classList.toggle("collapsed"),a.classList.toggle("invisible")}),i.on(".media-loader","click",function(){var n=this.getAttribute("data-target"),r=s.querySelector(n+" > iframe"),t=r.getAttribute("src");(t==null||t===!1)&&r.setAttribute("src",r.getAttribute("data-src"))}),i.on("#copy_url","click",function(){var n=this.parentElement.querySelector("pre");navigator.clipboard.writeText(n.innerText),this.innerText=this.dataset.copiedText});let p;const g=s.createElement("div");g.classList.add("loader");const o=new Image,l=(n,r)=>{p&&clearTimeout(p),p=setTimeout(()=>{o.src=n},1e3),o.onload=()=>{r(),g.remove()},o.onerror=()=>{g.remove()}};i.selectImage=n=>{if(s.getElementById("results").classList.add("image-detail-open"),window.location.hash="#image-viewer",i.scrollPageToSelected(),!n)return;const r=n.querySelector(".result-images-source img");if(!r)return;const t=r.getAttribute("data-src");if(!t)return;const a=n.querySelector(".image_thumbnail");r.src=a.src,n.querySelector(".detail").appendChild(g),l(t,()=>{r.src=t,r.removeAttribute("data-src")})},i.closeDetail=function(){s.getElementById("results").classList.remove("image-detail-open"),window.location.hash=="#image-viewer"&&window.history.back(),i.scrollPageToSelected()},i.on(".result-detail-close","click",n=>{n.preventDefault(),i.closeDetail()}),i.on(".result-detail-previous","click",n=>{n.preventDefault(),i.selectPrevious(!1)}),i.on(".result-detail-next","click",n=>{n.preventDefault(),i.selectNext(!1)}),window.addEventListener("hashchange",()=>{window.location.hash!="#image-viewer"&&i.closeDetail()}),s.querySelectorAll(".swipe-horizontal").forEach(n=>{n.addEventListener("swiped-left",function(){i.selectNext(!1)}),n.addEventListener("swiped-right",function(){i.selectPrevious(!1)})}),h.addEventListener("scroll",function(){var n=s.getElementById("backToTop"),r=document.documentElement.scrollTop||document.body.scrollTop,t=s.getElementById("results");n!==null&&(r>=100?t.classList.add("scrolling"):t.classList.remove("scrolling"))},!0)})})(window,document,window.searxng);(function(h,s,i){var p="q",g;const o=window.matchMedia("only screen and (max-width: 50em)").matches;function l(){if(g.value.length>0){var t=document.getElementById("search");setTimeout(t.submit.bind(t),0)}}function n(t){var a=document.getElementById("clear_search"),f=function(){t.value.length===0?a.classList.add("empty"):a.classList.remove("empty")};f(),a.addEventListener("click",function(b){t.value="",t.focus(),f(),b.preventDefault()}),t.addEventListener("input",f,!1)}const r=async t=>{let a;if(i.settings.method==="GET"){const f=new URLSearchParams;f.append("q",t),a=fetch("./autocompleter?"+f.toString())}else{const f=new FormData;f.append("q",t),a=fetch("./autocompleter",{method:"POST",body:f})}a.then(async function(f){const b=await f.json();if(!b)return;const c=s.querySelector(".autocomplete"),d=s.querySelector(".autocomplete ul");if(c.classList.add("open"),d.innerHTML="",!b[1]||b[1].length==0){const m=document.createElement("li");m.classList.add("no-item-found"),m.innerHTML=i.settings.translations.no_item_found,d.appendChild(m);return}for(let m of b[1]){const y=document.createElement("li");y.innerText=m,i.on(y,"mousedown",()=>{g.value=m,s.querySelector("#search").submit(),c.classList.remove("open")}),d.appendChild(y)}})};i.ready(function(){o||document.getElementById("q").focus(),g=s.getElementById(p);const t=s.querySelector(".autocomplete"),a=s.querySelector(".autocomplete ul");g!==null&&(n(g),i.settings.autocomplete&&(i.on(g,"input",()=>{const c=g.value;c.length<i.settings.autocomplete_min||setTimeout(()=>{c==g.value&&r(c)},300)}),i.on(g,"keyup",c=>{let d=-1;const m=a.children;for(let S=0;S<m.length;S++)if(m[S].classList.contains("active")){d=S;break}let y=-1;if(c.key==="ArrowUp"?(d>=0&&m[d].classList.remove("active"),y=(d-1+m.length)%m.length):c.key==="ArrowDown"?(d>=0&&m[d].classList.remove("active"),y=(d+1)%m.length):(c.key==="Tab"||c.key==="Enter")&&t.classList.remove("open"),y!=-1){const S=m[y];S.classList.add("active"),S.classList.contains("no-item-found")||(g.value=S.innerText)}}))),g!==null&&i.settings.search_on_category_select&&s.querySelector(".search_filters")!=null&&(i.on(s.getElementById("safesearch"),"change",l),i.on(s.getElementById("time_range"),"change",l),i.on(s.getElementById("language"),"change",l));const f=s.querySelectorAll("button.category_button");for(let c of f)i.on(c,"click",d=>{if(d.shiftKey){d.preventDefault(),c.classList.toggle("selected");return}const m=s.querySelectorAll("button.category_button.selected");for(let y of m)y.classList.remove("selected");c.classList.add("selected")});const b=s.querySelector("#search");b!=null&&i.on(b,"submit",c=>{c.preventDefault();const d=s.querySelector("#selected-categories");if(d){let m=[];for(let y of f)y.classList.contains("selected")&&m.push(y.name.replace("category_",""));d.value=m.join(",")}b.submit()})})})(window,document,window.searxng); //# sourceMappingURL=searxng.min.js.map |