* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
-function updatelinks(loc, zoom, layers, object) {
+function updateLinks(loc, zoom, layers, object) {
$(".geolink").each(function(index, link) {
var href = link.href.split(/[?#]/)[0],
args = querystring.parse(link.search.substring(1)),
expiry.setYear(expiry.getFullYear() + 10);
map.on('moveend layeradd layerremove', function() {
- updatelinks(
+ updateLinks(
map.getCenter().wrap(),
map.getZoom(),
map.getLayersCode(),
function markChanged(a) { changesaved=a; }
+ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,object) {
+ updateLinks({ lon: lon, lat: lat }, zoom);
+
+ var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
+ if (hash !== location.hash) {
+ location.replace(hash);
+ }
+ }
+
function doSWF(lat,lon,sc) {
if (sc < 11) sc = 11;
// 700,600 for fixed size, 100%,100% for resizable
if (lat && lon) {
- updatelinks({ lon: lon, lat: lat }, zoom);
+ updateLinks({ lon: lon, lat: lat }, zoom);
}
}
});
var mapMoved = $.throttle(250, function(lon, lat, zoom) {
- updatelinks({ lon: lon, lat: lat }, zoom);
+ updateLinks({ lon: lon, lat: lat }, zoom);
var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
if (hash !== location.hash) {
center = id.map().center(),
llz = { lon: center[0], lat: center[1], zoom: zoom };
- parent.updatelinks(llz, zoom);
+ parent.updateLinks(llz, zoom);
// Manually resolve URL to avoid iframe JS context weirdness.
// http://bl.ocks.org/jfirebaugh/5439412