From: Ævar Arnfjörð Bjarmason Date: Mon, 29 Jun 2009 09:47:35 +0000 (+0000) Subject: Add B000FTFT (as well as B000FTF) to the list of layers we should X-Git-Tag: live~7426 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/85f317b46e49ca20db53ad4465054e0fbe3fc88e 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. --- 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;