Last active
April 19, 2022 10:05
-
-
Save KorigamiK/4e04c5c8463084f12abce0d81115ce23 to your computer and use it in GitHub Desktop.
telegram game
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 sleep(ms) { | |
return new Promise((resolve) => setTimeout(resolve, ms)); | |
} | |
(async () => { | |
const restart = document.querySelector("#button_correct"); | |
restart.click(); | |
while (1) { | |
await sleep(500); | |
let expression = | |
document.querySelector("#task_x").textContent.toString() + | |
document.querySelector("#task_op").textContent.toString() + | |
document.querySelector("#task_y").textContent.toString(); | |
expression = expression.trim().replace("–", "-").replace("×", "*"); | |
const answer = document.querySelector("#task_res").textContent; | |
const expected = eval(expression); | |
answer == expected | |
? document.querySelector("#button_correct").click() | |
: document.querySelector("#button_wrong").click(); | |
// break; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment