Last active
June 29, 2021 08:15
-
-
Save Nyrox/edd8456c152a3daeed2f92512929a53e to your computer and use it in GitHub Desktop.
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
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