User:Adam660@legacy41957735/monobook.js

importScript('MediaWiki:admin.js');

//This script (User:ais523/highlightmyname.js) highlights all instances of the //logged-in user's username on pages by giving them a bright red background. It only //checks bodyContent, not titles or sidebars. //

var Admin; var ArrayAdmins = ['Adam', 'Axiomist', 'Matt', 'Steve'];

function highlightmyname(n,p) //node, parent node {   for (Admin in ArrayAdmins) {       highlightThisName(n,p,ArrayAdmins[Admin]); } }

function highlightThisName(n,p,name) { var ix; var lcname = name.toLowerCase; var namelen = name.length; // avoid doing same operations over and over while(n!=null) {   if(n.nodeType==3) //text node {     if( (ix = n.data.toLowerCase.indexOf(lcname) ) !=-1 ) {       var t1=ix?document.createTextNode(n.data.substr(0,ix)):null; var t2=document.createTextNode(n.data.substr(ix,namelen)); var t3=ix+namelen==n.data.length?null: document.createTextNode(n.data.substr(ix+namlen)); var s1=document.createElement("SPAN"); s1.style.backgroundColor="#FF0000"; s1.appendChild(t2); var s2=document.createElement("SPAN"); if(t1!=null) s2.appendChild(t1); s2.appendChild(s1); if(t3!=null) s2.appendChild(t3); p.replaceChild(s2,n); if(t3!=null) highlightThisName(t3,s2,name); //find remaining occurences in the new nodes n=s2.nextSibling; }     else n=n.nextSibling; }   else {     if(n.firstChild!=null) highlightThisName(n.firstChild,n,name); n=n.nextSibling; } } }

addOnloadHook(function {   highlightmyname(document.getElementById('bodyContent').firstChild, document.getElementById('bodyContent')); }); // //