Fix URL updating in Potlatch 1

Potlatch 1 has hard coded calls to updatelinks, so rename the
updatelinks function to updateLinks and add an updatelinks function
using the old style argument list for Potlatch 1 to call.
This commit is contained in:
Tom Hughes 2013-12-01 22:37:04 +00:00
parent a30a29f41a
commit d5a765588f
5 changed files with 14 additions and 5 deletions

View file

@ -58,7 +58,7 @@ function remoteEditHandler(bbox, select) {
* 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)),

View file

@ -144,7 +144,7 @@ $(document).ready(function () {
expiry.setYear(expiry.getFullYear() + 10);
map.on('moveend layeradd layerremove', function() {
updatelinks(
updateLinks(
map.getCenter().wrap(),
map.getZoom(),
map.getLayersCode(),

View file

@ -18,6 +18,15 @@
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;

View file

@ -66,7 +66,7 @@
// 700,600 for fixed size, 100%,100% for resizable
if (lat && lon) {
updatelinks({ lon: lon, lat: lat }, zoom);
updateLinks({ lon: lon, lat: lat }, zoom);
}
}
@ -88,7 +88,7 @@
});
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) {

View file

@ -37,7 +37,7 @@
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