1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-23 12:31:25 +01:00
searxng/searx/static/themes/simple/js/searx.min.js
Alex 3ba0d0516e simple theme update
- npm package update
- apply #1226
- implement vim help dialog
- display cookies and search URL with preferences
- allow to enable / disable Open Access DOI rewrite
- add a clear text button on the left of the search button
- implement #1011 : the HTML title page is not set when using POST
- remove searx/static/themes/simple/img/loader.gif
- use full width when only there are only images as result
2018-08-14 17:21:30 +02:00

23 lines
23 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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