Last active
April 1, 2016 19:13
-
-
Save kionay/b66cc7bd46bfcc270f1a5a74d89fe939 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var c = "robin--vote-class--"; | |
setInterval(function(){ | |
if(document.getElementsByClassName("robin--flair-class--no-flair")[1].children[1].innerHTML == "Voting will end soon"){ | |
document.getElementsByName("message")[0].value = "Voting will end soon."; | |
} else { | |
var timeLeft = (document.getElementsByClassName("robin--flair-class--no-flair")[1].children[1].innerHTML.substring(33,35)*60) - (Math.abs(new Date(document.getElementsByClassName("robin--flair-class--no-flair")[1].children[0].getAttribute("datetime")) - new Date())/1000); | |
var minutesLeft = Math.floor(timeLeft/60); | |
var secondsLeft = Math.round(timeLeft - minutesLeft * 60); | |
document.getElementsByName("message")[0].value = (minutesLeft < 0)?("Voting will end soon."):(minutesLeft + " minutes and " + secondsLeft + " seconds left. "); | |
} | |
document.getElementsByName("message")[0].value += | |
"Grow: " + document.getElementsByClassName(c+"increase").length.toString() + | |
". Stay: " + document.getElementsByClassName(c+"continue").length.toString() + | |
". Abandon: " + document.getElementsByClassName(c+"abandon").length.toString() + | |
". No Vote: " + document.getElementsByClassName(c+"novote").length.toString() + "."; | |
document.getElementById("robinSendMessage").children[2].click(); | |
}, 180000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had to add in a bit because there is, like, an extra voting buffer time. I just put up default text when the time left is negative.