Advertisement
Guest User

z3d-web

a guest
Oct 18th, 2011
86
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
  8. // ==/UserScript==
  9. /**
  10.  * Substitute Colors
  11.  */
  12. var colors = {
  13.     'me': 'dodgerblue',
  14.     'admin': 'green',
  15.     'quote': 'seagreen'
  16. };
  17. var patterns = {
  18.     'me': 'geekounet85',
  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 if a moderator quoted 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');
  44.     if(link.length) {
  45.         if(link[0].firstChild.data.search(patterns['me'])) {
  46.             quotes[i].style.backgroundColor = colors['me'];
  47.         }
  48.         if(link[0].firstChild.data.search(patterns['admin'])) {
  49.             quotes[i].style.backgroundColor = colors['quote'];
  50.         }
  51.     }
  52. }
  53.  
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement