What.CD: Highlight Important People

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

  1. // ==UserScript==
  2. // @id highlight-important-people
  3. // @name What.CD: Highlight Important People
  4. // @namespace hateradio)))
  5. // @author hateradio
  6. // @version 1.85
  7. // @description Highlight posts by VIPs, Mods, Alpha and Delta Teamates, Devs, Admins, and SysOps.
  8. // @homepage http://userscripts.org/scripts/show/94902
  9. // @include http*://*what.cd/forums.php*
  10. // @license Creative Commons
  11. // @updated May 21 2012
  12. // @since Jan 17 2011
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. var highlight = {
  17. xpt : document.evaluate("//tr[contains(@class, 'colhead_dark')]//strong//text()[contains(.,'(')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null),
  18. snd : function(){ return document.querySelectorAll('table:not(.important_user) .secondary_class') },
  19. tab : document.querySelectorAll('table.forum_post'),
  20. reg : /\b(?:VIP|Legend|Moderator|Support|Team|Developer|Administrator|SysOp)\b/,
  21. txt : 'table.important_user {box-shadow: 0 0 3px 1px magenta !important;}',
  22. sty : document.createElement('style'),
  23. nit : function(){
  24. this.css();
  25. this.col();
  26. this.col2();
  27. },
  28. css : function(){
  29. this.sty.type = 'text/css';
  30. this.sty.textContent = this.txt;
  31. document.getElementsByTagName('head')[0].appendChild(this.sty);
  32. },
  33. col : function(){
  34. var i = this.xpt.snapshotLength, t;
  35. while(i--){
  36. t = this.xpt.snapshotItem(i);
  37. if(this.reg.test(t.textContent)){
  38. this.tab[i].className += ' important_user';
  39. }
  40. }
  41. },
  42. col2 : function(){
  43. var p = this.snd(), i = p.length;
  44. while(i--){
  45. p[i].parentNode.parentNode.parentNode.parentNode.parentNode.className += ' important_user';
  46. }
  47. }
  48. };
  49.  
  50. highlight.nit();