diff --git a/searx/static/themes/oscar/js/searx.js b/searx/static/themes/oscar/js/searx.js index 159344b28..163009481 100644 --- a/searx/static/themes/oscar/js/searx.js +++ b/searx/static/themes/oscar/js/searx.js @@ -25,7 +25,8 @@ window.searx = (function(d) { return { autocompleter: script.getAttribute('data-autocompleter') === 'true', - method: script.getAttribute('data-method') + method: script.getAttribute('data-method'), + translations: JSON.parse(script.getAttribute('data-translations')) }; })(document); ;/** @@ -302,7 +303,7 @@ $(document).ready(function(){ } }) .fail(function() { - $(result_table_loadicon).html($(result_table_loadicon).html() + "

"+could_not_load+"

"); + $(result_table_loadicon).html($(result_table_loadicon).html() + "

"+searx.translations.could_not_load+"

"); }); } } diff --git a/searx/static/themes/oscar/js/searx.min.js b/searx/static/themes/oscar/js/searx.min.js index 71d67ae7f..0021f599c 100644 --- a/searx/static/themes/oscar/js/searx.min.js +++ b/searx/static/themes/oscar/js/searx.min.js @@ -1,4 +1,4 @@ /*! oscar/searx.min.js | 16-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")}}(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,c=null;switch(n){case"node":c=a+"node("+s+");"+e;break;case"way":c=a+"way("+s+");"+e;break;case"relation":c=a+"relation("+s+");"+e}c&&$.ajax(c).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+=""+a+"",a){case"phone":case"fax":s+=''+e.tags[a]+"";break;case"email":s+=''+e.tags[a]+"";break;case"website":case"url":s+=''+e.tags[a]+"";break;case"wikidata":s+=''+e.tags[a]+"";break;case"wikipedia":if(-1!=e.tags[a].indexOf(":")){s+=''+e.tags[a]+"";break}default:s+=e.tags[a]}s+=""}$(i).html(s),$(i).removeClass("hidden"),$(o).addClass("hidden")}}).fail(function(){$(o).html($(o).html()+'

'+could_not_load+"

")})}$(this).off(t)}),$(".searx_init_map").on("click",function(t){var a=$(this).data("leaflet-target"),e=$(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/css/images/";var r=L.map(a),a=new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Map data © OpenStreetMap contributors'});new L.TileLayer("https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Wikimedia maps beta | Maps data © OpenStreetMap contributors'});setTimeout(function(){map_bounds?r.fitBounds(map_bounds,{maxZoom:17}):e&&s&&(n?r.setView(new L.LatLng(s,e),n):r.setView(new L.LatLng(s,e),8))},0),r.addLayer(a),L.control.layers({"OSM Mapnik":a}).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})})}); +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+=""+a+"",a){case"phone":case"fax":s+=''+e.tags[a]+"";break;case"email":s+=''+e.tags[a]+"";break;case"website":case"url":s+=''+e.tags[a]+"";break;case"wikidata":s+=''+e.tags[a]+"";break;case"wikipedia":if(-1!=e.tags[a].indexOf(":")){s+=''+e.tags[a]+"";break}default:s+=e.tags[a]}s+=""}$(i).html(s),$(i).removeClass("hidden"),$(o).addClass("hidden")}}).fail(function(){$(o).html($(o).html()+'

'+searx.translations.could_not_load+"

")})}$(this).off(t)}),$(".searx_init_map").on("click",function(t){var a=$(this).data("leaflet-target"),e=$(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/css/images/";var r=L.map(a),a=new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Map data © OpenStreetMap contributors'});new L.TileLayer("https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Wikimedia maps beta | Maps data © OpenStreetMap contributors'});setTimeout(function(){map_bounds?r.fitBounds(map_bounds,{maxZoom:17}):e&&s&&(n?r.setView(new L.LatLng(s,e),n):r.setView(new L.LatLng(s,e),8))},0),r.addLayer(a),L.control.layers({"OSM Mapnik":a}).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 \ No newline at end of file diff --git a/searx/static/themes/oscar/js/searx.min.js.map b/searx/static/themes/oscar/js/searx.min.js.map index 11b3a9102..13e949a74 100644 --- a/searx/static/themes/oscar/js/searx.min.js.map +++ b/searx/static/themes/oscar/js/searx.min.js.map @@ -1 +1 @@ -{"version":3,"file":"searx.min.js","sources":["searx.js"],"names":["window","searx","d","scripts","script","currentScript","getElementsByTagName","length","autocompleter","getAttribute","method","document","$","ready","searchResults","original_search_value","Bloodhound","datumTokenizer","tokenizers","obj","whitespace","queryTokenizer","remote","url","wildcard","initialize","on","e","which","val","typeahead","name","highlight","hint","displayKey","result","classNames","input","menu","dataset","source","bind","ev","suggestion","submit","focus","click","getElementById","value","this","select","btnTextCollapsed","data","btnTextNotCollapsed","new_html","hasClass","html","replace","btnClass","btnLabelDefault","btnLabelToggled","toggleClass","target","iframe_load","srctest","attr","undefined","dblclick","prop","addClass","removeClass","removeAttr","checked","a","parents","children","parent","addEventListener","each","infobox_body","find","height","css","hide","event","query_start","overpass_url","query_end","osm_id","osm_type","result_table","result_table_loadicon","osm_ignore_tags","query","ajax","done","elements","row","element","newHtml","tags","indexOf","substring","fail","could_not_load","off","leaflet_target","map_lon","map_lat","map_zoom","map_boundingbox","map_geojson","southWest","L","latLng","northEast","map_bounds","latLngBounds","Icon","Default","imagePath","map","osmMapnik","TileLayer","minZoom","maxZoom","attribution","setTimeout","fitBounds","setView","LatLng","addLayer","control","layers","OSM Mapnik","addTo","geoJson"],"mappings":";;AAgBAA,OAAOC,MAAQ,SAAUC,gBAIrB,IACQC,EADJC,EAASF,EAAEG,gBACPF,EAAUD,EAAEI,qBAAqB,WACtBH,EAAQI,OAAS,GAGpC,MAAO,CACHC,cAA6D,SAA9CJ,EAAOK,aAAa,sBACnCC,OAAQN,EAAOK,aAAa,gBAXrB,CAaZE,UAkBHC,EAAED,UAAUE,MAAM,WACd,IAEQC,EAFJC,EAAwB,GACzBd,MAAMO,iBACDM,EAAgB,IAAIE,WAAW,CAC/BC,eAAgBD,WAAWE,WAAWC,IAAIC,WAAW,SACrDC,eAAgBL,WAAWE,WAAWE,WACtCE,OAAQ,CACJC,IAAK,2BACLC,SAAU,aAGJC,aAEdb,EAAE,MAAMc,GAAG,UAAW,SAASC,GACtB,IAAXA,EAAEC,QACQb,EAAwBH,EAAE,MAAMiB,SAGxCjB,EAAE,MAAMkB,UAAU,CACdC,KAAM,iBACNC,WAAW,EACXC,MAAM,EACNC,WAAY,SAASC,GACjB,OAAOA,GAEXC,WAAY,CACRC,MAAO,WACPJ,KAAM,UACNK,KAAM,mBACNC,QAAS,8BAEd,CACCR,KAAM,eACNS,OAAQ1B,IAEZF,EAAE,MAAM6B,KAAK,mBAAoB,SAASC,EAAIC,GACvC5B,GACCH,EAAE,MAAMiB,IAAId,GAEhBH,EAAE,gBAAgBgC,cAqB9BhC,EAAED,UAAUE,MAAM,WAIdD,EAAE,gBAAgBiC,QAKlBjC,EAAE,iBAAiBkC,MAAM,WAC5BnC,SAAS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,KAAK,WAAa7B,KAAKuB,SAAU"} \ No newline at end of file +{"version":3,"file":"searx.min.js","sources":["searx.js"],"names":["window","searx","d","scripts","script","currentScript","getElementsByTagName","length","autocompleter","getAttribute","method","translations","JSON","parse","document","$","ready","searchResults","original_search_value","Bloodhound","datumTokenizer","tokenizers","obj","whitespace","queryTokenizer","remote","url","wildcard","initialize","on","e","which","val","typeahead","name","highlight","hint","displayKey","result","classNames","input","menu","dataset","source","bind","ev","suggestion","submit","focus","click","getElementById","value","this","select","btnTextCollapsed","data","btnTextNotCollapsed","new_html","hasClass","html","replace","btnClass","btnLabelDefault","btnLabelToggled","toggleClass","target","iframe_load","srctest","attr","undefined","dblclick","prop","addClass","removeClass","removeAttr","checked","a","parents","children","parent","addEventListener","each","infobox_body","find","height","css","hide","event","query_start","overpass_url","query_end","osm_id","osm_type","result_table","result_table_loadicon","osm_ignore_tags","query","ajax","done","elements","row","element","newHtml","tags","indexOf","substring","fail","could_not_load","off","leaflet_target","map_lon","map_lat","map_zoom","map_boundingbox","map_geojson","southWest","L","latLng","northEast","map_bounds","latLngBounds","Icon","Default","imagePath","map","osmMapnik","TileLayer","minZoom","maxZoom","attribution","setTimeout","fitBounds","setView","LatLng","addLayer","control","layers","OSM Mapnik","addTo","geoJson"],"mappings":";;AAgBAA,OAAOC,MAAQ,SAAUC,gBAIrB,IACQC,EADJC,EAASF,EAAEG,gBACPF,EAAUD,EAAEI,qBAAqB,WACtBH,EAAQI,OAAS,GAGpC,MAAO,CACHC,cAA6D,SAA9CJ,EAAOK,aAAa,sBACnCC,OAAQN,EAAOK,aAAa,eAC5BE,aAAcC,KAAKC,MAAMT,EAAOK,aAAa,uBAZtC,CAcZK,UAkBHC,EAAED,UAAUE,MAAM,WACd,IAEQC,EAFJC,EAAwB,GACzBjB,MAAMO,iBACDS,EAAgB,IAAIE,WAAW,CAC/BC,eAAgBD,WAAWE,WAAWC,IAAIC,WAAW,SACrDC,eAAgBL,WAAWE,WAAWE,WACtCE,OAAQ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rD,yGAIzBC,WAAW,WACJX,WACCK,EAAIO,UAAUZ,WAAY,CACtBS,QAAQ,KAELlB,GAAWC,IACfC,EACCY,EAAIQ,QAAQ,IAAIhB,EAAEiB,OAAOtB,EAASD,GAASE,GAE3CY,EAAIQ,QAAQ,IAAIhB,EAAEiB,OAAOtB,EAASD,GAAS,KAEpD,GAEHc,EAAIU,SAAST,GAObT,EAAEmB,QAAQC,OALO,CACbC,aAAcZ,IAIWa,MAAMd,GAEhCV,GACCE,EAAEuB,QAAQzB,GAAawB,MAAMd,GAKjC7G,EAAGqC,MAAOwD,IAAKrB,OAGtBxE,EAAED,UAAUE,MAAM,WACfD,EAAE,sBAAsBkC,MAAM,WAC1BlC,EAAE,yBAAyBkE,KAAK,WAAa7B,KAAKuB,SAAU,MAGhE5D,EAAE,wBAAwBkC,MAAM,WAC5BlC,EAAE,yBAAyBkE,KAAK,WAAa7B,KAAKuB,SAAU"} \ No newline at end of file diff --git a/searx/static/themes/oscar/src/js/01_init.js b/searx/static/themes/oscar/src/js/01_init.js index 690365c7f..dd8de4ddb 100644 --- a/searx/static/themes/oscar/src/js/01_init.js +++ b/searx/static/themes/oscar/src/js/01_init.js @@ -25,6 +25,7 @@ window.searx = (function(d) { return { autocompleter: script.getAttribute('data-autocompleter') === 'true', - method: script.getAttribute('data-method') + method: script.getAttribute('data-method'), + translations: JSON.parse(script.getAttribute('data-translations')) }; })(document); diff --git a/searx/static/themes/oscar/src/js/leaflet_map.js b/searx/static/themes/oscar/src/js/leaflet_map.js index d1e102ff6..83364b0c3 100644 --- a/searx/static/themes/oscar/src/js/leaflet_map.js +++ b/searx/static/themes/oscar/src/js/leaflet_map.js @@ -90,7 +90,7 @@ $(document).ready(function(){ } }) .fail(function() { - $(result_table_loadicon).html($(result_table_loadicon).html() + "

"+could_not_load+"

"); + $(result_table_loadicon).html($(result_table_loadicon).html() + "

"+searx.translations.could_not_load+"

"); }); } } diff --git a/searx/static/themes/simple/js/searx.head.js b/searx/static/themes/simple/js/searx.head.js index 3ac61c8ae..e6964400b 100644 --- a/searx/static/themes/simple/js/searx.head.js +++ b/searx/static/themes/simple/js/searx.head.js @@ -32,7 +32,7 @@ search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true', infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true', static_path: script.getAttribute('data-static-path'), - no_item_found: script.getAttribute('data-no-item-found') + translations: JSON.parse(script.getAttribute('data-translations')), } // update the css diff --git a/searx/static/themes/simple/js/searx.head.min.js b/searx/static/themes/simple/js/searx.head.min.js index 19de1e498..5c87d749b 100644 --- a/searx/static/themes/simple/js/searx.head.min.js +++ b/searx/static/themes/simple/js/searx.head.min.js @@ -1,4 +1,4 @@ /*! simple/searx.min.js | 16-03-2021 | */ -(function(t,e){"use strict";var a=e.currentScript||function(){var t=e.getElementsByTagName("script");return t[t.length-1]}();t.searx={touch:"ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch||false,method:a.getAttribute("data-method"),autocompleter:a.getAttribute("data-autocompleter")==="true",search_on_category_select:a.getAttribute("data-search-on-category-select")==="true",infinite_scroll:a.getAttribute("data-infinite-scroll")==="true",static_path:a.getAttribute("data-static-path"),no_item_found:a.getAttribute("data-no-item-found")};e.getElementsByTagName("html")[0].className=t.searx.touch?"js touch":"js"})(window,document); +(function(t,e){"use strict";var a=e.currentScript||function(){var t=e.getElementsByTagName("script");return t[t.length-1]}();t.searx={touch:"ontouchstart"in t||t.DocumentTouch&&document instanceof DocumentTouch||false,method:a.getAttribute("data-method"),autocompleter:a.getAttribute("data-autocompleter")==="true",search_on_category_select:a.getAttribute("data-search-on-category-select")==="true",infinite_scroll:a.getAttribute("data-infinite-scroll")==="true",static_path:a.getAttribute("data-static-path"),translations:JSON.parse(a.getAttribute("data-translations"))};e.getElementsByTagName("html")[0].className=t.searx.touch?"js touch":"js"})(window,document); //# sourceMappingURL=searx.head.min.js.map \ No newline at end of file diff --git a/searx/static/themes/simple/js/searx.head.min.js.map b/searx/static/themes/simple/js/searx.head.min.js.map index d19ad5a44..a233d297b 100644 --- a/searx/static/themes/simple/js/searx.head.min.js.map +++ b/searx/static/themes/simple/js/searx.head.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","no_item_found","className","window"],"mappings":";;CAiBA,SAAUA,EAAGC,GACT,aAGA,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,cAAef,EAAOU,aAAa,uBAIvCX,EAAEI,qBAAqB,QAAQ,GAAGa,UAAalB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGY,OAAQT","file":"searx.head.min.js"} \ No newline at end of file +{"version":3,"sources":["searx.head.js"],"names":["w","d","script","currentScript","scripts","getElementsByTagName","length","searx","touch","DocumentTouch","document","method","getAttribute","autocompleter","search_on_category_select","infinite_scroll","static_path","translations","JSON","parse","className","window"],"mappings":";;CAiBA,SAAUA,EAAGC,GACT,aAGA,IAAIC,EAASD,EAAEE,eAAkB,WAC7B,IAAIC,EAAUH,EAAEI,qBAAqB,UACrC,OAAOD,EAAQA,EAAQE,OAAS,GAFH,GAMjCN,EAAEO,MAAQ,CACNC,MAAS,iBAAkBR,GAAMA,EAAES,eAAiBC,oBAAoBD,eAAkB,MAC1FE,OAAQT,EAAOU,aAAa,eAC5BC,cAAeX,EAAOU,aAAa,wBAA0B,OAC7DE,0BAA2BZ,EAAOU,aAAa,oCAAsC,OACrFG,gBAAiBb,EAAOU,aAAa,0BAA4B,OACjEI,YAAad,EAAOU,aAAa,oBACjCK,aAAcC,KAAKC,MAAMjB,EAAOU,aAAa,uBAIjDX,EAAEI,qBAAqB,QAAQ,GAAGe,UAAapB,EAAEO,MAAW,MAAE,WAAW,MArB7E,CAsBGc,OAAQX","file":"searx.head.min.js"} \ No newline at end of file diff --git a/searx/static/themes/simple/js/searx.js b/searx/static/themes/simple/js/searx.js index 8fb2471b0..1abe81e4d 100644 --- a/searx/static/themes/simple/js/searx.js +++ b/searx/static/themes/simple/js/searx.js @@ -1529,7 +1529,7 @@ module.exports = AutoComplete; if (searx.autocompleter) { searx.autocomplete = AutoComplete.call(w, { Url: "./autocompleter", - EmptyMessage: searx.no_item_found, + EmptyMessage: searx.translations.no_item_found, HttpMethod: searx.method, HttpHeaders: { "Content-type": "application/x-www-form-urlencoded", diff --git a/searx/static/themes/simple/js/searx.min.js b/searx/static/themes/simple/js/searx.min.js index 731e9ca7c..3b2b9d762 100644 --- a/searx/static/themes/simple/js/searx.min.js +++ b/searx/static/themes/simple/js/searx.min.js @@ -21,5 +21,5 @@ window.searx=function(t,a){"use strict";if(t.Element){(function(e){e.matches=e.m * @license Free to use under the MIT License. * */ -(function(u,c){"use strict";function e(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}e.prototype._getHeigth=function(e,t){var n=0,i;t-=e.length*this.margin;for(var r=0;r0&&i.naturalHeight>0){n+=i.naturalWidth/i.naturalHeight}else{n+=1}}return t/n};e.prototype._setSize=function(e,t){var n,i,r=e.length;for(var a=0;a0&&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"}};e.prototype._alignImgs=function(e){var t,n,i=c.querySelector(this.container_selector).clientWidth;e:while(e.length>0){for(var r=1;r<=e.length;r++){t=e.slice(0,r);n=this._getHeigth(t,i);if(n0){this._alignImgs(a);a=[]}a.push(r.querySelector(this.img_selector));i=r}if(a.length>0){this._alignImgs(a)}};e.prototype.watch=function(){var e,t,n,i,r=this,a=c.querySelectorAll(this.results_selector),o=a.length;function s(e){r.align()}function l(e){if(r._alignAllDone){r._alignAllDone=false;setTimeout(function(){r.align();r._alignAllDone=true},100)}}u.addEventListener("resize",l);u.addEventListener("pageshow",s);for(e=0;ea){break}}break;case"down":i=t.nextElementSibling;if(i===null){i=r[0]}break;case"up":i=t.previousElementSibling;if(i===null){i=r[r.length-1]}break;case"bottom":i=r[r.length-1];break;case"top":default:i=r[0]}}if(i){t.removeAttribute("data-vim-selected");i.setAttribute("data-vim-selected","true");var c=i.querySelector("h3 a")||i.querySelector("a");if(c!==null){c.focus()}if(!e){f()}}}}function e(){document.location.reload(true)}function t(){if(document.activeElement){document.activeElement.blur()}}function i(t){return function(){var e=$('div#pagination button[type="submit"]');if(e.length!==2){console.log("page navigation with this theme is not supported");return}if(t>=0&&ti-a){window.scroll(window.scrollX,i-a)}else{var o=t+n;if(o"}a+="";a+="

"+s[0].cat+"

";a+='
    ';for(var c in s){a+="
  • "+s[c].key+" "+s[c].des+"
  • "}a+="
";a+="";if(!u||l){a+=""}}a+="";e.innerHTML=a}function u(){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%";l(e);var t=document.getElementsByTagName("body")[0];t.appendChild(e)}else{e.classList.toggle("invisible");return}}});(function(e,c,v){"use strict";v.ready(function(){v.on(".searx_overpass_request","click",function(e){this.classList.remove("searx_overpass_request");var t="https://overpass-api.de/api/interpreter?data=";var n=t+"[out:json][timeout:25];(";var i=");out meta;";var r=this.dataset.osmId;var a=this.dataset.osmType;var o=c.querySelector("#"+this.dataset.resultTable);var s=c.querySelector("#"+this.dataset.resultTableLoadicon);var l=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(r&&a&&o){var u=null;switch(a){case"node":u=n+"node("+r+");"+i;break;case"way":u=n+"way("+r+");"+i;break;case"relation":u=n+"relation("+r+");"+i;break;default:break}if(u){v.http("GET",u).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||l.indexOf(r)==-1){i+=""+r+"";switch(r){case"phone":case"fax":i+=''+n.tags[r]+"";break;case"email":i+=''+n.tags[r]+"";break;case"website":case"url":i+=''+n.tags[r]+"";break;case"wikidata":i+=''+n.tags[r]+"";break;case"wikipedia":if(n.tags[r].indexOf(":")!=-1){i+=''+n.tags[r]+"";break}default:i+=n.tags[r];break}i+=""}}s.parentNode.removeChild(s);o.classList.remove("invisible");o.querySelector("tbody").innerHTML=i}}).catch(function(){s.classList.remove("invisible");s.innerHTML=could_not_load})}}e.preventDefault()});v.on(".searx_init_map","click",function(e){this.classList.remove("searx_init_map");var d=this.dataset.leafletTarget;var f=parseFloat(this.dataset.mapLon);var p=parseFloat(this.dataset.mapLat);var h=parseFloat(this.dataset.mapZoom);var m=JSON.parse(this.dataset.mapBoundingbox);var g=JSON.parse(this.dataset.mapGeojson);v.loadStyle("leaflet/leaflet.css");v.loadScript("leaflet/leaflet.js",function(){var e=null;if(m){var t=L.latLng(m[0],m[2]);var n=L.latLng(m[1],m[3]);e=L.latLngBounds(t,n)}var i=L.map(d);var r="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";var a='Map data © OpenStreetMap contributors';var o=new L.TileLayer(r,{minZoom:1,maxZoom:19,attribution:a});var s="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png";var l='Wikimedia maps beta | Maps data © OpenStreetMap contributors';var u=new L.TileLayer(s,{minZoom:1,maxZoom:19,attribution:l});if(e){setTimeout(function(){i.fitBounds(e,{maxZoom:17})},0)}else if(f&&p){if(h){i.setView(new L.latLng(p,f),h)}else{i.setView(new L.latLng(p,f),8)}}i.addLayer(o);var c={"OSM Mapnik":o};L.control.layers(c).addTo(i);if(g){L.geoJson(g).addTo(i)}});e.preventDefault()})})})(window,document,window.searx);(function(e,o,t){"use strict";t.ready(function(){t.image_thumbnail_layout=new t.ImageLayout("#urls","#urls .result-images","img.image_thumbnail",200);t.image_thumbnail_layout.watch();t.on(".btn-collapse","click",function(e){var t=this.getAttribute("data-btn-text-collapsed");var n=this.getAttribute("data-btn-text-not-collapsed");var i=this.getAttribute("data-target");var r=o.querySelector(i);var a=this.innerHTML;if(this.classList.contains("collapsed")){a=a.replace(t,n)}else{a=a.replace(n,t)}this.innerHTML=a;this.classList.toggle("collapsed");r.classList.toggle("invisible")});t.on(".media-loader","click",function(e){var t=this.getAttribute("data-target");var n=o.querySelector(t+" > iframe");var i=n.getAttribute("src");if(i===null||i===undefined||i===false){n.setAttribute("src",n.getAttribute("data-src"))}});e.addEventListener("scroll",function(){var e=o.getElementById("backToTop"),t=document.documentElement.scrollTop||document.body.scrollTop;if(e!==null){if(t>=200){e.style.opacity=1}else{e.style.opacity=0}}})})})(window,document,window.searx);(function(t,i,n){"use strict";var r=true,a="q",o;function s(e){if(e.setSelectionRange){var t=e.value.length;e.setSelectionRange(t,t)}}function l(){if(o.value.length>0){var e=document.getElementById("search");setTimeout(e.submit.bind(e),0)}}function u(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(){o=i.getElementById(a);function e(e){if(r){s(o);r=false}else{}}if(o!==null){u(o);if(n.autocompleter){n.autocomplete=AutoComplete.call(t,{Url:"./autocompleter",EmptyMessage:n.no_item_found,HttpMethod:n.method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:4,Delay:300},"#"+a);t.addEventListener("resize",function(){var e=new CustomEvent("position");o.dispatchEvent(e)})}o.addEventListener("focus",e,false);o.focus()}if(o!==null&&n.search_on_category_select){i.querySelector(".help").className="invisible";n.on("#categories input","change",function(e){var t,n=i.querySelectorAll('#categories input[type="checkbox"]');for(t=0;t0&&i.naturalHeight>0){n+=i.naturalWidth/i.naturalHeight}else{n+=1}}return t/n};e.prototype._setSize=function(e,t){var n,i,r=e.length;for(var a=0;a0&&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"}};e.prototype._alignImgs=function(e){var t,n,i=c.querySelector(this.container_selector).clientWidth;e:while(e.length>0){for(var r=1;r<=e.length;r++){t=e.slice(0,r);n=this._getHeigth(t,i);if(n0){this._alignImgs(a);a=[]}a.push(r.querySelector(this.img_selector));i=r}if(a.length>0){this._alignImgs(a)}};e.prototype.watch=function(){var e,t,n,i,r=this,a=c.querySelectorAll(this.results_selector),o=a.length;function s(e){r.align()}function l(e){if(r._alignAllDone){r._alignAllDone=false;setTimeout(function(){r.align();r._alignAllDone=true},100)}}u.addEventListener("resize",l);u.addEventListener("pageshow",s);for(e=0;ea){break}}break;case"down":i=t.nextElementSibling;if(i===null){i=r[0]}break;case"up":i=t.previousElementSibling;if(i===null){i=r[r.length-1]}break;case"bottom":i=r[r.length-1];break;case"top":default:i=r[0]}}if(i){t.removeAttribute("data-vim-selected");i.setAttribute("data-vim-selected","true");var c=i.querySelector("h3 a")||i.querySelector("a");if(c!==null){c.focus()}if(!e){f()}}}}function e(){document.location.reload(true)}function t(){if(document.activeElement){document.activeElement.blur()}}function i(t){return function(){var e=$('div#pagination button[type="submit"]');if(e.length!==2){console.log("page navigation with this theme is not supported");return}if(t>=0&&ti-a){window.scroll(window.scrollX,i-a)}else{var o=t+n;if(o"}a+="";a+="

"+s[0].cat+"

";a+='
    ';for(var c in s){a+="
  • "+s[c].key+" "+s[c].des+"
  • "}a+="
";a+="";if(!u||l){a+=""}}a+="";e.innerHTML=a}function u(){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%";l(e);var t=document.getElementsByTagName("body")[0];t.appendChild(e)}else{e.classList.toggle("invisible");return}}});(function(e,c,v){"use strict";v.ready(function(){v.on(".searx_overpass_request","click",function(e){this.classList.remove("searx_overpass_request");var t="https://overpass-api.de/api/interpreter?data=";var n=t+"[out:json][timeout:25];(";var i=");out meta;";var r=this.dataset.osmId;var a=this.dataset.osmType;var o=c.querySelector("#"+this.dataset.resultTable);var s=c.querySelector("#"+this.dataset.resultTableLoadicon);var l=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(r&&a&&o){var u=null;switch(a){case"node":u=n+"node("+r+");"+i;break;case"way":u=n+"way("+r+");"+i;break;case"relation":u=n+"relation("+r+");"+i;break;default:break}if(u){v.http("GET",u).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||l.indexOf(r)==-1){i+=""+r+"";switch(r){case"phone":case"fax":i+=''+n.tags[r]+"";break;case"email":i+=''+n.tags[r]+"";break;case"website":case"url":i+=''+n.tags[r]+"";break;case"wikidata":i+=''+n.tags[r]+"";break;case"wikipedia":if(n.tags[r].indexOf(":")!=-1){i+=''+n.tags[r]+"";break}default:i+=n.tags[r];break}i+=""}}s.parentNode.removeChild(s);o.classList.remove("invisible");o.querySelector("tbody").innerHTML=i}}).catch(function(){s.classList.remove("invisible");s.innerHTML=could_not_load})}}e.preventDefault()});v.on(".searx_init_map","click",function(e){this.classList.remove("searx_init_map");var d=this.dataset.leafletTarget;var f=parseFloat(this.dataset.mapLon);var p=parseFloat(this.dataset.mapLat);var h=parseFloat(this.dataset.mapZoom);var m=JSON.parse(this.dataset.mapBoundingbox);var g=JSON.parse(this.dataset.mapGeojson);v.loadStyle("leaflet/leaflet.css");v.loadScript("leaflet/leaflet.js",function(){var e=null;if(m){var t=L.latLng(m[0],m[2]);var n=L.latLng(m[1],m[3]);e=L.latLngBounds(t,n)}var i=L.map(d);var r="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";var a='Map data © OpenStreetMap contributors';var o=new L.TileLayer(r,{minZoom:1,maxZoom:19,attribution:a});var s="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png";var l='Wikimedia maps beta | Maps data © OpenStreetMap contributors';var u=new L.TileLayer(s,{minZoom:1,maxZoom:19,attribution:l});if(e){setTimeout(function(){i.fitBounds(e,{maxZoom:17})},0)}else if(f&&p){if(h){i.setView(new L.latLng(p,f),h)}else{i.setView(new L.latLng(p,f),8)}}i.addLayer(o);var c={"OSM Mapnik":o};L.control.layers(c).addTo(i);if(g){L.geoJson(g).addTo(i)}});e.preventDefault()})})})(window,document,window.searx);(function(e,o,t){"use strict";t.ready(function(){t.image_thumbnail_layout=new t.ImageLayout("#urls","#urls .result-images","img.image_thumbnail",200);t.image_thumbnail_layout.watch();t.on(".btn-collapse","click",function(e){var t=this.getAttribute("data-btn-text-collapsed");var n=this.getAttribute("data-btn-text-not-collapsed");var i=this.getAttribute("data-target");var r=o.querySelector(i);var a=this.innerHTML;if(this.classList.contains("collapsed")){a=a.replace(t,n)}else{a=a.replace(n,t)}this.innerHTML=a;this.classList.toggle("collapsed");r.classList.toggle("invisible")});t.on(".media-loader","click",function(e){var t=this.getAttribute("data-target");var n=o.querySelector(t+" > iframe");var i=n.getAttribute("src");if(i===null||i===undefined||i===false){n.setAttribute("src",n.getAttribute("data-src"))}});e.addEventListener("scroll",function(){var e=o.getElementById("backToTop"),t=document.documentElement.scrollTop||document.body.scrollTop;if(e!==null){if(t>=200){e.style.opacity=1}else{e.style.opacity=0}}})})})(window,document,window.searx);(function(t,i,n){"use strict";var r=true,a="q",o;function s(e){if(e.setSelectionRange){var t=e.value.length;e.setSelectionRange(t,t)}}function l(){if(o.value.length>0){var e=document.getElementById("search");setTimeout(e.submit.bind(e),0)}}function u(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(){o=i.getElementById(a);function e(e){if(r){s(o);r=false}else{}}if(o!==null){u(o);if(n.autocompleter){n.autocomplete=AutoComplete.call(t,{Url:"./autocompleter",EmptyMessage:n.translations.no_item_found,HttpMethod:n.method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:4,Delay:300},"#"+a);t.addEventListener("resize",function(){var e=new CustomEvent("position");o.dispatchEvent(e)})}o.addEventListener("focus",e,false);o.focus()}if(o!==null&&n.search_on_category_select){i.querySelector(".help").className="invisible";n.on("#categories input","change",function(e){var t,n=i.querySelectorAll('#categories input[type="checkbox"]');for(t=0;t {% block meta %}{% endblock %} - {% block title %}{% endblock %}{{ instance_name }} {% if preferences.get_value('oscar-style') -%} @@ -99,7 +98,8 @@ + data-autocompleter="{% if autocomplete %}true{% else %}false{% endif %}" + data-translations="{{ translations }}"> {% for script in scripts %} {{""}} {% endfor %} diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index a7255e672..17c9785e7 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -12,7 +12,6 @@ {% block title %}{% endblock %}{{ instance_name }} {% block meta %}{% endblock %} - {% if rtl %} {% else %} @@ -26,7 +25,7 @@ data-search-on-category-select="{{ 'true' if 'plugins/js/search_on_category_select.js' in scripts else 'false'}}" data-infinite-scroll="{{ 'true' if 'plugins/js/infinite_scroll.js' in scripts else 'false' }}" data-static-path="{{ url_for('static', filename='themes/simple') }}/" - data-no-item-found="{{ _('No item found') }}"> + data-translations="{{ translations }}"> {% block head %} diff --git a/searx/webapp.py b/searx/webapp.py index 062077292..6f0297a99 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -362,6 +362,15 @@ def image_proxify(url): urlencode(dict(url=url.encode(), h=h))) +def get_translations(): + return { + # when overpass AJAX request fails (on a map result) + 'could_not_load': gettext('could not load data'), + # when there is autocompletion + 'no_item_found': gettext('No item found') + } + + def render(template_name, override_theme=None, **kwargs): disabled_engines = request.preferences.engines.get_disabled() @@ -421,6 +430,8 @@ def render(template_name, override_theme=None, **kwargs): kwargs['brand'] = brand + kwargs['translations'] = json.dumps(get_translations(), separators=(',', ':')) + kwargs['scripts'] = set() kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint for plugin in request.user_plugins: @@ -1084,14 +1095,6 @@ def config(): }) -@app.route('/translations.js') -def js_translations(): - return render( - 'translations.js.tpl', - override_theme='__common__', - ), {'Content-Type': 'text/javascript; charset=UTF-8'} - - @app.errorhandler(404) def page_not_found(e): return render('404.html'), 404