Skip to content

Instantly share code, notes, and snippets.

@kionay
Last active April 1, 2016 19:13
Show Gist options
  • Save kionay/b66cc7bd46bfcc270f1a5a74d89fe939 to your computer and use it in GitHub Desktop.
Save kionay/b66cc7bd46bfcc270f1a5a74d89fe939 to your computer and use it in GitHub Desktop.
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);
@kionay
Copy link
Author

kionay commented Apr 1, 2016

Whoops, copy pasted the wrong thing.

@kionay
Copy link
Author

kionay commented Apr 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment