searxngRebrandZaclys/searx/static/themes/oscar/js/searx.min.js
Alexandre Flament bdb41bea7b [mod] theme: remove require-2.1.15.min.js
See https://github.com/requirejs/requirejs/issues/1816

requirejs loads one file: leaflet.

This commit:
* removes requirejs
* load leaflet using <script src...> HTML tag in searx/templates/oscar/base.html
2021-03-10 19:01:15 +01:00

4 lines
5.4 KiB
JavaScript

/*! oscar/searx.min.js | 10-03-2021 | */
window.searx=function(t){"use strict";var e,e=t.currentScript||(e=t.getElementsByTagName("script"))[e.length-1];return{autocompleter:"true"===e.getAttribute("data-autocompleter"),method:e.getAttribute("data-method")}}(document),searx.autocompleter&&(searx.searchResults=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:"./autocompleter?q=%QUERY"}),searx.searchResults.initialize()),$(document).ready(function(){var a="";searx.autocompleter&&($("#q").on("keydown",function(t){13==t.which&&(a=$("#q").val())}),$("#q").typeahead(null,{name:"search-results",displayKey:function(t){return t},source:searx.searchResults.ttAdapter()}),$("#q").bind("typeahead:selected",function(t,e){a&&$("#q").val(a),$("#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"),e=$(this).data("btn-text-not-collapsed");""!==t&&""!==e&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(t,e):$(this).html().replace(e,t),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var t="btn-"+$(this).data("btn-class"),e=$(this).data("btn-label-default"),a=$(this).data("btn-label-toggled");""!==a&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(e,a):$(this).html().replace(a,e),$(this).html(new_html)),$(this).toggleClass(t),$(this).toggleClass("btn-default")}),$(".media-loader").click(function(){var t=$(this).data("target"),e=$(t+" > iframe"),t=e.attr("src");void 0!==t&&!1!==t||e.attr("src",e.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 e="https://overpass-api.de/api/interpreter?data=[out:json][timeout:25];(",a=");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=e+"node("+s+");"+a;break;case"way":l=e+"way("+s+");"+a;break;case"relation":l=e+"relation("+s+");"+a}l&&$.ajax(l).done(function(t){if(t&&t.elements&&t.elements[0]){var e,a=t.elements[0],s=$(i).html();for(e in a.tags)if(null===a.tags.name||-1==r.indexOf(e)){switch(s+="<tr><td>"+e+"</td><td>",e){case"phone":case"fax":s+='<a href="tel:'+a.tags[e].replace(/ /g,"")+'">'+a.tags[e]+"</a>";break;case"email":s+='<a href="mailto:'+a.tags[e]+'">'+a.tags[e]+"</a>";break;case"website":case"url":s+='<a href="'+a.tags[e]+'">'+a.tags[e]+"</a>";break;case"wikidata":s+='<a href="https://www.wikidata.org/wiki/'+a.tags[e]+'">'+a.tags[e]+"</a>";break;case"wikipedia":if(-1!=a.tags[e].indexOf(":")){s+='<a href="https://'+a.tags[e].substring(0,a.tags[e].indexOf(":"))+".wikipedia.org/wiki/"+a.tags[e].substring(a.tags[e].indexOf(":")+1)+'">'+a.tags[e]+"</a>";break}default:s+=a.tags[e]}s+="</td></tr>"}$(i).html(s),$(i).removeClass("hidden"),$(o).addClass("hidden")}}).fail(function(){$(o).html($(o).html()+'<p class="text-muted">'+could_not_load+"</p>")})}$(this).off(t)}),$(".searx_init_map").on("click",function(t){var e=$(this).data("leaflet-target"),a=$(this).data("map-lon"),s=$(this).data("map-lat"),n=$(this).data("map-zoom"),i=$(this).data("map-boundingbox"),o=$(this).data("map-geojson");i&&(southWest=L.latLng(i[0],i[2]),northEast=L.latLng(i[1],i[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="./static/themes/oscar/img/map";var r=L.map(e),e=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'});setTimeout(function(){map_bounds?r.fitBounds(map_bounds,{maxZoom:17}):a&&s&&(n?r.setView(new L.LatLng(s,a),n):r.setView(new L.LatLng(s,a),8))},0),r.addLayer(e);e={"OSM Mapnik":e};L.control.layers(e).addTo(r),o&&L.geoJson(o).addTo(r),$(this).off(t)})}),$(document).ready(function(){$("#allow-all-engines").click(function(){$(".onoffswitch-checkbox").each(function(){this.checked=!1})}),$("#disable-all-engines").click(function(){$(".onoffswitch-checkbox").each(function(){this.checked=!0})})});
//# sourceMappingURL=searx.min.js.map