MediaWiki:RankColor.js: Difference between revisions

Want an adless experience? Log in or Create an account.
no edit summary
mNo edit summary
No edit summary
Line 103: Line 103:
$(function() {
$(function() {
     highlightadmins(document.getElementById('bodyContent').firstChild,
     highlightadmins(document.getElementById('bodyContent').firstChild,
                    document.getElementById('bodyContent'));
});
}
var botrights=new Array();
importScript('MediaWiki:Botlist.js');
//Highlighting script. Based on [[User:ais523/highlightmyname.js]].
function highlightbots(n,p) //node, parent node
{
  while(n!=null)
  {
    if(n.nodeType==1&&n.tagName.toLowerCase()=="a") //anchor
    {
      if(n.href.indexOf("/User:")!=-1)
      {
        var u=n.href.split("/User:")[1];
        if(botrights[u.split("_").join("%20")]==1)
        {
          n.style.color="#78C5C6";
        }
      }
      else if(n.href.indexOf("/index.php?title=User:")!=-1)
      {
        var u=n.href.split("/index.php?title=User:")[1];
        if(botrights[u.split("_").join("%20")]==1)
        {
          n.style.color="#78C5C6";
        }
      }
      else
      {
        if(n.firstChild!=null) highlightbots(n.firstChild,n);
      }
    }
    else
    {
      if(n.firstChild!=null) highlightbots(n.firstChild,n);
    }
    n=n.nextSibling;
  }
}
if (wgCanonicalNamespace == 'Special' || wgAction == 'history' || document.URL.indexOf('diff=') > 0 || document.URL.indexOf('oldid=') > 0)
{
$(function() {
    highlightbots(document.getElementById('bodyContent').firstChild,
                     document.getElementById('bodyContent'));
                     document.getElementById('bodyContent'));
});
});
}
}
//
//