User:Splarka/interwikitools.js

// /* Interwiki link magic stuff.

contentSub insertion options: var IWTsubOff = true; //disable the contentSub interwiki var IWTsubNoScores = true; //replace underscores with spaces var IWTsubEncode = true; //encodeURIComponent the link (instead of raw) var IWTsubBrackets = true; //wrap it in

To do: + edit page popup tool

if(!window.IWTsubOff && wgServer.indexOf('.wikia.com')!=-1) addOnloadHook(contentSubInterwikiLink) function contentSubInterwikiLink { var loc = wgPageName; if(window.IWTsubNoScores) loc = loc.replace(/_/g,' '); if(window.IWTsubEncode) loc = encodeURIComponent(loc); if(wgServer == 'http://www.wikia.com' || wgServer == 'http://wikia.com') { loc = 'w:' + loc; } else { loc = wgServer.replace(/http\:\/\//,'w:c:').replace(/\.wikia\.com/,':') + loc; } if(window.IWTsubBrackets) loc =  + loc + ; if(document.getElementById('contentSub')) { var cs = document.getElementById('contentSub'); try { if(cs.innerHTML != '') loc += ' | ' cs.insertBefore(document.createTextNode(loc),cs.childNodes[0]); } catch(e) { cs.appendChild(document.createTextNode(loc)); } } }

//