]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/application.js
Merge remote-tracking branch 'osmlab/map-ui'
[rails.git] / app / assets / javascripts / application.js
index f5022683b8050fec55c3c346664e835996c566a0..cb670da340d0feaf2fbead39da4086e643afef02 100644 (file)
@@ -5,6 +5,7 @@
 //= require augment
 //= require leaflet
 //= require leaflet.osm
+//= require leaflet.zoom
 //= require leaflet.extend
 //= require leaflet.locationfilter
 //= require i18n/translations
@@ -15,7 +16,6 @@
 //= require menu
 //= require sidebar
 //= require richtext
-//= require resize
 //= require geocoder
 //= require querystring
 
@@ -99,28 +99,29 @@ 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/' : '/go/') +
+          'http://osm.org/go/' : 'http://' + window.location.hostname + '/go/') +
           makeShortCode(map);
 }
 
@@ -130,7 +131,7 @@ function getUrl(map) {
       toZoom = zoomPrecision(zoom);
 
   return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
-          'http://openstreetmap.org/?' : '/?') +
+          'http://openstreetmap.org/?' : 'http://' + window.location.hostname + '/?') +
         querystring.stringify({
             lat: toZoom(center.lat),
             lon: toZoom(center.lng),