X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b756c5fd6ea4a982a654e07f42c8250c7f7d85fc..d414ffc61a0f6505f1d06e89e8668fa5b49d607e:/app/assets/javascripts/index.js?ds=sidebyside diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index d84b8ae24..525be7e52 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -91,10 +91,6 @@ $(document).ready(function () { map.dataLayer = new L.OSM.DataLayer(null); map.dataLayer.options.code = 'D'; - $("#sidebar").on("opened closed", function () { - map.invalidateSize(); - }); - var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright'; L.OSM.zoom({position: position}) @@ -138,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) { @@ -162,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); } @@ -215,18 +216,6 @@ $(document).ready(function () { initializeExport(map); initializeBrowse(map, params); initializeNotes(map, params); -}); - -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(); -} + if ('undefined' !== typeof initializeChangesets) initializeChangesets(map); +});