//= require jquery
//= require jquery_ujs
-//= require jquery.autogrowtextarea
//= require jquery.timers
+//= require jquery.cookie
//= require augment
-//= require openlayers
+//= require leaflet
+//= require leaflet.osm
+//= require leaflet.locationfilter
+//= require leaflet.locate
+//= require leaflet.note
//= require i18n/translations
-//= require globals
+//= require oauth
+//= require osm
//= require piwik
-//= require browse
-//= require export
//= require map
-//= require key
//= require menu
//= require sidebar
+//= require leaflet.share
//= require richtext
+//= require resize
+//= require geocoder
function zoomPrecision(zoom) {
var decimals = Math.pow(10, Math.floor(zoom/3));
* 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,objtype,objid) {
+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);
maxlat = toPrecision(maxlat);
}
- $(".geolink").each(function (index, link) {
+ $(".geolink").each(setGeolink);
+ $("#shortlinkanchor").each(setShortlink);
+
+ function setGeolink(index, link) {
var args = getArgs(link.href);
if ($(link).hasClass("llz")) {
args.layers = layers;
}
- if (objtype && $(link).hasClass("object")) {
- args[objtype] = objid;
+ if (object && $(link).hasClass("object")) {
+ args[object.type] = object.id;
}
var minzoom = $(link).data("minzoom");
$(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);
- });
+ }
- $("#shortlinkanchor").each(function () {
+ 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 (objtype && objid) {
- args[objtype] = objid;
+ if (object) {
+ args[object.type] = object.id;
}
// This is a hack to omit the default mapnik layer from the shortlink.
// ?{node,way,relation}= can be safely omitted from the shortlink
// which encodes lat/lon/zoom. If new URL parameters are added to
// the main slippy map this needs to be changed.
- if (args.layers || args[objtype]) {
+ if (args.layers || object) {
this.href = setArgs(prefix + "/go/" + code, args);
} else {
this.href = prefix + "/go/" + code;
}
- });
+ }
}
/*
var auth_token = $("meta[name=csrf-token]").attr("content");
$("form input[name=authenticity_token]").val(auth_token);
});
-
-/*
- * Enable auto expansion for all text areas
- */
-$(document).ready(function () {
- $("textarea").autoGrow();
-});