-function updatelinks(loc, zoom, layers, bounds, object) {
- var precision = zoomPrecision(zoom);
- bounds = normalBounds(bounds);
-
- var lat = loc.lat.toFixed(precision),
- lon = (loc.lon || loc.lng).toFixed(precision);
-
- if (bounds) {
- var minlon = bounds.getWest().toFixed(precision),
- minlat = bounds.getSouth().toFixed(precision),
- maxlon = bounds.getEast().toFixed(precision),
- maxlat = bounds.getNorth().toFixed(precision);
- }
-
- $(".geolink").each(setGeolink);
-
- function setGeolink(index, link) {
- var base = link.href.split('?')[0],
- qs = link.href.split('?')[1],
- args = querystring.parse(qs);
-
- if ($(link).hasClass("llz")) {
- $.extend(args, {
- lat: lat,
- lon: lon,
- zoom: zoom
- });
- } else if (minlon && $(link).hasClass("bbox")) {
- $.extend(args, {
- bbox: minlon + "," + minlat + "," + maxlon + "," + maxlat
- });
- }
+function updatelinks(loc, zoom, layers, object) {
+ $(".geolink").each(function(index, link) {
+ var href = link.href.split(/[?#]/)[0],
+ args = querystring.parse(link.search.substring(1)),
+ editlink = $(link).hasClass("editlink");
+
+ if (object && editlink) args[object.type] = object.id;
+
+ var query = querystring.stringify(args);
+ if (query) href += '?' + query;