User:Jasonzhuocn/userhighlighter3.js
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// 源碼來自於 [[User:/userhighlighter.js]] 2015-11-02修改
// Based on [[User:Ais523/adminrights.js]], inner logic taken straight from there.
// Consider using [[User:Theopolisme/Scripts/adminhighlighter.js]] instead, a better version of this script
//
// This script highlights bluelinks to admins' userpages or talkpages in bodyContent (that is, everything but the tabs, personal
// links at the top of the screen and sidebar) by giving them a cyan background.
//
;(function($){
$.getJSON( mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Jasonzhuocn/executiveeditor.js', function(data){
//2015-11-02
$(function(){
function highlightEE_inner(n,h) //node, relevant hyperlink fragment
{
if (n.nodeType!=1||n.tagName.toLowerCase()!="a") return 0; // not an anchor
if (n.href.indexOf(mw.config.get('wgScript')+"?title="+h) == -1 &&
n.href.indexOf(mw.config.get('wgArticlePath').split("$1")[0]+h) == -1) return 0; // to the wrong target
var u=decodeURIComponent(n.href).split(h)[1];
if(data[u.split("_").join(" ")]==1)
{
n.style.backgroundColor="#DCF2E5";
if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
else n.className+="userhighlighter_sysop";
}
return 1;
}
function highlightEE(n) //node
{
while(n!==null)
{
if(highlightEE_inner(n,"User:")) n=n.nextSibling;
else if(highlightEE_inner(n,"User_talk:")) n=n.nextSibling;
else if(highlightEE_inner(n,"Special:Contributions:")) n=n.nextSibling;
else
{
if(n.firstChild!==null) highlightEE(n.firstChild);
n=n.nextSibling;
}
}
}
highlightEE(document.getElementById('bodyContent'));
});
});
}(jQuery));