Skip to content

Instantly share code, notes, and snippets.

@kjmehta01
Last active August 29, 2015 14:26
Show Gist options
  • Save kjmehta01/ff5132ae5870634e03c3 to your computer and use it in GitHub Desktop.
Save kjmehta01/ff5132ae5870634e03c3 to your computer and use it in GitHub Desktop.
Reads the seconds every 10 seconds in Tagpro
// ==UserScript==
// @name Tagpro Seconds Off The Clock
// @namespace reddit.com/u/kunmeh13
// @version 0.1
// @include http://tagpro-*.koalabeast.com:*
// @include http://tangent.jukejuice.com:*
// @include http://*.newcompte.fr:*
// @description Says the seconds out loud
// @author Acid Rap(/u/kunmeh13)
// ==/UserScript==
var now = new Date();
//var game = tagpro.gameEndsAt;
setInterval(function(){
var secs = now.getSeconds();
var endsecs = tagpro.gameEndsAt.getSeconds();
var result = endsecs - secs;
//60/0 seconds
if(result === 0){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("60"));
}
//10 seconds
if(result === 10 || result === -50){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("10"));
}
//20 seconds
if(result === 20 || result === -40){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("20"));
}
//30 seconds
if(result === 30 || result === -30){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("30"));
}
//40 seconds
if(result === 40 || result === -20){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("40"));
}
//50 seconds
if(result === 50 || result === -10){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("50"));
}
},1000);
/*
tagpro.ready(function () {
while(true){
var secs = now.getSeconds();
var endsecs = game.getSeconds();
var result = endsecs - secs;
if(result === 0){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("60"));
}
if(result === 10 || result === -50){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("10"));
}
if(result === 20 || result === -40){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("20"));
}
if(result === 30 || result === -30){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("30"));
}
if(result === 40 || result === -20){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("40"));
}
if(result === 50 || result === -10){
window.speechSynthesis.speak(new SpeechSynthesisUtterance("50"));
}
}
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment