]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/site.js
Fixed dumb-arse bug with wrong variable name. Added tag cleanup and checking on nodes...
[rails.git] / public / javascripts / site.js
index c509fc5eff6947b54be040c63144c621b4046ffb..3e28e0c0a059ab0650c48e770aea2a6835121480 100644 (file)
@@ -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 {
@@ -99,10 +102,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;
@@ -223,7 +234,7 @@ function makeShortCode(lat, lon, zoom) {
        str += char_array.charAt(digit);
     }
     for (var i = 0; i < ((zoom + 8) % 3); ++i) {
-       str += "=";
+       str += "-";
     }
     return str;
 }