Fix minzoom alert
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 12 Jul 2013 21:07:07 +0000 (14:07 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 18 Jul 2013 17:45:18 +0000 (10:45 -0700)
app/assets/javascripts/application.js

index 336d3eab0b1689b3c04409f05cffa6263bb246a6..cb670da340d0feaf2fbead39da4086e643afef02 100644 (file)
@@ -99,25 +99,26 @@ function updatelinks(loc, zoom, layers, bounds, object) {
 
     var minzoom = $(link).data("minzoom");
     if (minzoom) {
-        var name = link.id.replace(/anchor$/, "");
-        $(link).off("click.minzoom");
-        if (zoom >= minzoom) {
-          $(link).attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
-              .removeClass("disabled");
-        } else {
-          $(link).on("click.minzoom", minZoomAlert)
-              .attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
-              .addClass("disabled");
-        }
+      var name = link.id.replace(/anchor$/, "");
+      $(link).off("click.minzoom");
+      if (zoom >= minzoom) {
+        $(link)
+          .attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
+          .removeClass("disabled");
+      } else {
+        $(link)
+          .attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
+          .addClass("disabled")
+          .on("click.minzoom", function () {
+            alert(I18n.t("javascripts.site." + name + "_zoom_alert"));
+            return false;
+          });
+      }
     }
     link.href = base + '?' + querystring.stringify(args);
   }
 }
 
-function minZoomAlert() {
-    alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false;
-}
-
 function getShortUrl(map) {
   return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
           'http://osm.org/go/' : 'http://' + window.location.hostname + '/go/') +