+function updateLocation() {
+ updatelinks(this.getCenter().wrap(),
+ this.getZoom(),
+ this.getLayersCode(),
+ this.getBounds().wrap());
+
+ var expiry = new Date();
+ expiry.setYear(expiry.getFullYear() + 10);
+ $.cookie("_osm_location", cookieContent(this), { expires: expiry });
+
+ // Trigger hash update on layer changes.
+ this.hash.onMapMove();
+}
+
+function setPositionLink(map) {
+ return function(e) {
+ var data = $(this).data(),
+ center = L.latLng(data.lat, data.lon);
+
+ if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
+ map.fitBounds([[data.minLat, data.minLon],
+ [data.maxLat, data.maxLon]]);
+ } else {
+ map.setView(center, data.zoom);
+ }
+
+ if (data.type && data.id) {
+ addObjectToMap(data, map, { zoom: true, style: { opacity: 0.2, fill: false } });
+ }