Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name PCInpact
- // @namespace http://www.w3.org/1999/xhtml
- // @description Format admin block with green and greenlight and our blocks with blue
- // @include http://v5.pcinpact.com/news/*
- // @match http://v5.pcinpact.com/news/*
- // @author geekounet85
- // ==/UserScript==
- /**
- * Substitute Colors
- */
- var colors = {
- 'me': 'dodgerblue',
- 'admin': 'green',
- 'quote': 'seagreen'
- };
- var patterns = {
- 'me': 'geekounet85',
- 'admin': '/((David_L)|(labdam)|(P-A)|(Vincent_H)|(MarcRees)|(NilSanyas)|(Teuf)|(Titia))/i'
- };
- /**
- * Change the background color of the comment if it's moderator.
- */
- var comments = document.getElementsByClassName('commentaire');
- for(var i = 0; i < comments.length; i++)
- {
- if(comments[i].getElementsByClassName('commentaire_entete_team').length) {
- var content = comments[i].getElementsByClassName('commentaire_content');
- if(content.length) {
- content[0].ClassName = 'commentaire_content_team';
- content[0].style.backgroundColor = colors['admin'];
- }
- }
- }
- /**
- * Change the background color of the comment if a moderator quoted me.
- */
- var quotes = document.getElementsByClassName('quote_bloc');
- for(var i = 0; i < quotes.length; i++)
- {
- var link = quotes[i].getElementsByTagName('a');
- if(link.length) {
- if(link[0].firstChild.data.search(patterns['me'])) {
- quotes[i].style.backgroundColor = colors['me'];
- }
- if(link[0].firstChild.data.search(patterns['admin'])) {
- quotes[i].style.backgroundColor = colors['quote'];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement