User:Kyrasantae/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:Kyrasantae/wikiswapfuncs.js');

// WikiSwap function wikiSwap {

var url = new String; var urlSwitch = new String; var urlGW2 = "http://wiki.guildwars2.com/"; var urlGW = "http://www.guildwiki.org/" ; var urlGWW = "http://wiki.guildwars.com/wiki/" var uri = new Object; var label = new String; var title = new String; getURL(uri); if (uri.thisSite == "GWW") { label = "Switch to GuildWiki"; title = "GWiki"; urlGW = urlGW + uri.pagename; if(uri.pagename.indexOf("Guild:") == -1) { addTab(urlGW, title, "ca-swap", label, ""); } urlGW2 = urlGW2 + uri.pagename; addTab(urlGW2, "GW2W", "ca-swap2", "Switch to GW2W", ""); } if (uri.thisSite == "GWIKI") { label = "Switch to GWW"; title = "GWW"; urlGWW = urlGWW + uri.pagename; addTab(urlGWW, title, "ca-swap", label, ""); urlGW2 = urlGW2 + uri.pagename; addTab(urlGW2, "GW2W", "ca-swap2", "Switch to GW2W", ""); } if (uri.thisSite == "GW2W") { urlGWW = urlGWW + uri.pagename; addTab(urlGWW, "GWW", "ca-swap", label, ""); urlGW = urlGW + uri.pagename; addTab(urlGW, "GWiki", "ca-swap2", "Switch to GW2W", ""); } }

addOnloadHook(wikiSwap);