User:DarkStarHarry/externMapCoords.js

function externMapCoords { var existingMap = "http://toolserver.org/~geohack/geohack.php"; var magicRegex = /MAGICNUMBER/ig; var theMatchPattern = /[0-9_\-.NEWS]{6,}/; var map_source_URL = "http://maps.google.com/maps?ll=MAGICNUMBER&spn=0.3,0.3&t=m&q=MAGICNUMBER" for (var i = 0; i < document.links.length; i++) {          var theLink = document.links[i].href if(theLink.indexOf(existingMap) > -1) {		var RawRegex = theLink.match(theMatchPattern); var SplitRegex = RawRegex[0].split("_") ; var SplitRegexElements = SplitRegex.length - 1; var MapAddress = 0; var addressTemp = 0; var exponentRaise = 3 for (var k = 0 ; k < SplitRegex.length - 1; k++) { theElement = SplitRegex[k] switch (theElement) {case "E": addressTemp = addressTemp*1; MapAddress = MapAddress + "," + addressTemp addressTemp = 0 exponentRaise = 3 break; case "W": addressTemp = addressTemp *-1 MapAddress = MapAddress + "," + addressTemp addressTemp = 0 exponentRaise = 3 break; case "N": addressTemp = addressTemp *1 MapAddress = addressTemp addressTemp = 0 exponentRaise = 3 break; case "S": addressTemp = addressTemp*-1; MapAddress = addressTemp addressTemp = 0 ; exponentRaise = 3 ; break; default: var denominator = Math.pow(60,exponentRaise)/Math.pow(60,3) var partialTemp = (theElement*1) * denominator; addressTemp = (addressTemp*1) + partialTemp; exponentRaise-- ; break; }				}					document.links[i].href = map_source_URL.replace(/MAGICNUMBER/gi, MapAddress); }   } } addOnloadHook(externMapCoords);