X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/de5a225a95125db1a66d6dfbaa3a790db9719c18..c8d4e4eee3835e9b92fe7cb62c22a07fa2f95f5d:/app/assets/javascripts/application.js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0ee6dc880..44858506b 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -5,6 +5,7 @@ //= require augment //= require leaflet //= require leaflet.osm +//= require leaflet.hash //= require leaflet.zoom //= require leaflet.extend //= require leaflet.locationfilter @@ -16,7 +17,6 @@ //= require menu //= require sidebar //= require richtext -//= require resize //= require geocoder //= require querystring @@ -100,28 +100,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); } @@ -131,7 +132,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),