User:Nicwolff/common.js

var gmaps = "//www.google.com/maps/preview#!q=";

function coordsToGmaps{ var anchors = document.getElementsByClassName('external'); var i = anchors.length; while ( i-- ) { var a = anchors[i]; if ( a.href.match( /geohack/ ) ) { var geodec = a.querySelectorAll('.geo-dec'); var latlong = geodec[0].textContent; a.href=gmaps+latlong; }	} }

window.onload = function { coordsToGmaps; }