summaryrefslogtreecommitdiff
path: root/searx/static/themes/oscar/src
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-05-29 15:22:20 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2021-06-01 17:52:49 +0200
commita89b823f8d273711469cc63622f329598c067a7b (patch)
tree911810573a899caaa0288616c7f534805b53c916 /searx/static/themes/oscar/src
parentee83c99d2b40efaaf4f3e6635e7a43f7731cb128 (diff)
downloadsearxng-a89b823f8d273711469cc63622f329598c067a7b.tar.gz
searxng-a89b823f8d273711469cc63622f329598c067a7b.zip
[mod] remove overpass API call
prepare the code the PR #90
Diffstat (limited to 'searx/static/themes/oscar/src')
-rw-r--r--searx/static/themes/oscar/src/js/leaflet_map.js83
1 files changed, 0 insertions, 83 deletions
diff --git a/searx/static/themes/oscar/src/js/leaflet_map.js b/searx/static/themes/oscar/src/js/leaflet_map.js
index 83364b0c3..08233c42b 100644
--- a/searx/static/themes/oscar/src/js/leaflet_map.js
+++ b/searx/static/themes/oscar/src/js/leaflet_map.js
@@ -16,89 +16,6 @@
*/
$(document).ready(function(){
- $(".searx_overpass_request").on( "click", function( event ) {
- var overpass_url = "https://overpass-api.de/api/interpreter?data=";
- var query_start = overpass_url + "[out:json][timeout:25];(";
- var query_end = ");out meta;";
-
- var osm_id = $(this).data('osm-id');
- var osm_type = $(this).data('osm-type');
- var result_table = $(this).data('result-table');
- var result_table_loadicon = "#" + $(this).data('result-table-loadicon');
-
- // tags which can be ignored
- var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ];
-
- if(osm_id && osm_type && result_table) {
- result_table = "#" + result_table;
- var query = null;
- switch(osm_type) {
- case 'node':
- query = query_start + "node(" + osm_id + ");" + query_end;
- break;
- case 'way':
- query = query_start + "way(" + osm_id + ");" + query_end;
- break;
- case 'relation':
- query = query_start + "relation(" + osm_id + ");" + query_end;
- break;
- default:
- break;
- }
- if(query) {
- //alert(query);
- var ajaxRequest = $.ajax( query )
- .done(function( html) {
- if(html && html.elements && html.elements[0]) {
- var element = html.elements[0];
- var newHtml = $(result_table).html();
- for (var row in element.tags) {
- if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) {
- newHtml += "<tr><td>" + row + "</td><td>";
- switch(row) {
- case "phone":
- case "fax":
- newHtml += "<a href=\"tel:" + element.tags[row].replace(/ /g,'') + "\">" + element.tags[row] + "</a>";
- break;
- case "email":
- newHtml += "<a href=\"mailto:" + element.tags[row] + "\">" + element.tags[row] + "</a>";
- break;
- case "website":
- case "url":
- newHtml += "<a href=\"" + element.tags[row] + "\">" + element.tags[row] + "</a>";
- break;
- case "wikidata":
- newHtml += "<a href=\"https://www.wikidata.org/wiki/" + element.tags[row] + "\">" + element.tags[row] + "</a>";
- break;
- case "wikipedia":
- if(element.tags[row].indexOf(":") != -1) {
- newHtml += "<a href=\"https://" + element.tags[row].substring(0,element.tags[row].indexOf(":")) + ".wikipedia.org/wiki/" + element.tags[row].substring(element.tags[row].indexOf(":")+1) + "\">" + element.tags[row] + "</a>";
- break;
- }
- /* jshint ignore:start */
- default:
- /* jshint ignore:end */
- newHtml += element.tags[row];
- break;
- }
- newHtml += "</td></tr>";
- }
- }
- $(result_table).html(newHtml);
- $(result_table).removeClass('hidden');
- $(result_table_loadicon).addClass('hidden');
- }
- })
- .fail(function() {
- $(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">"+searx.translations.could_not_load+"</p>");
- });
- }
- }
-
- // this event occour only once per element
- $( this ).off( event );
- });
-
$(".searx_init_map").on( "click", function( event ) {
var leaflet_target = $(this).data('leaflet-target');
var map_lon = $(this).data('map-lon');