Last active
November 1, 2016 08:58
-
-
Save xaphere/82d813732450b08942822251759d3cc4 to your computer and use it in GitHub Desktop.
clean up
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
javascript:( | |
function() { | |
/* Settings */ | |
var hours = 0, | |
minutes = 0, | |
seconds = 0; | |
/* End Settings*/ | |
function getPlayButton() { | |
var activeSectionId = document.getElementById("main").getElementsByClassName("active")[0].getAttribute("id"); | |
var panel = document.getElementById(activeSectionId).getElementsByClassName("front").length > 0 | |
? document.getElementById(activeSectionId).getElementsByClassName("front")[0] | |
: document.getElementById(activeSectionId).getElementsByClassName("root")[0]; | |
var frame = panel.childNodes[0]; | |
var buttons = frame.contentDocument.getElementsByClassName("button button-primary button-play"); | |
if(buttons.length <= 0) { | |
buttons = frame.contentDocument.getElementsByClassName("btn btn-small btn-icon btn-primary btn-play"); | |
} | |
return buttons[0]; | |
} | |
function start() { | |
var time = (seconds + (minutes + hours * 60) * 60) * 1000; | |
var interval = setInterval(function () { | |
/* TODO: Show timer to user */ | |
time -= 1000; | |
if(time <= 0) { | |
var button = getPlayButton(); | |
if(button != undefined) { | |
button.click(); | |
} | |
clearInterval(interval); | |
} | |
}, 1000) | |
} | |
start(); | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment