User:AT/wikiswap.js

function importScript(page, lang) { var url = wgScriptPath + '/index.php?title=' + encodeURIComponent(page.replace(' ','_')) + '&action=raw&ctype=text/javascript&dontcountme=s'; if (lang) url = 'http://' + lang + '.wikipedia.org' + url; var s = document.createElement('script'); s.src = url; s.type='text/javascript'; document.getElementsByTagName('head')[0].appendChild(s); }

//WikiSwap Functions importScript('User:AT/wikiswapfuncs.js');

// WikiSwap function wikiSwap { var url = new String; var uri = new Object; var label = new String; getURL(uri); if (uri.thisSite == "GWW") { url = "http://gw.gamewikis.org/" ; label = "Switch to GuildWiki"; }   if (uri.thisSite == "GWIKI") { url = "http://wiki.guildwars.com/" label = "Switch to GWW"; }   url = url + uri.pagename; if(uri.pagename.indexOf("Guild:") == -1) { addTab(url, "Switch", "ca-swap", label, ""); } }

addOnloadHook(wikiSwap);