Add layers code to share link

This commit is contained in:
Tom MacWright 2013-06-13 12:34:25 -04:00 committed by John Firebaugh
parent e96a64ca9c
commit c3cdd4b5d7
3 changed files with 13 additions and 34 deletions

View file

@ -114,6 +114,10 @@ function updatelinks(loc, zoom, layers, bounds, object) {
}
}
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/') +
@ -129,14 +133,11 @@ function getUrl(map) {
querystring.stringify({
lat: center.lat,
lon: center.lng,
zoom: zoom
zoom: zoom,
layers: map.getLayersCode()
});
}
function minZoomAlert() {
alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false;
}
// Called to create a short code for the short link.
function makeShortCode(map) {
var zoom = map.getZoom(),
@ -175,6 +176,12 @@ function makeShortCode(map) {
return str;
}
// generate a cookie-safe string of map state
function cookieContent(map) {
var center = map.getCenter().wrap();
return [center.lng, center.lat, map.getZoom(), map.getLayersCode()].join('|');
}
/*
* Forms which have been cached by rails may have the wrong
* authenticity token, so patch up any forms with the correct