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:
parent
a30a29f41a
commit
d5a765588f
5 changed files with 14 additions and 5 deletions
|
@ -58,7 +58,7 @@ function remoteEditHandler(bbox, select) {
|
||||||
* Called as the user scrolls/zooms around to maniplate hrefs of the
|
* Called as the user scrolls/zooms around to maniplate hrefs of the
|
||||||
* view tab and various other links
|
* view tab and various other links
|
||||||
*/
|
*/
|
||||||
function updatelinks(loc, zoom, layers, object) {
|
function updateLinks(loc, zoom, layers, object) {
|
||||||
$(".geolink").each(function(index, link) {
|
$(".geolink").each(function(index, link) {
|
||||||
var href = link.href.split(/[?#]/)[0],
|
var href = link.href.split(/[?#]/)[0],
|
||||||
args = querystring.parse(link.search.substring(1)),
|
args = querystring.parse(link.search.substring(1)),
|
||||||
|
|
|
@ -144,7 +144,7 @@ $(document).ready(function () {
|
||||||
expiry.setYear(expiry.getFullYear() + 10);
|
expiry.setYear(expiry.getFullYear() + 10);
|
||||||
|
|
||||||
map.on('moveend layeradd layerremove', function() {
|
map.on('moveend layeradd layerremove', function() {
|
||||||
updatelinks(
|
updateLinks(
|
||||||
map.getCenter().wrap(),
|
map.getCenter().wrap(),
|
||||||
map.getZoom(),
|
map.getZoom(),
|
||||||
map.getLayersCode(),
|
map.getLayersCode(),
|
||||||
|
|
|
@ -18,6 +18,15 @@
|
||||||
|
|
||||||
function markChanged(a) { changesaved=a; }
|
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) {
|
function doSWF(lat,lon,sc) {
|
||||||
if (sc < 11) sc = 11;
|
if (sc < 11) sc = 11;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
// 700,600 for fixed size, 100%,100% for resizable
|
// 700,600 for fixed size, 100%,100% for resizable
|
||||||
|
|
||||||
if (lat && lon) {
|
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) {
|
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 });
|
var hash = OSM.formatHash({ lon: lon, lat: lat, zoom: zoom });
|
||||||
if (hash !== location.hash) {
|
if (hash !== location.hash) {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
center = id.map().center(),
|
center = id.map().center(),
|
||||||
llz = { lon: center[0], lat: center[1], zoom: zoom };
|
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.
|
// Manually resolve URL to avoid iframe JS context weirdness.
|
||||||
// http://bl.ocks.org/jfirebaugh/5439412
|
// http://bl.ocks.org/jfirebaugh/5439412
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue