跳转到内容

MediaWiki:Gadget-AGFHighlight.js:修订间差异

计算器百科,非营利的计算器专业知识百科。
Qinyongr留言 | 贡献
创建页面,内容为“//改編自w:zh:User:Jasonzhuocn/userhighlighter2.js ;(function($){ $.getJSON( mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&titl...”
 
Qinyongr留言 | 贡献
无编辑摘要
第11行: 第11行:
  if(data[u.split("_").join(" ")]==1)
  if(data[u.split("_").join(" ")]==1)
  {
  {
    n.style.backgroundColor="#E3E9FF";
    n.style.backgroundColor="#DCF2E5";
    if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
    if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
    else n.className+="userhighlighter_sysop";
    else n.className+="userhighlighter_sysop";

2016年5月2日 (一) 10:00的版本

//改編自[[:w:zh:User:Jasonzhuocn/userhighlighter2.js]]
;(function($){
	$.getJSON( mw.config.get('wgScriptPath')+'/index.php?action=raw&ctype=application/json&title=User:Qinyongr/AGFlist.js', function(data){
		$(function(){
			function highlightautos_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="#DCF2E5";
			    if(n.className===null||n.className==="") n.className="userhighlighter_sysop";
			    else n.className+="userhighlighter_sysop";
			  }
			  return 1;
			}
			 
			function highlightautos(n) 
			{
			  while(n!==null)
			  {
			    if(highlightautos_inner(n,"User:")) n=n.nextSibling;
			    else if(highlightautos_inner(n,"User_talk:")) n=n.nextSibling;
			    else if(highlightautos_inner(n,"Special:Contributions:")) n=n.nextSibling;
			    else
			    {
			      if(n.firstChild!==null) highlightautos(n.firstChild);
			      n=n.nextSibling;
			    }
			  }
			}
			
			highlightautos(document.getElementById('bodyContent'));			
		});	
	});
}(jQuery));