Advertisement
geek85

userscript_PCI_color_v5_maj2

Oct 19th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name           PCInpact
  3. // @namespace      http://www.w3.org/1999/xhtml
  4. // @description    Format admin block with green and greenlight and our blocks with blue
  5. // @include        http://v5.pcinpact.com/news/*
  6. // @match          http://v5.pcinpact.com/news/*
  7. // @author         geekounet85 & z3d-web
  8. // ==/UserScript==
  9. /**
  10.  * Substitute Colors
  11.  */
  12. var colors = {
  13.     'me': 'dodgerblue',
  14.     'admin': '#8F0000',
  15.     'admin_quote': '#6F0000'
  16. };
  17. var patterns = {
  18.     'me': /((geekounet85)|(geek85))/i,
  19.     'admin': /((David_L)|(labdam)|(P-A)|(Vincent_H)|(MarcRees)|(NilSanyas)|(Teuf)|(Titia))/i
  20. };
  21.  
  22. /**
  23.  * Change the background color of the comment if it's moderator.
  24.  */
  25. var comments = document.getElementsByClassName('commentaire');
  26. for(var i = 0; i < comments.length; i++)
  27. {
  28.     if(comments[i].getElementsByClassName('commentaire_entete_team').length) {
  29.         var content = comments[i].getElementsByClassName('commentaire_content');
  30.         if(content.length) {
  31.             content[0].ClassName = 'commentaire_content_team';
  32.             content[0].style.backgroundColor = colors['admin'];
  33.         }
  34.     }
  35. }
  36.  
  37. /**
  38.  * Change the background color of the comment of moderator and me.
  39.  */
  40. var quotes = document.getElementsByClassName('quote_bloc');
  41. for(var i = 0; i < quotes.length; i++)
  42. {
  43.     var link = quotes[i].getElementsByTagName('a')[0];
  44.     if(link) {
  45.         var quote=quotes[i].getElementsByClassName('bg_form_commentaires');
  46.         if(link.firstChild.data.search(patterns['me'])>0) {
  47.             quote[0].style.backgroundColor = colors['me'];
  48.         }
  49.         if(link.firstChild.data.search(patterns['admin'])>0) {
  50.             quote[0].style.backgroundColor = colors['admin_quote'];
  51.         }
  52.     }
  53. }
  54.  
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement