-
-
- function setShortlink() {
- var base = link.href.split('?')[0],
- qs = link.href.split('?')[1],
- args = querystring.parse(qs),
- code = makeShortCode(lat, lon, zoom),
- 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 = prefix + "/go/" + code + '?' + querystring.stringify(args);
- } else {
- this.href = prefix + "/go/" + code;
- }
- }