X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/e8ac6bd5d918bb71647c05da4b2b294a1423948b..2f076d8f349837751e701d9c948414abc7ddeeaf:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index dff433a8a..d57b76b28 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -134,7 +134,21 @@ $(document).ready(function () { $('.leaflet-control .control-button').tooltip({placement: 'left', container: 'body'}); - map.on('moveend layeradd layerremove', updateLocation); + map.on('moveend layeradd layerremove', function() { + updatelinks( + map.getCenter().wrap(), + map.getZoom(), + map.getLayersCode(), + map.getBounds().wrap(), + map._object); + + var expiry = new Date(); + expiry.setYear(expiry.getFullYear() + 10); + $.cookie("_osm_location", cookieContent(map), { expires: expiry }); + + // Trigger hash update on layer changes. + map.hash.onMapMove(); + }); if (OSM.PIWIK) { map.on('layeradd', function (e) { @@ -158,14 +172,6 @@ $(document).ready(function () { } } - if (params.box) { - L.rectangle(params.box, { - weight: 2, - color: '#e90', - fillOpacity: 0 - }).addTo(map); - } - if (params.marker) { marker.setLatLng([params.mlat, params.mlon]).addTo(map); } @@ -214,17 +220,3 @@ $(document).ready(function () { if ('undefined' !== typeof initializeChangesets) initializeChangesets(map); }); - -function updateLocation() { - updatelinks(this.getCenter().wrap(), - this.getZoom(), - this.getLayersCode(), - this.getBounds().wrap()); - - var expiry = new Date(); - expiry.setYear(expiry.getFullYear() + 10); - $.cookie("_osm_location", cookieContent(this), { expires: expiry }); - - // Trigger hash update on layer changes. - this.hash.onMapMove(); -}