/** * @license * (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(t,s){"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),i=-1;while(n[++i]&&n[i]!=t);return!!n[i]}})(Element.prototype)}function a(e,t,n){try{e.call(t,n)}catch(e){console.log(e)}}var o=window.searxng||{};o.on=function(i,e,r,t){t=t||false;if(typeof i!=="string"){i.addEventListener(e,r,t)}else{s.addEventListener(e,function(e){var t=e.target||e.srcElement,n=false;while(t&&t.matches&&t!==s&&!(n=t.matches(i)))t=t.parentElement;if(n)a(r,t,e)},t)}};o.ready=function(e){if(document.readyState!="loading"){e.call(t)}else{t.addEventListener("DOMContentLoaded",e.bind(t))}};o.http=function(e,t){var n=new XMLHttpRequest,i=function(){},r=function(){},s={then:function(e){i=e;return s},catch:function(e){r=e;return s}};try{n.open(e,t,true);n.onload=function(){if(n.status==200){i(n.response,n.responseType)}else{r(Error(n.statusText))}};n.onerror=function(){r(Error("Network Error"))};n.onabort=function(){r(Error("Transaction is aborted"))};n.send()}catch(e){r(e)}return s};o.loadStyle=function(e){var t=o.static_path+e,n="style_"+e.replace(".","_"),i=s.getElementById(n);if(i===null){i=s.createElement("link");i.setAttribute("id",n);i.setAttribute("rel","stylesheet");i.setAttribute("type","text/css");i.setAttribute("href",t);s.body.appendChild(i)}};o.loadScript=function(e,t){var n=o.static_path+e,i="script_"+e.replace(".","_"),r=s.getElementById(i);if(r===null){r=s.createElement("script");r.setAttribute("id",i);r.setAttribute("src",n);r.onload=t;r.onerror=function(){r.setAttribute("error","1")};s.body.appendChild(r)}else if(!r.hasAttribute("error")){try{t.apply(r,[])}catch(e){console.log(e)}}else{console.log("callback not executed : script '"+n+"' not loaded.")}};o.insertBefore=function(e,t){t.parentNode.insertBefore(e,t)};o.insertAfter=function(e,t){t.parentNode.insertAfter(e,t.nextSibling)};o.on(".close","click",function(){this.parentNode.classList.add("invisible")});return o}(window,document);(function(e,t,n){"use strict";n.ready(function(){n.on(".searxng_init_map","click",function(e){this.classList.remove("searxng_init_map");var p=this.dataset.leafletTarget;var d=parseFloat(this.dataset.mapLon);var f=parseFloat(this.dataset.mapLat);var h=parseFloat(this.dataset.mapZoom);var m=JSON.parse(this.dataset.mapBoundingbox);var g=JSON.parse(this.dataset.mapGeojson);n.loadStyle("css/leaflet.css");n.loadScript("js/leaflet.js",function(){var e=null;if(m){var t=L.latLng(m[0],m[2]);var n=L.latLng(m[1],m[3]);e=L.latLngBounds(t,n)}var i=L.map(p);var r="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";var s='Map data © OpenStreetMap contributors';var a=new L.TileLayer(r,{minZoom:1,maxZoom:19,attribution:s});var o="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png";var l='Wikimedia maps | Maps data © OpenStreetMap contributors';var u=new L.TileLayer(o,{minZoom:1,maxZoom:19,attribution:l});if(e){setTimeout(function(){i.fitBounds(e,{maxZoom:17})},0)}else if(d&&f){if(h){i.setView(new L.latLng(f,d),h)}else{i.setView(new L.latLng(f,d),8)}}i.addLayer(a);var c={"OSM Mapnik":a,"OSM Wikimedia":u};L.control.layers(c).addTo(i);if(g){L.geoJson(g).addTo(i)}});e.preventDefault()})})})(window,document,window.searxng);(function(e,s,a){"use strict";a.ready(function(){let r=null;function e(){if(r==null){a.http("GET","engine_descriptions.json").then(function(e){r=JSON.parse(e);for(const[t,n]of Object.entries(r)){let e=s.querySelectorAll('[data-engine-name="'+t+'"] .engine-description');for(const i of e){let e=" ("+a.translations["Source"]+": "+n[1]+")";i.innerHTML=n[0]+e}}})}}if(s.querySelector('body[class="preferences_endpoint"]')){for(const t of s.querySelectorAll("[data-engine-name]")){a.on(t,"mouseenter",e)}}})})(window,document,window.searxng);(function(e,o,l){"use strict";l.ready(function(){l.image_thumbnail_layout=new l.ImageLayout("#urls","#urls .result-images","img.image_thumbnail",14,6,200);l.image_thumbnail_layout.watch();o.querySelectorAll("#urls img.image").forEach(e=>e.addEventListener("error",()=>{e.style.display="none";e.error=null}));l.on(".btn-collapse","click",function(){var e=this.getAttribute("data-btn-text-collapsed");var t=this.getAttribute("data-btn-text-not-collapsed");var n=this.getAttribute("data-target");var i=o.querySelector(n);var r=this.innerHTML;if(this.classList.contains("collapsed")){r=r.replace(e,t)}else{r=r.replace(t,e)}this.innerHTML=r;this.classList.toggle("collapsed");i.classList.toggle("invisible")});l.on(".media-loader","click",function(){var e=this.getAttribute("data-target");var t=o.querySelector(e+" > iframe");var n=t.getAttribute("src");if(n===null||n===undefined||n===false){t.setAttribute("src",t.getAttribute("data-src"))}});l.selectImage=function(e){if(e){const t=e.querySelector(".result-images-source img");const n=e.querySelector(".image_thumbnail");const i=e.querySelector(".detail");if(t){const r=t.getAttribute("data-src");if(r){const s=o.createElement("div");const a=new Image;s.classList.add("loader");i.appendChild(s);a.onload=e=>{t.src=r;s.remove()};a.onerror=e=>{s.remove()};a.src=r;t.src=n.src;t.removeAttribute("data-src")}}}o.getElementById("results").classList.add("image-detail-open");l.image_thumbnail_layout.align();l.scrollPageToSelected()};l.closeDetail=function(e){o.getElementById("results").classList.remove("image-detail-open");l.image_thumbnail_layout.align();l.scrollPageToSelected()};l.on(".result-detail-close","click",e=>{e.preventDefault();l.closeDetail()});l.on(".result-detail-previous","click",e=>l.selectPrevious(false));l.on(".result-detail-next","click",e=>l.selectNext(false));e.addEventListener("scroll",function(){var e=o.getElementById("backToTop"),t=document.documentElement.scrollTop||document.body.scrollTop,n=o.getElementById("results");if(e!==null){if(t>=100){n.classList.add("scrolling")}else{n.classList.remove("scrolling")}}},true)})})(window,document,window.searxng);(function(t,n,i){"use strict";var r=true,s="q",a;function o(e){if(e.setSelectionRange){var t=e.value.length;e.setSelectionRange(t,t)}}function l(e){var t=document.getElementById("clear_search");var n=function(){if(e.value.length===0){t.classList.add("empty")}else{t.classList.remove("empty")}};n();t.addEventListener("click",function(){e.value="";e.focus();n()});e.addEventListener("keyup",n,false)}i.ready(function(){a=n.getElementById(s);function e(){if(r){o(a);r=false}else{}}if(a!==null){l(a);if(i.autocompleter){i.autocomplete=AutoComplete.call(t,{Url:"./autocompleter",EmptyMessage:i.translations.no_item_found,HttpMethod:i.method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:4,Delay:300,_Position:function(){this.DOMResults.setAttribute("class","autocomplete");this.DOMResults.style.top=this.Input.offsetTop+this.Input.offsetHeight+"px";this.DOMResults.style.left=this.Input.offsetLeft+"px";this.DOMResults.style.width=this.Input.clientWidth+"px"},_Open:function(){var t=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(e){if(e.getAttribute("class")!="locked"){e.onmousedown=function(){t._Select(e)}}})}},"#"+s);t.addEventListener("resize",function(){var e=new CustomEvent("position");a.dispatchEvent(e)})}a.addEventListener("focus",e,false);a.focus()}})})(window,document,window.searxng); /** * * Google Image Layout v0.0.1 * Description, by Anh Trinh. * Heavily modified for searx * https://ptgamr.github.io/2014-09-12-google-image-layout/ * https://ptgamr.github.io/google-image-layout/src/google-image-layout.js * * @license Free to use under the MIT License. * * @example