User:Mike Dillon/Scripts/coorGoogleMaps.js

// Requires: User:Mike Dillon/Scripts/params.js

/* */

addOnloadHook(function {    var coor = document.getElementById("coordinates");    if (!coor) return;

var link = getElementsByClassName(coor, "a", "external")[0]; link.target = "_blank"; link.title = null;

var params = getParameter("params", link.href); if (!params) return;

var coorParams = params.split("_"); var latitude = coorParams[0]; var longitude = coorParams[2]; var type = coorParams[4]; if (type) type = type.replace(/^type:/, "");

var spanValues = { "city":    "0.1,0.1", "landmark": "0.01,0.01", };   var spn = spanValues[type]; if (!spn) spn = spanValues["city"];

var url = "http://maps.google.com/maps?" url += "ll=" + latitude + "," + longitude; url += "&spn=" + spn; url += "&t=h";

link.href = url; });

/* */