From 85f317b46e49ca20db53ad4465054e0fbe3fc88e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 29 Jun 2009 09:47:35 +0000 Subject: [PATCH] Add B000FTFT (as well as B000FTF) to the list of layers we should ignore when constructing the shortlink. The shortlink was also broken for the new /?{node,way,relation}=id construct since the code assumed that all URL parameters that weren't lat/lon/zoom/layers could be safely ignored. I've added node/way/relation to that list but for future-proofness it might be better to simply check if there's anything left in ''args'' that we don't know how to encode, rather than checking on values we know about now. --- public/javascripts/site.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/public/javascripts/site.js b/public/javascripts/site.js index c509fc5ef..b7ad7d7e4 100644 --- a/public/javascripts/site.js +++ b/public/javascripts/site.js @@ -99,10 +99,18 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj args[objtype] = objid; } - // little hack. may the gods of hardcoding please forgive me, or - // show me the Right way to do it. - if (layers && (layers != "B000FTF")) { + // This is a hack to omit the default mapnik layer (B000FTF) from + // the shortlink. B000FTFT is then the "Object" layer which we get + // on /?{node,way,relation}=id + if (layers && (layers != "B000FTF") && (layers != "B000FTFT")) { args["layers"] = layers; + } + + // Here we're assuming that all parameters but ?layers= and + // ?{node,way,relation}= can be safely omitted from the shortlink + // which encodes lat/lon/zoom. If new URL parameters are added to + // the main slippy map this needs to be changed. + if (args["layers"] || args[objtype]) { node.href = setArgs(prefix + "/go/" + code, args); } else { node.href = prefix + "/go/" + code; -- 2.39.5