* Called as the user scrolls/zooms around to aniplate hrefs of the
* view tab and various other links
*/
-function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,object) {
+function updatelinks(loc, zoom, layers, minlon, minlat, maxlon, maxlat, object) {
var toPrecision = zoomPrecision(zoom);
var node;
- lat = toPrecision(lat);
- lon = toPrecision(lon);
+ var lat = toPrecision(loc.lat),
+ lon = toPrecision(loc.lon || loc.lng);
if (minlon) {
minlon = toPrecision(minlon);
$(link).off("click.minzoom");
if (zoom >= minzoom) {
- $(link).attr("title", I18n.t("javascripts.site." + name + "_tooltip"));
- $(link).removeClass("disabled");
+ $(link).attr("title", I18n.t("javascripts.site." + name + "_tooltip"))
+ .removeClass("disabled");
} else {
- $(link).on("click.minzoom", function () { alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false; });
- $(link).attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"));
- $(link).addClass("disabled");
+ $(link).on("click.minzoom", minZoomAlert)
+ .attr("title", I18n.t("javascripts.site." + name + "_disabled_tooltip"))
+ .addClass("disabled");
}
}
link.href = setArgs(link.href, args);
}
+ function minZoomAlert() {
+ alert(I18n.t("javascripts.site." + name + "_zoom_alert")); return false;
+ }
+
function setShortlink() {
var args = getArgs(this.href);
var code = makeShortCode(lat, lon, zoom);
return remoteEditHandler(bbox);
});
- var centre = bbox.getCenter();
- updatelinks(centre.lng, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
+ updatelinks(map.getCenter(), 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
} else if (params.type == "note") {
var object = {type: params.type, id: params.id};
return remoteEditHandler(bbox);
});
- updatelinks(params.lon, params.lat, 16, null,
+ updatelinks(params, 16, null,
bbox.getWest(), bbox.getSouth(),
bbox.getEast(), bbox.getNorth(),
object);
$("#object_larger_map").show();
$("#object_edit").show();
- var centre = extent.getCenter();
- updatelinks(centre.lng,
- centre.lat,
+ updatelinks(map.getCenter(),
16, null,
extent.getWest(),
extent.getSouth(),
var layers = getMapLayers();
var extents = map.getBounds().wrap();
- updatelinks(center.lng,
- center.lat,
+ updatelinks(center,
zoom,
layers,
extents.getWest(),
// 700,600 for fixed size, 100%,100% for resizable
if (lat && lon) {
- updatelinks(lon, lat, zoom);
+ updatelinks({ lon: lon, lat: lat }, zoom);
}
}
});
function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
- updatelinks(lon, lat, zoom, null, minlon, minlat, maxlon, maxlat);
+ updatelinks({ lon: lon, lat: lat }, zoom, null, minlon, minlat, maxlon, maxlat);
}
</script>
zoom = ~~id.map().zoom(),
center = id.map().center();
- parent.updatelinks(
- center[0],
- center[1],
+ parent.updatelinks({
+ lon: center[0],
+ lat: center[1]
+ },
zoom,
null,
extent[0][0],