X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f1a4669c957d29c012466768581c4a801e5029be..1debc147b8c4d9c917d54a279dcf0e2718e0665e:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 39d416ba9..6ea276230 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -1,5 +1,5 @@ //= require_self -//= require leaflet.customzoom +//= require leaflet.sidebar //= require leaflet.locate //= require leaflet.layers //= require leaflet.key @@ -7,7 +7,6 @@ //= require leaflet.share //= require index/browse //= require index/export -//= require index/key //= require index/notes $(document).ready(function () { @@ -56,33 +55,35 @@ $(document).ready(function () { map.invalidateSize(); }); - L.control.customZoom({position: 'topright'}) + L.OSM.zoom({position: 'topright'}) .addTo(map); L.control.locate({position: 'topright'}) .addTo(map); - var uiPane = $('#map-ui')[0]; + var sidebar = L.OSM.sidebar('#map-ui'); L.OSM.layers({ position: 'topright', layers: layers, - uiPane: uiPane + sidebar: sidebar }).addTo(map); L.OSM.key({ position: 'topright', - uiPane: uiPane + sidebar: sidebar }).addTo(map); - L.control.note({ - position: 'topright', - uiPane: uiPane + L.OSM.share({ + getShortUrl: getShortUrl, + getUrl: getUrl, + sidebar: sidebar, + short: true }).addTo(map); - L.control.share({ - getUrl: getShortUrl, - uiPane: uiPane + L.OSM.note({ + position: 'topright', + sidebar: sidebar }).addTo(map); L.control.scale() @@ -162,40 +163,15 @@ $(document).ready(function () { $("#query").focus(); } + initializeExport(map); initializeBrowse(map); initializeNotes(map); }); -function getMapBaseLayerId(map) { - for (var i in map._layers) { // TODO: map.eachLayer - var layer = map._layers[i]; - if (layer.options && layer.options.keyid) { - return layer.options.keyid; - } - } -} - -function getMapLayers(map) { - var layerConfig = ''; - for (var i in map._layers) { // TODO: map.eachLayer - var layer = map._layers[i]; - if (layer.options && layer.options.code) { - layerConfig += layer.options.code; - } - } - return layerConfig; -} - -// generate a cookie-safe string of map state -function cookieContent(map) { - var center = map.getCenter().wrap(); - return [center.lng, center.lat, map.getZoom(), getMapLayers(map)].join('|'); -} - function updateLocation() { updatelinks(this.getCenter().wrap(), this.getZoom(), - getMapLayers(this), + this.getLayersCode(), this.getBounds().wrap(), {}); var expiry = new Date();