}
}
+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/') +
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(),
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
initializeNotes(map);
});
-function getMapBaseLayerId(map) {
- for (var i in map._layers) { // TODO: map.eachLayer
- var layer = map._layers[i];
- if (layer.options && layer.options.keyid) {
- return layer.options.keyid;
- }
- }
-}
-
-function getMapLayers(map) {
- var layerConfig = '';
- for (var i in map._layers) { // TODO: map.eachLayer
- var layer = map._layers[i];
- if (layer.options && layer.options.code) {
- layerConfig += layer.options.code;
- }
- }
- return layerConfig;
-}
-
-// generate a cookie-safe string of map state
-function cookieContent(map) {
- var center = map.getCenter().wrap();
- return [center.lng, center.lat, map.getZoom(), getMapLayers(map)].join('|');
-}
-
function updateLocation() {
updatelinks(this.getCenter().wrap(),
this.getZoom(),
- getMapLayers(this),
+ this.getLayersCode(),
this.getBounds().wrap(), {});
var expiry = new Date();
}
function update() {
- var center = map.getCenter().wrap();
- var layers = getMapLayers(map);
$input.val(
options.short ? options.getShortUrl(map) : options.getUrl(map)
);