跳转到内容

User:Qinyongr/bhighlight.js:修订间差异

计算器百科,非营利的计算器专业知识百科。
Qinyongr留言 | 贡献
 
Qinyongr留言 | 贡献
| 此編輯使用Wikiplus
 
第1行: 第1行:
/* #REDIRECT */mw.loader.load("https://calcwiki.org/index.php?title=MediaWiki:Gadget-BHighlight.js\u0026action=raw\u0026ctype=text/javascript");
;(function($){
$.getJSON( mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=MediaWiki:Gadget-BList.js', function(data){
$(function(){
function highlightEE_inner(n,h)
{
  if (n.nodeType!=1||n.tagName.toLowerCase()!="a") return 0;
  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;
  var u=decodeURIComponent(n.href).split(h)[1];
  if(data[u.split("_").join(" ")]==1)
  {
    n.style.backgroundColor="#FFF478";
    if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
    else n.className+="userhighlighter_sysop";
  }
  return 1;
}
function highlightEE(n)
{
  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:用户贡献")) n=n.nextSibling;
    else
    {
      if(n.firstChild!==null) highlightEE(n.firstChild);
      n=n.nextSibling;
    }
  }
}
highlightEE(document.getElementById('bodyContent'));
});
});
}(jQuery));

2016年5月31日 (二) 09:16的最新版本

;(function($){
	$.getJSON( mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=MediaWiki:Gadget-BList.js', function(data){
		$(function(){
			function highlightEE_inner(n,h) 
			{
			  if (n.nodeType!=1||n.tagName.toLowerCase()!="a") return 0; 
			  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; 
			  var u=decodeURIComponent(n.href).split(h)[1];
			  if(data[u.split("_").join(" ")]==1)
			  {
			    n.style.backgroundColor="#FFF478";
			    if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
			    else n.className+="userhighlighter_sysop";
			  }
			  return 1;
			}
			 
			function highlightEE(n) 
			{
			  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:用户贡献")) n=n.nextSibling;
			    else
			    {
			      if(n.firstChild!==null) highlightEE(n.firstChild);
			      n=n.nextSibling;
			    }
			  }
			}
			
			highlightEE(document.getElementById('bodyContent'));			
		});	
	});
}(jQuery));