MediaWiki:Gadget-HighlightAdmins.js

Bộ sưu tập danh ngôn mở Wikiquote

Sau khi lưu trang này, hãy xóa bộ nhớ đệm của trình duyệt để những thay đổi hiện ra:

Chrome, Firefox, Internet Explorer, Opera: Ctrl+ Shift+R

var adminrights=new Array();
 
//Start of section to update
adminrights['Trần Nguyễn Minh Huy']=1;
//End of section to update
 
//Updating script
$(function(){
  if(location.href.indexOf('//vi.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("//vi.wikiquote.org/wiki/User:")!=-1)
      {
        var u=n.href.split("//vi.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("//vi.wikiquote.org/wiki/User_talk:")!=-1)
      {
        var u=n.href.split("//vi.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;
    }
  }
}
 
$(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&&
     mw.config.get('wgPageName')!="Special:Preferences")
  {
    highlightadmins(document.getElementById('bodyContent').firstChild,
                    document.getElementById('bodyContent'));
  }
});