X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/99775524b35017256203903962990c9dd212dbb4..d414ffc61a0f6505f1d06e89e8668fa5b49d607e:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index ef553f328..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) { @@ -206,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(); -}