From: Marc Tobias Metten Date: Thu, 14 Jun 2018 00:19:19 +0000 (+0200) Subject: display viewbox on map X-Git-Tag: v3.2.0~67^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/5a17bfc9c9565a3215f2969182534fedaa6eba07 display viewbox on map --- diff --git a/lib/template/includes/html-footer.php b/lib/template/includes/html-footer.php index e7d78cfa..1929c2d8 100644 --- a/lib/template/includes/html-footer.php +++ b/lib/template/includes/html-footer.php @@ -11,4 +11,5 @@ + diff --git a/website/js/nominatim-ui.js b/website/js/nominatim-ui.js index 64160c84..337ceb25 100644 --- a/website/js/nominatim-ui.js +++ b/website/js/nominatim-ui.js @@ -249,6 +249,14 @@ jQuery(document).ready(function(){ $('form input[name=lon]').val(lat); $('form').submit(); }); + } else { + var search_params = new URLSearchParams(location.search); + var viewbox = search_params.get('viewbox'); + if (viewbox) { + var coords = viewbox.split(','); // ,,, + var bounds = L.latLngBounds([coords[1], coords[0]], [coords[3], coords[2]]); + L.rectangle(bounds, {color: "#69d53e", weight: 3, dashArray: '5 5', opacity: 0.8, fill: false}).addTo(map); + } } highlight_result(0, false); diff --git a/website/js/url-search-params.js b/website/js/url-search-params.js new file mode 100644 index 00000000..21335d21 --- /dev/null +++ b/website/js/url-search-params.js @@ -0,0 +1,2 @@ +/*! (C) Andrea Giammarchi - Mit Style License */ +var URLSearchParams=URLSearchParams||function(){"use strict";function URLSearchParams(query){var index,key,value,pairs,i,length,dict=Object.create(null);this[secret]=dict;if(!query)return;if(typeof query==="string"){if(query.charAt(0)==="?"){query=query.slice(1)}for(pairs=query.split("&"),i=0,length=pairs.length;i