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

// WikiSwap function wikiSwap { var url = new String; var urlSwitch = new String; var urlMB = "http://memory-beta.wikia.com/"; var urlMA = "http://memory-alpha.org/" ; var urlSTOW = "http://stowiki.org/" var uri = new Object; var label = new String; var title = new String; getURL(uri); if (uri.thisSite == "STOW") { label = "Switch to Memory Alpha"; title = "MAlpha"; urlMA = urlMA + uri.pagename; if(uri.pagename.indexOf("Guild:") == -1) { addTab(urlMA, title, "ca-swap", label, ""); }     urlMA = urlMB + uri.pagename; addTab(urlMB, "MBeta", "ca-swap2", "Switch to Memory Beta", ""); }   if (uri.thisSite == "MA") { label = "Switch to STO Wiki"; title = "STOW"; urlSTOW = urlSTOW + uri.pagename; addTab(urlGWW, title, "ca-swap", label, ""); urlMB = urlMB + uri.pagename; addTab(urlMB, "MB", "ca-swap2", "Switch to Memory Beta", ""); }   if (uri.thisSite == "MB") { urlGWW = urlSTOW + uri.pagename; addTab(urlSTOW, "STOW", "ca-swap", label, ""); urlMA = urlMA + uri.pagename; addTab(urlMA, "", "ca-swap2", "Switch to Memory Beta", ""); } }

addOnloadHook(wikiSwap);