User:Splarka/contribtools.js

// function contribtools { if(wgPageName!="Special:Contributions") return var ug = wgUserGroups.join(' '); var cs = document.getElementById('contentSub'); // poorman contribs type finder. -1 = existing user var ctype = cs.getElementsByTagName('a')[0].href.indexOf('User_talk');

//lookupcontribs: anyone, anyone insertContentSubContribLink('http://www.wikia.com/wiki/Special:Lookupcontribs?mode=normal&view=full&target=' + document.forms[0].target.value.replace(/_/g,'+'),'LookupContribs')

//lookupuser: staff, logged in if((ug.indexOf('staff') > -1)&&(ctype==-1)) insertContentSubContribLink('http://www.wikia.com/wiki/Special:LookupUser?&target=' + document.forms[0].target.value,'LookupUser')

//checkuser: staff/checkuser, logged in/anon if(ug.indexOf('staff') + ug.indexOf('checkuser') > -2) { if(ctype==-1) { insertContentSubContribLink('/wiki/Special:CheckUser?subuser=OK&user=' + document.forms[0].target.value,'CheckUser'); } else { insertContentSubContribLink('/wiki/Special:CheckUser?subipusers=OK&ip=' + document.forms[0].target.value,'CheckUser'); } }

//multilookup (global checkuser): staff, anon if((ug.indexOf('staff') > -1)&&(ctype!=-1)) insertContentSubContribLink('http://www.wikia.com/wiki/Special:MultiLookup?wpIP=' + document.forms[0].target.value,'MultiLookup')

//regexblock: staff, logged in if((ug.indexOf('staff') > -1)&&(ctype==-1)) insertContentSubContribLink('http://www.wikia.com/wiki/Special:Regexblock?wpRegexBlockedReason=' + document.forms[0].target.value,'RegexBlock')

var botlink = document.location.href; if(botlink.indexOf('?')==-1) { insertContentSubContribLink(document.location.href + '?bot=1','&bot=1'); } else { insertContentSubContribLink(document.location.href + '&bot=1','&bot=1'); } }

function insertContentSubContribLink(link,text) { var cs = document.getElementById('contentSub'); var icssep = document.createTextNode(' | '); var ics = document.createElement('a'); ics.href = link; ics.setAttribute('title', ics.href); ics.appendChild(document.createTextNode(text)); cs.insertBefore(icssep,cs.childNodes[cs.childNodes.length-1]); cs.insertBefore(ics,cs.childNodes[cs.childNodes.length-1]); }

if(wgCanonicalSpecialPageName == 'Contributions') addOnloadHook(contribtools) //