I'm a javascript novice, but am trying to create a simple Chrome browser extension which highlights article text on twitter. This script
function myFunction() {
var myNodelist = document.getElementsByClassName("tweet-text");
for(var i=0; i<myNodelist.length; i++)
myNodelist[i].style.backgroundColor = "red"
}
var x = myFunction();
will grab the article text and highlight it in red (see the attached picture). The problem is, though, that this will only work on the first ~10 posts or so, until the bottom of the screen is reached. When new tweets are dynamically loaded, the script doesn't execute to highlight the new headlines. Can anyone tell me how I can modify this snippet to execute the script every time new text is loaded? Thanks!