User:GW-Ebany Salmonderiel/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:GW-Ebany_Salmonderiel/wikiswapfuncs.js');

// WikiSwap function wikiSwap { var url = new String; var urlSwitch = new String; var urlGW2 = new String; var uri = new Object; var label = new String; var title = new String; getURL(uri); if (uri.thisSite == "GWW") { url = "http://gw.gamewikis.org/" ; label = "Switch to GuildWiki"; title = "GWiki"; }   if (uri.thisSite == "GWIKI") { url = "http://wiki.guildwars.com/" label = "Switch to GWW"; title = "GWW"; }

if (uri.pagename.indexOf("User:GW-") != -1) { uri.pagename.replace(/User:GW-/,"User:"); }

urlSwitch = url + uri.pagename; if(uri.pagename.indexOf("Guild:") == -1) { addTab(urlSwitch, title, "ca-swap", label, ""); }

urlGW2 = "http://wiki.guildwars2.com/" + uri.pagename; addTab(urlGW2, "GW2W", "ca-swap2", "Switch to GW2W", ""); }

addOnloadHook(wikiSwap);