initial commit

This commit is contained in:
Andrew Davidson 2018-01-29 05:46:03 -05:00
commit c64f2ce09b

21
randomComment.js Normal file
View file

@ -0,0 +1,21 @@
var li = document.getElementsByTagName("li");
console.log("Found ", li.length, " li tags");
var comments = [];
for (var l = 0; l < li.length - 1; l++) {
if (li[l].classList.contains("comment")) {
if (li[l].classList.contains("comment-author-bernie") == false) {
comments.push(li[l]);
}
}
}
console.log("Found ", comments.length, " comments not by Bernie");
console.log("Choosing winner...");
var winner = comments[Math.floor(Math.random() * comments.length)];
winner.querySelector("article").style.background = "gray";
winner.scrollIntoViewIfNeeded();
// alert("The winner is: ", winnerName);