-
- link.href = setArgs(link.href, args);
- }
-
- function setShortlink() {
- var args = getArgs(this.href);
- var code = makeShortCode(lat, lon, zoom);
- var prefix = shortlinkPrefix();
-
- // Add ?{node,way,relation}=id to the arguments
- if (object) {
- args[object.type] = object.id;
- }
-
- // This is a hack to omit the default mapnik layer from the shortlink.
- if (layers && layers != "M") {
- 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
- // which encodes lat/lon/zoom. If new URL parameters are added to
- // the main slippy map this needs to be changed.
- if (args.layers || object) {
- this.href = setArgs(prefix + "/go/" + code, args);
- } else {
- this.href = prefix + "/go/" + code;
- }