}
}
+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/') +
makeShortCode(map);
}
-function minZoomAlert() {
- alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false;
+function getUrl(map) {
+ var center = map.getCenter(),
+ zoom = map.getZoom();
+
+ return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
+ 'http://openstreetmap.org/?' : '/?') +
+ querystring.stringify({
+ lat: center.lat,
+ lon: center.lng,
+ zoom: zoom,
+ layers: map.getLayersCode()
+ });
}
// Called to create a short code for the short link.
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