X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/876d5614da5ddd30097bb39bf7191ece4448cc7f..f3519e97819cc5a5e2c2f9931c7d565b8e5227c8:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 5e437c6ec..f4b378ff3 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -161,26 +161,29 @@ $(document).ready(function () { map.getLayersCode(), map._object); - $.removeCookie("_osm_location"); - $.cookie("_osm_location", OSM.locationCookie(map), { expires: expiry, path: "/" }); - }); - - if ($.cookie('_osm_donate2015') === 'hide') { - $('#donate').hide(); - } - - $('#donate .close').on('click', function() { - $('#donate').hide(); - $.cookie("_osm_donate2015", 'hide', { expires: expiry }); + $.removeCookie('_osm_location'); + $.cookie('_osm_location', OSM.locationCookie(map), { expires: expiry, path: '/' }); }); if ($.cookie('_osm_welcome') === 'hide') { $('.welcome').hide(); } - $('.welcome .close').on('click', function() { + $('.welcome .close-wrap').on('click', function() { $('.welcome').hide(); - $.cookie("_osm_welcome", 'hide', { expires: expiry }); + $.cookie('_osm_welcome', 'hide', { expires: expiry, path: '/' }); + }); + + var bannerExpiry = new Date(); + expiry.setYear(expiry.getFullYear() + 1); + + $('#banner .close-wrap').on('click', function(e) { + var cookieId = e.target.id; + $('#banner').hide(); + e.preventDefault(); + if (cookieId) { + $.cookie(cookieId, 'hide', { expires: bannerExpiry, path: '/' }); + } }); if (OSM.PIWIK) { @@ -201,10 +204,8 @@ $(document).ready(function () { map.setView([params.lat, params.lon], params.zoom); } - var marker = L.marker([0, 0], {icon: OSM.getUserIcon()}); - if (params.marker) { - marker.setLatLng([params.mlat, params.mlon]).addTo(map); + L.marker([params.mlat, params.mlon]).addTo(map); } $("#homeanchor").on("click", function(e) { @@ -214,7 +215,7 @@ $(document).ready(function () { center = L.latLng(data.lat, data.lon); map.setView(center, data.zoom); - marker.setLatLng(center).addTo(map); + L.marker(center, {icon: OSM.getUserIcon()}).addTo(map); }); function remoteEditHandler(bbox, object) {