What.CD: Highlight Important People

Highlight posts by VIPs, Mods, Alpha and Delta Teamates, Devs, Admins, and SysOps.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @id             highlight-important-people
// @name           What.CD: Highlight Important People
// @namespace      hateradio)))
// @author         hateradio
// @version        1.85
// @description    Highlight posts by VIPs, Mods, Alpha and Delta Teamates, Devs, Admins, and SysOps.
// @homepage       http://userscripts.org/scripts/show/94902
// @include        http*://*what.cd/forums.php*
// @license        Creative Commons
// @updated        May 21 2012
// @since          Jan 17 2011
// @grant          none
// ==/UserScript==

var highlight = {
	xpt : document.evaluate("//tr[contains(@class, 'colhead_dark')]//strong//text()[contains(.,'(')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null),
	snd : function(){ return document.querySelectorAll('table:not(.important_user) .secondary_class') },
	tab : document.querySelectorAll('table.forum_post'),
	reg : /\b(?:VIP|Legend|Moderator|Support|Team|Developer|Administrator|SysOp)\b/,
	txt : 'table.important_user {box-shadow: 0 0 3px 1px magenta !important;}',
	sty : document.createElement('style'),
	nit : function(){
		this.css();
		this.col();
		this.col2();
	},
	css : function(){
		this.sty.type = 'text/css';
		this.sty.textContent = this.txt;
		document.getElementsByTagName('head')[0].appendChild(this.sty);
	},
	col : function(){
		var i = this.xpt.snapshotLength, t;
		while(i--){
			t = this.xpt.snapshotItem(i);
			if(this.reg.test(t.textContent)){
				this.tab[i].className += ' important_user';
			}
		}
	},
	col2 : function(){
		var p = this.snd(), i = p.length;
		while(i--){
			p[i].parentNode.parentNode.parentNode.parentNode.parentNode.className += ' important_user';
		}
	}
};

highlight.nit();