]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Add donation attribution to mapnik layer
[rails.git] / app / assets / javascripts / index.js
index a044937fc1158546bc3f6cff24bac50743bc2f13..1f68c93cb6f8ca39774c616a3993861f9f0fb2d8 100644 (file)
@@ -24,13 +24,24 @@ $(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: donate,
+      code: "M",
+      keyid: "mapnik",
+      name: I18n.t("javascripts.map.base.standard")
+    }),
     new L.OSM.Mapnik({
       attribution: copyright,
       code: "M",
@@ -308,4 +319,5 @@ $(document).ready(function () {
       map.getCenter().lat.toFixed(precision) + "," +
       map.getCenter().lng.toFixed(precision)));
   });
+
 });