User:Peoplelikeyou/common.js: Difference between revisions
Jump to navigation
Jump to search
(Created page with "var adminrights = {}; //Start of section to update adminrights['Abuse filter']=1; //End of section to update //Updating script $( function() { if(location.href==mw.config.get( 'wgServer' )+ mw.config.get( 'wgScript') + "?title=Special:ListUsers&limit=5000&"+ "group=sysop&adminupdate=y") { var h=document.getElementById('bodyContent').innerHTML; var a= []; h=h.split(/\< *li *\>/i); var i=0; while(++i<h.length) { a[h...") |
mNo edit summary |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
//adapted from [[User:ais523/adminrights.js]] | |||
// | |||
// | // This script highlights bluelinks to selected users' userpages or talkpages in bodyContent | ||
/ | var userlist=new Array(); | ||
// | importScript('User:Peoplelikeyou/userlist.js'); | ||
if( | //Highlighting script. Based on [[User:ais523/highlightmyname.js]]. | ||
function highlightusers_inner(n,h) //node, relevant hyperlink fragment | |||
{ | |||
if (n.nodeType!=1||n.tagName.toLowerCase()!="a") return 0; // not an anchor | |||
if (n.href.indexOf(wgScript+"?title="+h) == -1 && | |||
n.href.indexOf(wgArticlePath.split("$1")[0]+h) == -1) return 0; // to the wrong target | |||
var u=n.href.split(h)[1]; | |||
if(userlist[u.split("_").join("%20")]==1) | |||
{ | { | ||
n.style.backgroundColor="#FACDD5"; | |||
} | |||
return 1; | |||
} | |||
function highlightusers(n) //node | |||
{ | |||
while(n!=null) | |||
{ | |||
if(highlightusers_inner(n,"User:")) n=n.nextSibling; | |||
else if(highlightusers_inner(n,"User_talk:")) n=n.nextSibling; | |||
else if(highlightusers_inner(n,"Special:Contributions:")) n=n.nextSibling; | |||
else | |||
{ | { | ||
if(n.firstChild!=null) highlightusers(n.firstChild); | |||
n=n.nextSibling; | |||
} | } | ||
} | } | ||
} | } | ||
$( function() { | $(function() { | ||
highlightusers(document.getElementById('bodyContent')); | |||
}); | }); |
Latest revision as of 01:07, 20 October 2023
//adapted from [[User:ais523/adminrights.js]]
//
// This script highlights bluelinks to selected users' userpages or talkpages in bodyContent
var userlist=new Array();
importScript('User:Peoplelikeyou/userlist.js');
//Highlighting script. Based on [[User:ais523/highlightmyname.js]].
function highlightusers_inner(n,h) //node, relevant hyperlink fragment
{
if (n.nodeType!=1||n.tagName.toLowerCase()!="a") return 0; // not an anchor
if (n.href.indexOf(wgScript+"?title="+h) == -1 &&
n.href.indexOf(wgArticlePath.split("$1")[0]+h) == -1) return 0; // to the wrong target
var u=n.href.split(h)[1];
if(userlist[u.split("_").join("%20")]==1)
{
n.style.backgroundColor="#FACDD5";
}
return 1;
}
function highlightusers(n) //node
{
while(n!=null)
{
if(highlightusers_inner(n,"User:")) n=n.nextSibling;
else if(highlightusers_inner(n,"User_talk:")) n=n.nextSibling;
else if(highlightusers_inner(n,"Special:Contributions:")) n=n.nextSibling;
else
{
if(n.firstChild!=null) highlightusers(n.firstChild);
n=n.nextSibling;
}
}
}
$(function() {
highlightusers(document.getElementById('bodyContent'));
});