-/*
- * Called as the user scrolls/zooms around to aniplate hrefs of the
- * view tab and various other links
- */
-function updatelinks(loc, zoom, layers, minlon, minlat, maxlon, maxlat, object) {
- var toPrecision = zoomPrecision(zoom);
- var node;
-
- var lat = toPrecision(loc.lat),
- lon = toPrecision(loc.lon || loc.lng);
-
- if (minlon) {
- minlon = toPrecision(minlon);
- minlat = toPrecision(minlat);
- maxlon = toPrecision(maxlon);
- maxlat = toPrecision(maxlat);
- }
-
- $(".geolink").each(setGeolink);
- $("#shortlinkanchor").each(setShortlink);
-
- function setGeolink(index, link) {
- var args = getArgs(link.href);
-
- if ($(link).hasClass("llz")) {
- args.lat = lat;
- args.lon = lon;
- args.zoom = zoom;
- } else if (minlon && $(link).hasClass("bbox")) {
- args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat;
- }
-
- if (layers && $(link).hasClass("layers")) {
- args.layers = layers;
- }
-
- if (object && $(link).hasClass("object")) {
- args[object.type] = object.id;
- }
-
- 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");
- }
- }
-
- 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);
- var prefix = shortlinkPrefix();
-
- // Add ?{node,way,relation}=id to the arguments
- if (object) {
- args[object.type] = object.id;
- }