Skip to content

Instantly share code, notes, and snippets.

@Nyrox
Last active June 29, 2021 08:15
Show Gist options
  • Save Nyrox/edd8456c152a3daeed2f92512929a53e to your computer and use it in GitHub Desktop.
Save Nyrox/edd8456c152a3daeed2f92512929a53e to your computer and use it in GitHub Desktop.
function automate(selector, interval) {
let id;
let on = () => {
if (id) {
console.log(selector + " already automated")
return;
}
id = setInterval(() => {
let e = document.querySelector(selector)
if (e) e.click()
}, interval)
}
let off = () => {
clearInterval(id)
id = null
}
return {
on,
off,
}
}
let automation = {
observe: automate("#observeBtn", 3000),
hunt: automate("#fastHuntContainer a", 60000),
praise: automate("#fastPraiseContainer a", 60000),
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment