dimanche 1 février 2015

How to colorize all @replies in a Twitter conversation using Javascript?


I'm trying to make a greasemonkey userscript that will work in Twitter conversations

(colorize names,usernames and each 1st @reply).


As a start, I want all text and @replies in the tweets to have the same color (black).

The problem that I have is that, usually @replies in twitter conversations are not black (as the rest of the tweet text -except URLs which I don't mind-) but has some other color.

For example here they are gray.


I want to turn them all into black.


Using Firefox's Inspector, I've noticed in the page source code that:



  • the @ and reply are seperate (the 1st is inside a <s> tag while the 2nd in a <b> tag).

  • they all belong to the same class. I think it's twitter-atreply pretty-link.




So, I've tried this code:



var replies = document.getElementsByClassName('twitter-atreply pretty-link');
for (i = 0; i < replies.length; i++) {
replies[0].style.color = 'black';
}


But, it doesn't work (it doesn't generate any error, neither).

How can I make it work?





Aucun commentaire:

Enregistrer un commentaire