Closed emka closed 14 years ago
You can do it as the following.
--- map.js~ 2009-09-21 17:16:50.626781981 -0700
+++ map.js 2009-09-21 18:13:53.062781942 -0700
@@ -1,4 +1,5 @@
var map = null;
+var permalink = null;
function init_map(div_id, lon, lat, zoom)
{
@@ -25,7 +26,7 @@
map.setCenter(new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()), zoom);
- map.addControl(new OpenLayers.Control.Permalink());
+ map.addControl(permalink=new OpenLayers.Control.Permalink());
return map;
}
--- openstreetbugs.js~ 2009-09-21 15:06:51.214781947 -0700
+++ openstreetbugs.js 2009-09-21 18:30:41.570782002 -0700
@@ -376,10 +376,12 @@
function refresh_sidebar()
{
- var zoom = map.getZoom();
- coords = map.getCenter();
- var lon = shorter_coord(x2lon(coords.lon));
- var lat = shorter_coord(y2lat(coords.lat));
+ var params = permalink.createParams();
+ var zoom = params.zoom;
+ var lon = params.lon;
+ var lat = params.lat;
+ var layers = params.layers;
+
if (zoom > 10) {
document.getElementById("rsslink").style.display = "list-item";
document.getElementById("rsslink").innerHTML = "<a href='"+osb_server_path+"getRSSfeed?b="+b+"&t="+t+"&l="+l+"&r="+r+"'>RSS feed</a>";
@@ -392,7 +394,7 @@
document.getElementById("gpxlink2").style.display = "none";
document.getElementById("rsslink").style.display = "none";
}
- document.getElementById("permalink").innerHTML = "<a href='?lon="+lon+"&lat="+lat+"&zoom="+zoom+"'>Permalink</a>";
+ document.getElementById("permalink").innerHTML = "<a href='?lon="+lon+"&lat="+lat+"&zoom="+zoom+"&layers="+layers+"'>Permalink</a>";
document.getElementById("geofabrik").innerHTML = "<a href='http://tools.geofabrik.de/map/?lon="+lon+"&lat="+lat+"&zoom="+zoom+"'>Geofabrik Map</a>";
}
Thank you very much!
works at the bottom right corner permalink, but not in the sidebar