1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-09 22:50:10 +01:00
searxng/searx/static/themes/oscar/js/searx.min.js

4 lines
5.6 KiB
JavaScript
Raw Normal View History

/*! oscar/searx.min.js | 22-03-2021 | */
window.searx=function(t){"use strict";var a,a=t.currentScript||(a=t.getElementsByTagName("script"))[a.length-1];return{autocompleter:"true"===a.getAttribute("data-autocompleter"),method:a.getAttribute("data-method"),translations:JSON.parse(a.getAttribute("data-translations"))}}(document),$(document).ready(function(){var t,e="";searx.autocompleter&&((t=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:{url:"./autocompleter?q=%QUERY",wildcard:"%QUERY"}})).initialize(),$("#q").on("keydown",function(t){13==t.which&&(e=$("#q").val())}),$("#q").typeahead({name:"search-results",highlight:!1,hint:!0,displayKey:function(t){return t},classNames:{input:"tt-input",hint:"tt-hint",menu:"tt-dropdown-menu",dataset:"tt-dataset-search-results"}},{name:"autocomplete",source:t}),$("#q").bind("typeahead:select",function(t,a){e&&$("#q").val(e),$("#search_form").submit()}))}),$(document).ready(function(){$("#q.autofocus").focus(),$("#clear_search").click(function(){document.getElementById("q").value=""}),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var t=$(this).data("btn-text-collapsed"),a=$(this).data("btn-text-not-collapsed");""!==t&&""!==a&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(t,a):$(this).html().replace(a,t),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var t="btn-"+$(this).data("btn-class"),a=$(this).data("btn-label-default"),e=$(this).data("btn-label-toggled");""!==e&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(a,e):$(this).html().replace(e,a),$(this).html(new_html)),$(this).toggleClass(t),$(this).toggleClass("btn-default")}),$(".media-loader").click(function(){var t=$(this).data("target"),a=$(t+" > iframe"),t=a.attr("src");void 0!==t&&!1!==t||a.attr("src",a.data("src"))}),$(".btn-sm").dblclick(function(){var t="btn-"+$(this).data("btn-class");$(this).hasClass("btn-default")?($(".btn-sm > input").attr("checked","checked"),$(".btn-sm > input").prop("checked",!0),$(".btn-sm").addClass(t),$(".btn-sm").addClass("active"),$(".btn-sm").removeClass("btn-default")):($(".btn-sm > input").attr("checked",""),$(".btn-sm > input").removeAttr("checked"),$(".btn-sm > input").checked=!1,$(".btn-sm").removeClass(t),$(".btn-sm").removeClass("active"),$(".btn-sm").addClass("btn-default"))}),$(".nav-tabs").click(function(t){$(t.target).parents("ul").children().attr("aria-selected","false"),$(t.target).parent().attr("aria-selected","true")})}),window.addEventListener("load",function(){$(".infobox").each(function(){var t=$(this).find(".infobox_body");t.prop("scrollHeight")+t.find("img.infobox_part").height()<=t.css("max-height").replace("px","")&&$(this).find(".infobox_toggle").hide()})}),$(document).ready(function(){$(".searx_overpass_request").on("click",function(t){var a="https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];(",e=");out meta;",s=$(this).data("osm-id"),n=$(this).data("osm-type"),i=$(this).data("result-table"),o="#"+$(this).data("result-table-loadicon"),r=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(s&&n&&i){var i="#"+i,l=null;switch(n){case"node":l=a+"node("+s+");"+e;break;case"way":l=a+"way("+s+");"+e;break;case"relation":l=a+"relation("+s+");"+e}l&&$.ajax(l).done(function(t){if(t&&t.elements&&t.elements[0]){var a,e=t.elements[0],s=$(i).html();for(a in e.tags)if(null===e.tags.name||-1==r.indexOf(a)){switch(s+="<tr><td>"+a+"</td><td>",a){case"phone":case"fax":s+='<a href="tel:'+e.tags[a].replace(/ /g,"")+'">'+e.tags[a]+"</a>";break;case"email":s+='<a href="mailto:'+e.tags[a]+'">'+e.tags[a]+"</a>";break;case"website":case"url":s+='<a href="'+e.tags[a]+'">'+e.tags[a]+"</a>";break;case"wikidata":s+='<a href="https://www.wikidata.org/wiki/'+e.tags[a]+'">'+e.tags[a]+"</a>";break;case"wikipedia":if(-1!=e.tags[a].indexOf(":")){s+='<a href="https://'+e.tags[a].substring(0,e.tags[a].indexOf(":"))+".wikipedia.org/wiki/"+e.tags[a].substring(e.tags[a].indexOf(":")+1)+'">'+e.tags[a]+"</a>";break}default:s
//# sourceMappingURL=searx.min.js.map