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.
This commit is contained in:
Ævar Arnfjörð Bjarmason 2009-06-29 09:47:35 +00:00
parent b06f4750e1
commit 85f317b46e

View file

@ -99,10 +99,18 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
args[objtype] = objid; args[objtype] = objid;
} }
// little hack. may the gods of hardcoding please forgive me, or // This is a hack to omit the default mapnik layer (B000FTF) from
// show me the Right way to do it. // the shortlink. B000FTFT is then the "Object" layer which we get
if (layers && (layers != "B000FTF")) { // on /?{node,way,relation}=id
if (layers && (layers != "B000FTF") && (layers != "B000FTFT")) {
args["layers"] = layers; 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); node.href = setArgs(prefix + "/go/" + code, args);
} else { } else {
node.href = prefix + "/go/" + code; node.href = prefix + "/go/" + code;