X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0f799186abfb97b2d3b056f9bc76996a87aa6fd8..9b2791fdd968a39c2d424f74a714ade96bc460a8:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index a044937fc..d1adaeff3 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -24,15 +24,20 @@ $(document).ready(function () { map.hash = L.hash(map); - $(window).on('popstate', function() { - map.hash.update(); + $(window).on('popstate', function(e) { + // popstate is triggered when the hash changes as well as on actual navigation + // events. We want to update the hash on the latter and not the former. + if (e.originalEvent.state) { + map.hash.update(); + } }); var copyright = I18n.t('javascripts.map.copyright', {copyright_url: '/copyright'}); + var donate = I18n.t('javascripts.map.donate_link_text', {donate_url: 'http://donate.openstreetmap.org'}); var layers = [ new L.OSM.Mapnik({ - attribution: copyright, + attribution: copyright+" – "+donate, code: "M", keyid: "mapnik", name: I18n.t("javascripts.map.base.standard") @@ -308,4 +313,5 @@ $(document).ready(function () { map.getCenter().lat.toFixed(precision) + "," + map.getCenter().lng.toFixed(precision))); }); + });