User:Vicarage/maptab.js

/* Use the mechanism from to add a map tab to each page */

$(function {    if (mw.config.get('wgCanonicalNamespace') == "Special")        return;  // no links for special pages    var title = mw.config.get('wgTitle');    if (mw.config.get('wgCanonicalNamespace') != "") {        title = title.replace(/^.*\//, "");  // subpage name only        var prefix=mw.config.get('wgCanonicalNamespace')+':';    } else {        var prefix='';    }

var article= encodeURIComponent(prefix+title); var titleu = title.replace(/ /g, "_"); var articleu = encodeURIComponent(prefix+titleu); mw.util.addPortletLink('p-cactions',                   'http://maps.google.com/maps?q=http%3A%2F%2Ftoolserver.org%2F%7Epara%2Fcgi-bin%2Fkmlexport%3Farticle%3D'+articleu,                   'Map', 'ca-map', 'Map"'+title+'"', 'M'); /*   mw.util.addPortletLink('p-cactions',                    'http://maps.bing.com/?mapurl=http%3A%2F%2Ftoolserver.org%2F%7Epara%2Fcgi-bin%2Fkmlexport%3Farticle%3D'+article,                   'Bing', 'ca-bing', 'Bing"'+title+'"', 'W'); });