Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
var addkmllinks =
{
 config:
 {
  coordurls : new Array ( 
                'http://tools.wikimedia.de/~magnus/geo/geohack.php?',
                'http://www8.brinkster.com/erikbaas/wiki/maps.asp?',
                'http://www.nsesoftware.nl/wiki/maps.asp?' 
              )
 },

 // Check against coordinate urls
 isMaplink : function( url )
 {
  if( typeof(url) != 'string' ) return false;

  with(addkmllinks)
  {
   // for( var key = 0; key < config.coordurls.length; key++ ) {
   for( var key in config.coordurls ) {
    if( url.substr(0,config.coordurls[key].length) == config.coordurls[key] )
     return true;
   }
  }
  
  return false;
 },

 install : function()
 {
  with(addkmllinks)
  {
   var coordnum = 0;
   var len; // cache array length for iterations
   var links = document.getElementsByTagName('a');
   len = links.length;
   for( var key = 0; key < len; key++ )
   {
    link = links[key];
    if( isMaplink(link.href) ) coordnum++;
   } //for

   if( coordnum > 1 )
   {
    var content = document.getElementById('content');

    var el;
    el = document.createElement('a');
    el.href = 'http://suda.co.uk/projects/microformats/geo/get-geo.php?type=kml&uri=' + encodeURIComponent( document.location );
    el.appendChild( document.createTextNode('Export points of interest') );
    content.appendChild(el);
   }

  } //with
 }

}

//
// Hook up installation function
//
addOnloadHook(addkmllinks.install);

//</pre>