X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3c22a53c931c8f55cea820a0bc3604311aa45100..bf7b2cf38194380c56fbb419ced588a29c27f7b8:/app/assets/javascripts/leaflet.extend.js.erb diff --git a/app/assets/javascripts/leaflet.extend.js.erb b/app/assets/javascripts/leaflet.extend.js.erb index 84ad92920..a50df013e 100644 --- a/app/assets/javascripts/leaflet.extend.js.erb +++ b/app/assets/javascripts/leaflet.extend.js.erb @@ -30,15 +30,21 @@ L.extend(L.Map.prototype, { getUrl: function(marker) { var precision = zoomPrecision(this.getZoom()), - params = { layers: this.getLayersCode() }; + params = {}; if (marker && this.hasLayer(marker)) { params.mlat = marker.getLatLng().lat.toFixed(precision); params.mlon = marker.getLatLng().lng.toFixed(precision); } - return 'http://' + OSM.SERVER_URL + '/?' + querystring.stringify(params) + - OSM.formatHash({lat: this.getCenter().lat, lon: this.getCenter().lng, zoom: this.getZoom()}); + var url = 'http://' + OSM.SERVER_URL + '/', + query = querystring.stringify(params), + hash = OSM.formatHash(this); + + if (query) url += '?' + query; + if (hash) url += hash; + + return url; }, getShortUrl: function(marker) { @@ -87,3 +93,6 @@ L.extend(L.Map.prototype, { }); L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>; + +L.Hash.prototype.parseHash = OSM.parseHash; +L.Hash.prototype.formatHash = OSM.formatHash;