mirror of https://github.com/searxng/searxng.git
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.Operat
|
||
|
//# sourceMappingURL=searx.min.js.map
|