Community Central
Register
Community Central

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
//<pre><nowiki>
if(wgCanonicalSpecialPageName == 'Contributions' && !window.ContribToolsLoaded) addOnloadHook(contribtools)
var ContribToolsLoaded = true; //prevent duplication

function contribtools() {
  var ug = wgUserGroups.join(' ');
  var cs = document.getElementById('contentSub');
  // poorman contribs type finder. -1 = existing user
  try { 
    var ctype = cs.getElementsByTagName('a')[0].href.indexOf('User_talk');
  } catch(e) {
    var ctype = -1;
  }
  var inputs = document.getElementsByTagName('input');
  var targ;
  for(var i=0;i<inputs.length;i++) { 
    if(inputs[i].name=='target') { 
      targ = inputs[i].value;
      break;
    }
  }
  if(!targ) return

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

  //lookupuser: staff, logged in
  if((ug.indexOf('staff') > -1)&&(ctype==-1)) insertContentSubContribLink('http://www.wikia.com/wiki/Special:LookupUser?&target=' + targ,'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=' + targ,'CheckUser');
    } else {
      insertContentSubContribLink('/wiki/Special:CheckUser?subipusers=OK&ip=' + targ,'CheckUser');
    }
  }

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

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

  //user-rights: staff, logged in
  if((ug.indexOf('staff') > -1)&&(ctype==-1)) insertContentSubContribLink('/wiki/Special:Userrights?load=true&user=' + encodeURIComponent(targ),'UserRights')

  //deleted contribs (button missing for anons): staff/sysop, anon
  if((ug.indexOf('staff') + ug.indexOf('sysop') > -2)&&(ctype!=-1)) insertContentSubContribLink('/wiki/Special:DeletedContributions/' + targ,'DeletedContributions')

  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));
  try {
    cs.insertBefore(icssep,cs.childNodes[cs.childNodes.length-1]);
    cs.insertBefore(ics,cs.childNodes[cs.childNodes.length-1]);
  } catch(e) {
    cs.appendChild(document.createTextNode('(Error: contentSub still empty! Inserting... '));
    cs.appendChild(ics);
  }
}

// Needed to load user rights automagically.
addOnloadHook(checkuserrights);
function checkuserrights() {
  if(queryString('user') && document.uluser) { 
    document.getElementById('username').value = queryString('user');
    if(queryString('load')=='true') document.uluser.ssearchuser.click();
  }
}

function queryString(p) {
  var re = RegExp('[&?]' + p + '=([^&]*)');
  var matches;
  if (matches = re.exec(document.location)) {
    try { 
      return decodeURI(matches[1]);
    } catch (e) {
    }
  }
  return null;
}

//</nowiki></pre>