X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/9a32033209545a69d60cbd551e6bd975cda64341..fc5261ece50ec10db67fbc0a2a4f975a395c6714:/public/javascripts/site.js diff --git a/public/javascripts/site.js b/public/javascripts/site.js index 59999b8c0..b6566fa81 100644 --- a/public/javascripts/site.js +++ b/public/javascripts/site.js @@ -55,6 +55,9 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj args.lat = lat; args.lon = lon; args.zoom = zoom; + if (objtype && objid) { + args[objtype] = objid; + } node.href = setArgs("/edit", args); node.style.fontStyle = 'normal'; } else { @@ -62,7 +65,7 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj node.style.fontStyle = 'italic'; } } - + node = document.getElementById("historyanchor"); if (node) { if (zoom >= 11) { @@ -72,14 +75,14 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj typeof minlat == "number" && typeof maxlon == "number" && typeof maxlat == "number") { - + minlon = Math.round(minlon * decimals) / decimals; minlat = Math.round(minlat * decimals) / decimals; maxlon = Math.round(maxlon * decimals) / decimals; maxlat = Math.round(maxlat * decimals) / decimals; args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat; } - + node.href = setArgs("/history", args); node.style.fontStyle = 'normal'; } else { @@ -105,6 +108,9 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj if (layers && (layers != "B000FTF") && (layers != "B000FTFT")) { args["layers"] = layers; } + else { + delete args["layers"]; + } // Here we're assuming that all parameters but ?layers= and // ?{node,way,relation}= can be safely omitted from the shortlink @@ -125,7 +131,7 @@ function shortlinkPrefix() { if (window.location.hostname.match(/^www\.openstreetmap\.org/i)) { return "http://osm.org"; } else { - return ""; + return ""; } } @@ -198,12 +204,12 @@ function i18n(string, keys) { for (var key in keys) { var re_key = '\\[\\[' + key + '\\]\\]'; var re = new RegExp(re_key, "g"); - + string = string.replace(re, keys[key]); } - + return string; -} +} function makeShortCode(lat, lon, zoom) { char_array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";