MediaWiki:Gadget-HighlightAdmins.js

From Wikiquote
Jump to: navigation, search

Note: After saving, 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: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Konqueror: Click Reload or press F5
  • Opera: Clear the cache in Tools → Preferences
var adminrights=new Array();
 
//Start of section to update
adminrights['Aphaia']=1;
adminrights['BD2412']=1;
adminrights['Cbrown1023']=1;
adminrights['Cirt']=1;
adminrights['EVula']=1;
adminrights['FloNight']=1;
adminrights['Fys']=1;
adminrights['Iddo999']=1;
adminrights['InvisibleSun']=1;
adminrights['Jaxl']=1;
adminrights['Jeffq']=1;
adminrights['Jni']=1;
adminrights['Jusjih']=1;
adminrights['LrdChaos']=1;
adminrights['MosheZadka']=1;
adminrights['Nanobug']=1;
adminrights['Ningauble']=1;
adminrights['Quadell']=1;
adminrights['Rmhermen']=1;
adminrights['RyanCross']=1;
adminrights['Sketchmoose']=1;
adminrights['UDScott']=1;
adminrights['Ubiquity']=1;
//End of section to update
 
//Updating script
addOnloadHook(function(){
  if(location.href.indexOf('//en.wikiquote.org/w/index.php?title=Special:ListUsers&limit=5000&group=sysop&adminupdate=y') !== -1)
  {
    var h=document.getElementById('bodyContent').innerHTML;
    var a=new Array();
    h=h.split(/\< *li *\>/i);
    var i=0;
    while(++i<h.length)
    {
      a[h[i].split(">")[1].split("<")[0]]=h[i].split(/\< *\/ *li *\>/i)[0];
    }
    for(i in a)
    {
      document.write("adminrights['"+
        encodeURIComponent(i).split("\\").join("\\\\").split("'").join("%27")
                             .split("(").join("%28").split(")").join("%29")
                             .split("!").join("%21").split(",").join("%2C")
                             .split("%3A").join(":")+"']=1;<BR/>");
    }
  }
});
 
//Highlighting script. Based on [[:en:User:ais523/highlightmyname.js]].
 
function highlightadmins(n,p) //node, parent node
{
  while(n!=null)
  {
    if(n.nodeType==1&&n.tagName.toLowerCase()=="a") //anchor
    {
      if(n.href.indexOf("//en.wikiquote.org/wiki/User:")!=-1)
      {
        var u=n.href.split("//en.wikiquote.org/wiki/User:")[1];
        if(adminrights[u.split("_").join("%20")]==1)
        {
          n.style.backgroundColor="#FFFFFF";
          if(n.className==null||n.className=="") n.className="adminrights_admin";
          else n.className+="adminrights_admin";
        }
        n=n.nextSibling;
      }
      else if(n.href.indexOf("//en.wikiquote.org/wiki/User_talk:")!=-1)
      {
        var u=n.href.split("//en.wikiquote.org/wiki/User_talk:")[1];
        if(adminrights[u.split("_").join("%20")]==1)
        {
          n.style.backgroundColor="#BBFFFF";
          if(n.className==null||n.className=="") n.className="adminrights_admin";
          else n.className+="adminrights_admin";
        }
        n=n.nextSibling;
      }
      else
      {
        if(n.firstChild!=null) highlightadmins(n.firstChild,n);
        n=n.nextSibling;
      }
    }
    else
    {
      if(n.firstChild!=null) highlightadmins(n.firstChild,n);
      n=n.nextSibling;
    }
  }
}
 
addOnloadHook(function() {
  if(location.href.indexOf("?adminupdate")==-1&&location.href.indexOf("&adminupdate")==-1&&
     location.href.indexOf("?action=edit")==-1&&location.href.indexOf("?action=submit")==-1&&
     location.href.indexOf("&action=edit")==-1&&location.href.indexOf("&action=submit")==-1&&
     wgPageName!="Special:Preferences")
  {
    highlightadmins(document.getElementById('bodyContent').firstChild,
                    document.getElementById('bodyContent'));
  }
});
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox