mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
4 lines
22 KiB
JavaScript
4 lines
22 KiB
JavaScript
/*! simple/searx.min.js | 06-08-2017 | https://github.com/asciimoo/searx */
|
|
|
|
!function(t,e,n){"use strict";function o(t,e,n){try{t.call(e,n)}catch(t){console.log(t)}}t.Element&&function(t){t.matches=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.msMatchesSelector||function(t){for(var e=this,n=(e.parentNode||e.document).querySelectorAll(t),o=-1;n[++o]&&n[o]!=e;);return!!n[o]}}(Element.prototype),n=n||{},n.on=function(t,n,a,i){i=i||!1,"string"!=typeof t?t.addEventListener(n,a,i):e.addEventListener(n,function(n){for(var i=n.target||n.srcElement,r=!1;i&&i.matches&&i!==e&&!(r=i.matches(t));)i=i.parentElement;r&&o(a,i,n)},i)},n.ready=function(e){"loading"!=document.readyState?e.call(t):t.addEventListener("DOMContentLoaded",e.bind(t))},n.http=function(t,e,n){var o=new XMLHttpRequest,a=function(){},i=function(){},r={then:function(t){return a=t,r},catch:function(t){return i=t,r}};try{o.open(t,e,!0),o.onload=function(){200==o.status?a(o.response,o.responseType):i(Error(o.statusText))},o.onerror=function(){i(Error("Network Error"))},o.onabort=function(){i(Error("Transaction is aborted"))},o.send()}catch(t){i(t)}return r},n.loadStyle=function(t){var o=n.staticPath+t,a="style_"+t.replace(".","_"),i=e.getElementById(a);null===i&&((i=e.createElement("link")).setAttribute("id",a),i.setAttribute("rel","stylesheet"),i.setAttribute("type","text/css"),i.setAttribute("href",o),e.body.appendChild(i))},n.loadScript=function(t,o){var a=n.staticPath+t,i="script_"+t.replace(".","_"),r=e.getElementById(i);if(null===r)(r=e.createElement("script")).setAttribute("id",i),r.setAttribute("src",a),r.onload=o,r.onerror=function(){r.setAttribute("error","1")},e.body.appendChild(r);else if(r.hasAttribute("error"))console.log("callback not executed : script '"+a+"' not loaded.");else try{o.apply(r,[])}catch(t){console.log(t)}},n.on(".close","click",function(t){t.target||t.srcElement;this.parentNode.style.display="None"})}(window,document,window.searx),function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).AutoComplete=t()}}(function(){return function t(e,n,o){function a(r,s){if(!n[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(i)return i(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[r]={exports:{}};e[r][0].call(c.exports,function(t){var n=e[r][1][t];return a(n||t)},c,c.exports,t,e,n,o)}return n[r].exports}for(var i="function"==typeof require&&require,r=0;r<o.length;r++)a(o[r]);return a}({1:[function(t,e,n){"use strict";var o;!function(t){t[t.AND=0]="AND",t[t.OR=1]="OR"}(o||(o={}));var a;!function(t){t[t.KEYDOWN=0]="KEYDOWN",t[t.KEYUP=1]="KEYUP"}(a||(a={}));var i=function(){function t(e,n){if(void 0===e&&(e={}),void 0===n&&(n="[data-autocomplete]"),Array.isArray(n))n.forEach(function(n){new t(e,n)});else{if("string"!=typeof n){var o=t.merge(t.defaults,e,{DOMResults:document.createElement("div")});return t.prototype.create(o,n),o}var a=document.querySelectorAll(n);Array.prototype.forEach.call(a,function(n){new t(e,n)})}}return t.prototype.create=function(e,n){if(e.Input=n,e.Input.nodeName.match(/^INPUT$/i)&&(!1===e.Input.hasAttribute("type")||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:t.prototype.destroy.bind(null,e),focus:e._Focus.bind(e),keyup:t.prototype.event.bind(null,e,a.KEYUP),keydown:t.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])}},t.prototype.getEventsByType=function(t,e){var n={};for(var o in t.KeyboardMappings){var i=a.KEYUP;void 0!==t.KeyboardMappings[o].Event&&(i=t.KeyboardMappings[o].Event),i==e&&(n[o]=t.KeyboardMappings[o])}return n},t.prototype.event=function(e,n,a){for(var i in t.prototype.getEventsByType(e,n)){var r=t.merge({Operator:o.AND},e.KeyboardMappings[i]),s=o.AND==r.Operator;r.Conditions.forEach(function(e){(!0===s&&r.Operator==o.AND||!1===s&&r.Operator==o.OR)&&((e=t.merge({Not:!1},e)).hasOwnProperty("Is")?s=e.Is==a.keyCode?!e.Not:e.Not:e.hasOwnProperty("From")&&e.hasOwnProperty("To")&&(s=a.keyCode>=e.From&&a.keyCode<=e.To?!e.Not:e.Not))}),!0===s&&r.Callback.call(e,a)}},t.prototype.makeRequest=function(t,e){var n=Object.getOwnPropertyNames(t.HttpHeaders),o=new XMLHttpRequest,a=t._HttpMethod(),i=t._Url(),r=t._Pre(),s=encodeURIComponent(t._QueryArg())+"="+encodeURIComponent(r);a.match(/^GET$/i)&&(-1!==i.indexOf("?")?i+="&"+s:i+="?"+s),o.open(a,i,!0);for(var l=n.length-1;l>=0;l--)o.setRequestHeader(n[l],t.HttpHeaders[n[l]]);return o.onreadystatechange=function(){4==o.readyState&&200==o.status&&(t.$Cache[r]=o.response,e(o.response))},o},t.prototype.ajax=function(e,n,o){void 0===o&&(o=!0),e.$AjaxTimer&&window.clearTimeout(e.$AjaxTimer),!0===o?e.$AjaxTimer=window.setTimeout(t.prototype.ajax.bind(null,e,n,!1),e.Delay):(e.Request&&e.Request.abort(),e.Request=n,e.Request.send(e._QueryArg()+"="+e._Pre()))},t.prototype.cache=function(e,n){var o=e._Cache(e._Pre());if(void 0===o){var a=t.prototype.makeRequest(e,n);t.prototype.ajax(e,a)}else n(o)},t.prototype.destroy=function(t){for(var e in t.$Listeners)t.Input.removeEventListener(e,t.$Listeners[e]);t.DOMResults.parentNode.removeChild(t.DOMResults)},t}();i.merge=function(){for(var t,e={},n=0;n<arguments.length;n++)for(t in arguments[n])e[t]=arguments[n][t];return e},i.defaults={Delay:150,EmptyMessage:"No result here",Highlight:{getRegex:function(t){return new RegExp(t,"ig")},transform:function(t){return"<strong>"+t+"</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(t){if(-1!=this.DOMResults.getAttribute("class").indexOf("open")){var e=this.DOMResults.querySelector("li.active");null!==e&&(t.preventDefault(),this._Select(e),this.DOMResults.setAttribute("class","autocomplete"))}},Operator:o.AND,Event:a.KEYDOWN},KeyUpAndDown_down:{Conditions:[{Is:38,Not:!1},{Is:40,Not:!1}],Callback:function(t){t.preventDefault()},Operator:o.OR,Event:a.KEYDOWN},KeyUpAndDown_up:{Conditions:[{Is:38,Not:!1},{Is:40,Not:!1}],Callback:function(t){t.preventDefault();var e=this.DOMResults.querySelector("li:first-child:not(.locked)"),n=this.DOMResults.querySelector("li:last-child:not(.locked)"),o=this.DOMResults.querySelector("li.active");if(o){var a=Array.prototype.indexOf.call(o.parentNode.children,o)+(t.keyCode-39),i=this.DOMResults.getElementsByTagName("li").length;a<0?a=i-1:a>=i&&(a=0),o.classList.remove("active"),o.parentElement.children.item(a).classList.add("active")}else n&&38==t.keyCode?n.classList.add("active"):e&&e.classList.add("active")},Operator:o.OR,Event:a.KEYUP},AlphaNum:{Conditions:[{Is:13,Not:!0},{From:35,To:40,Not:!0}],Callback:function(){var t=this.Input.getAttribute("data-autocomplete-old-value"),e=this._Pre();""!==e&&e.length>=this._MinChars()&&(t&&e==t||this.DOMResults.setAttribute("class","autocomplete open"),i.prototype.cache(this,function(t){this._Render(this._Post(t)),this._Open()}.bind(this)))},Operator:o.AND,Event:a.KEYUP}},DOMResults:null,Request:null,Input:null,_EmptyMessage:function(){return this.Input.hasAttribute("data-autocomplete-empty-message")?this.Input.getAttribute("data-autocomplete-empty-message"):!1!==this.EmptyMessage?this.EmptyMessage:""},_Limit:function(){var t=this.Input.getAttribute("data-autocomplete-limit");return isNaN(t)||null===t?this.Limit:parseInt(t,10)},_MinChars:function(){var t=this.Input.getAttribute("data-autocomplete-minchars");return isNaN(t)||null===t?this.MinChars:parseInt(t,10)},_Highlight:function(t){return t.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(t){if(!0===t)this.DOMResults.setAttribute("class","autocomplete"),this.Input.setAttribute("data-autocomplete-old-value",this.Input.value);else{var e=this;setTimeout(function(){e._Blur(!0)},150)}},_Cache:function(t){return this.$Cache[t]},_Focus:function(){var t=this.Input.getAttribute("data-autocomplete-old-value");(!t||this.Input.value!=t)&&this._MinChars()<=this.Input.value.length&&this.DOMResults.setAttribute("class","autocomplete open")},_Open:function(){var t=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(e){"locked"!=e.getAttribute("class")&&(e.onclick=function(n){t._Select(e)},e.onmouseenter=function(){var n=t.DOMResults.querySelector("li.active");n!==e&&(null!==n&&n.classList.remove("active"),e.classList.add("active"))})})},_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(t){var e;e="string"==typeof t?this._RenderRaw(t):this._RenderResponseItems(t),this.DOMResults.hasChildNodes()&&this.DOMResults.removeChild(this.DOMResults.childNodes[0]),this.DOMResults.appendChild(e)},_RenderResponseItems:function(t){var e=document.createElement("ul"),n=document.createElement("li"),o=this._Limit();o<0?t=t.reverse():0===o&&(o=t.length);for(var a=0;a<Math.min(Math.abs(o),t.length);a++)n.innerHTML=t[a].Label,n.setAttribute("data-autocomplete-value",t[a].Value),e.appendChild(n),n=document.createElement("li");return e},_RenderRaw:function(t){var e=document.createElement("ul"),n=document.createElement("li");if(t.length>0)this.DOMResults.innerHTML=t;else{var o=this._EmptyMessage();""!==o&&(n.innerHTML=o,n.setAttribute("class","locked"),e.appendChild(n))}return e},_Post:function(t){try{var e=[],n=JSON.parse(t);if(0===Object.keys(n).length)return"";if(Array.isArray(n))for(var o=0;o<Object.keys(n).length;o++)e[e.length]={Value:n[o],Label:this._Highlight(n[o])};else for(var a in n)e.push({Value:a,Label:this._Highlight(n[a])});return e}catch(e){return t}},_Pre:function(){return this.Input.value},_Select:function(t){console.log("test test test"),t.hasAttribute("data-autocomplete-value")?this.Input.value=t.getAttribute("data-autocomplete-value"):this.Input.value=t.innerHTML,this.Input.setAttribute("data-autocomplete-old-value",this.Input.value)},$AjaxTimer:null,$Cache:{},$Listeners:{}},e.exports=i},{}]},{},[1])(1)}),function(t,e){"use strict";function n(t,e,n,o){this.container_selector=t,this.results_selector=e,this.img_selector=n,this.margin=10,this.maxHeight=o,this._alignAllDone=!0}n.prototype._getHeigth=function(t,e){var n,o=0;e-=t.length*this.margin;for(var a=0;a<t.length;a++)(n=t[a]).naturalWidth>0&&n.naturalHeight>0?o+=n.naturalWidth/n.naturalHeight:o+=1;return e/o},n.prototype._setSize=function(t,e){for(var n,o,a=t.length,i=0;i<a;i++)o=(n=t[i]).naturalWidth>0&&n.naturalHeight>0?e*n.naturalWidth/n.naturalHeight:e,n.style.width=o+"px",n.style.height=e+"px",n.style.marginLeft="3px",n.style.marginTop="3px",n.style.marginRight=this.margin-7+"px",n.style.marginBottom=this.margin-7+"px"},n.prototype._alignImgs=function(t){var n,o,a=e.querySelector(this.container_selector).clientWidth;t:for(;t.length>0;){for(var i=1;i<=t.length;i++)if(n=t.slice(0,i),(o=this._getHeigth(n,a))<this.maxHeight){this._setSize(n,o),t=t.slice(i);continue t}this._setSize(n,Math.min(this.maxHeight,o));break}},n.prototype.align=function(t){for(var n=e.querySelectorAll(this.results_selector),o=n.length,a=null,i=null,r=[],s=0;s<o;s++)(i=n[s]).previousElementSibling!==a&&r.length>0&&(this._alignImgs(r),r=[]),r.push(i.querySelector(this.img_selector)),a=i;r.length>0&&this._alignImgs(r)},n.prototype.watch=function(){function n(t){i._alignAllDone&&(i._alignAllDone=!1,setTimeout(function(){i.align(),i._alignAllDone=!0},100))}var o,a,i=this,r=e.querySelectorAll(this.results_selector),s=r.length;for(t.addEventListener("resize",n),t.addEventListener("pageshow",function(t){i.align()}),o=0;o<s;o++)void 0!==(a=r[o].querySelector(this.img_selector))&&(a.addEventListener("load",n),a.addEventListener("error",n))},t.searx.ImageLayout=n}(window,document),searx.ready(function(){function t(t){return function(e){var o=document.querySelector(".result[data-vim-selected]"),a=t;if(null===o){if(null===(o=document.querySelector(".result")))return;"down"!==t&&"up"!==t||(a=o)}var i,r=document.querySelectorAll(".result");if("string"!=typeof a)i=a;else switch(a){case"visible":for(var s=document.documentElement.scrollTop||document.body.scrollTop,l=s+document.documentElement.clientHeight,u=0;u<r.length;u++){var c=(i=r[u]).offsetTop;if(c+i.clientHeight<=l&&c>s)break}break;case"down":null===(i=o.nextElementSibling)&&(i=r[0]);break;case"up":null===(i=o.previousElementSibling)&&(i=r[r.length-1]);break;case"bottom":i=r[r.length-1];break;case"top":default:i=r[0]}if(i){o.removeAttribute("data-vim-selected"),i.setAttribute("data-vim-selected","true");var d=i.querySelector("h3 a")||i.querySelector("a");null!==d&&d.focus(),e||n()}}}function e(t){return function(){var e=$('div#pagination button[type="submit"]');2===e.length?t>=0&&t<e.length?e[t].click():console.log("pageButtonClick(): invalid argument"):console.log("page navigation with this theme is not supported")}}function n(){var t=document.querySelector(".result[data-vim-selected]");if(null!==t){var e=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.clientHeight,o=t.offsetTop,a=o+t.clientHeight;null===t.previousElementSibling&&a<n?window.scroll(window.scrollX,0):e>o-120?window.scroll(window.scrollX,o-120):e+n<a+120&&window.scroll(window.scrollX,a-n+120)}}function o(e){return function(){window.scrollBy(0,e),t("visible")()}}function a(e,n){return function(){window.scrollTo(0,e),t(n)()}}function i(t){return function(){var e=document.querySelector(".result[data-vim-selected] h3 a");if(null!==e){var n=e.getAttribute("href");t?window.open(n):window.location.href=n}}}searx.on(".result","click",function(){t(this)(!0)}),searx.on(".result a","focus",function(e){for(var n=e.target;void 0!==n;){if(n.classList.contains("result")){null===n.getAttribute("data-vim-selected")&&t(n)(!0);break}n=n.parentNode}},!0);var r={27:{key:"Escape",fun:function(){document.activeElement&&document.activeElement.blur()},des:"remove focus from the focused input",cat:"Control"},73:{key:"i",fun:function(){window.scrollTo(0,0),document.querySelector("#q").focus()},des:"focus on the search input",cat:"Control"},66:{key:"b",fun:o(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},70:{key:"f",fun:o(window.innerHeight),des:"scroll one page down",cat:"Navigation"},85:{key:"u",fun:o(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},68:{key:"d",fun:o(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},71:{key:"g",fun:a(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},86:{key:"v",fun:a(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},75:{key:"k",fun:t("up"),des:"select previous search result",cat:"Results"},74:{key:"j",fun:t("down"),des:"select next search result",cat:"Results"},80:{key:"p",fun:e(0),des:"go to previous page",cat:"Results"},78:{key:"n",fun:e(1),des:"go to next page",cat:"Results"},79:{key:"o",fun:i(!1),des:"open search result",cat:"Results"},84:{key:"t",fun:i(!0),des:"open the result in a new tab",cat:"Results"},82:{key:"r",fun:function(){document.location.reload(!0)},des:"reload page from the server",cat:"Control"},72:{key:"h",fun:function(){var t=document.querySelector("#vim-hotkeys-help");if(t.length)t.classList.toggle("hidden");else{var e={};for(var n in r){var o=r[n];e[o.cat]=e[o.cat]||[],e[o.cat].push(o)}var a=Object.keys(e).sort(function(t,n){return e[n].length-e[t].length});if(0!==a.length){var i='<div id="vim-hotkeys-help" class="well vim-hotkeys-help">';i+='<div class="container-fluid">',i+='<div class="row">',i+='<div class="col-sm-12">',i+="<h3>How to navigate searx with Vim-like hotkeys</h3>",i+="</div>",i+="</div>";for(var s=0;s<a.length;s++){var l=e[a[s]],u=s===a.length-1,c=s%2==0;c&&(i+='<div class="row dflex">'),i+='<div class="col-sm-'+(c&&u?12:6)+' dflex">',i+='<div class="panel panel-default iflex">',i+='<div class="panel-heading">'+l[0].cat+"</div>",i+='<div class="panel-body">',i+='<ul class="list-unstyled">';for(var d in l)i+="<li><kbd>"+l[d].key+"</kbd> "+l[d].des+"</li>";i+="</ul>",i+="</div>",i+="</div>",i+="</div>",c&&!u||(i+="</div>")}i+="</div>",i+="</div>",$("body").append(i)}}},des:"toggle help window",cat:"Other"}};searx.on(document,"keyup",function(t){if(r.hasOwnProperty(t.keyCode)&&!t.ctrlKey&&!t.altKey&&!t.shiftKey&&!t.metaKey){var e=t.target.tagName.toLowerCase();27===t.keyCode?"input"!==e&&"select"!==e&&"textarea"!==e||r[t.keyCode].fun():t.target!==document.body&&"a"!==e&&"button"!==e||r[t.keyCode].fun()}})}),function(t,e,n){"use strict";n.ready(function(){n.on(".searx_overpass_request","click",function(t){this.classList.remove("searx_overpass_request");var o="https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];(",a=this.dataset.osmId,i=this.dataset.osmType,r=e.querySelector("#"+this.dataset.resultTable),s=e.querySelector("#"+this.dataset.resultTableLoadicon),l=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(a&&i&&r){var u=null;switch(i){case"node":u=o+"node("+a+"););out meta;";break;case"way":u=o+"way("+a+"););out meta;";break;case"relation":u=o+"relation("+a+"););out meta;"}u&&n.http("GET",u).then(function(t,e){if((t=JSON.parse(t))&&t.elements&&t.elements[0]){var n=t.elements[0],o="";for(var a in n.tags)if(null===n.tags.name||-1==l.indexOf(a)){switch(o+="<tr><td>"+a+"</td><td>",a){case"phone":case"fax":o+='<a href="tel:'+n.tags[a].replace(/ /g,"")+'">'+n.tags[a]+"</a>";break;case"email":o+='<a href="mailto:'+n.tags[a]+'">'+n.tags[a]+"</a>";break;case"website":case"url":o+='<a href="'+n.tags[a]+'">'+n.tags[a]+"</a>";break;case"wikidata":o+='<a href="https://www.wikidata.org/wiki/'+n.tags[a]+'">'+n.tags[a]+"</a>";break;case"wikipedia":if(-1!=n.tags[a].indexOf(":")){o+='<a href="https://'+n.tags[a].substring(0,n.tags[a].indexOf(":"))+".wikipedia.org/wiki/"+n.tags[a].substring(n.tags[a].indexOf(":")+1)+'">'+n.tags[a]+"</a>";break}default:o+=n.tags[a]}o+="</td></tr>"}s.classList.add("invisible"),r.classList.remove("invisible"),r.querySelector("tbody").innerHTML=o}}).catch(function(){s.innerHTML=s.innerHTML+'<p class="text-muted">could not load data!</p>'})}t.preventDefault()}),n.on(".searx_init_map","click",function(t){this.classList.remove("searx_init_map");var e=this.dataset.leafletTarget,o=parseFloat(this.dataset.mapLon),a=parseFloat(this.dataset.mapLat),i=parseFloat(this.dataset.mapZoom),r=JSON.parse(this.dataset.mapBoundingbox),s=JSON.parse(this.dataset.mapGeojson);n.loadStyle("leaflet/leaflet.css"),n.loadScript("leaflet/leaflet.js",function(){var t=null;if(r){var n=L.latLng(r[0],r[2]),l=L.latLng(r[1],r[3]);t=L.latLngBounds(n,l)}var u=L.map(e),c=new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'});new L.TileLayer("https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Wikimedia maps beta | Maps data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'});t?setTimeout(function(){u.fitBounds(t,{maxZoom:17})},0):o&&a&&(i?u.setView(new L.latLng(a,o),i):u.setView(new L.latLng(a,o),8)),u.addLayer(c);var d={"OSM Mapnik":c};L.control.layers(d).addTo(u),s&&L.geoJson(s).addTo(u)}),t.preventDefault()})})}(window,document,window.searx),function(t,e,n){"use strict";n.ready(function(){n.image_thumbnail_layout=new n.ImageLayout("#urls","#urls .result-images","img.image_thumbnail",200),n.image_thumbnail_layout.watch(),n.on(".btn-collapse","click",function(t){var n=this.getAttribute("data-btn-text-collapsed"),o=this.getAttribute("data-btn-text-not-collapsed"),a=this.getAttribute("data-target"),i=e.querySelector(a),r=this.innerHTML;r=this.classList.contains("collapsed")?r.replace(n,o):r.replace(o,n),this.innerHTML=r,this.classList.toggle("collapsed"),i.classList.toggle("invisible")}),n.on(".media-loader","click",function(t){var n=this.getAttribute("data-target"),o=e.querySelector(n+" > iframe"),a=o.getAttribute("src");null!==a&&void 0!==a&&!1!==a||o.setAttribute("src",o.getAttribute("data-src"))}),t.addEventListener("scroll",function(){var t=e.getElementById("backToTop"),n=document.documentElement.scrollTop||document.body.scrollTop;null!==t&&(t.style.opacity=n>=200?1:0)})})}(window,document,window.searx),function(t,e,n){"use strict";function o(t){if(t.setSelectionRange){var e=t.value.length;t.setSelectionRange(e,e)}}function a(){if(i.value.length>0){var t=document.getElementById("search");setTimeout(t.submit.bind(t),0)}}var i,r=!0;n.ready(function(){null!==(i=e.getElementById("q"))&&(n.autocompleter&&(n.autocomplete=AutoComplete.call(t,{Url:"./autocompleter",EmptyMessage:n.noItemFound,HttpMethod:n.method,MinChars:4,Delay:300},"#q"),t.addEventListener("resize",function(){var t=new CustomEvent("position");i.dispatchEvent(t)})),i.addEventListener("focus",function(t){r&&(o(i),r=!1)},!1),i.focus()),null!==i&&n.search_on_category_select&&(e.querySelector(".help").className="invisible",n.on("#categories input","change",function(t){var n,o=e.querySelectorAll('#categories input[type="checkbox"]');for(n=0;n<o.length;n++)o[n]!==this&&o[n].checked&&o[n].click();return this.checked||this.click(),a(),!1}),n.on(e.getElementById("time_range"),"change",a),n.on(e.getElementById("language"),"change",a))})}(window,document,window.searx);
|
|
//# sourceMappingURL=searx.min.js.map
|