X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e8ac6bd5d918bb71647c05da4b2b294a1423948b..d414ffc61a0f6505f1d06e89e8668fa5b49d607e:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index dff433a8a..525be7e52 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -134,7 +134,20 @@ $(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._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 +171,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 +219,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(); -}