Skip to content

Instantly share code, notes, and snippets.

@zdunecki
Created July 28, 2022 13:33
Show Gist options
  • Save zdunecki/5e2e3ca300e0d4b35b192e7aefebc7e9 to your computer and use it in GitHub Desktop.
Save zdunecki/5e2e3ca300e0d4b35b192e7aefebc7e9 to your computer and use it in GitHub Desktop.
let timer = null
function unlock(index = 0) {
document.querySelectorAll("form select")[index].removeAttribute("disabled")
document.querySelectorAll("form button")[index].removeAttribute("disabled")
}
function submit(index) {
document.querySelectorAll("form button")[index].click()
}
function job(t = "16:00:00", index = 0) {
const condition = new Date().toLocaleTimeString('pl-PL') >= t
if (condition) {
clearInterval(timer)
unlock(index)
submit(index)
}
}
function doJob(t, index) {
timer = setInterval(() => job(t, index), 100)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment