Last active
September 5, 2026 08:50
-
-
Save deyixtan/168fead90b553b3239c77ca87dcb28ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // url: https://arithmetic.zetamac.com/ | |
| // example: solve(1); | |
| const solve = (delay) => { | |
| setInterval(() => { | |
| const startDiv = document.getElementsByClassName("start")[0]; | |
| const leftDiv = document.getElementsByClassName("left")[0]; | |
| const problemSpan = document.getElementsByClassName("problem")[0]; | |
| const answerInput = document.getElementsByClassName("answer")[0]; | |
| const doesStartDivExists = startDiv != undefined && startDiv.style.display != "none"; | |
| const doesLeftDivExists = leftDiv != undefined; | |
| const doesProblemDivExists = problemSpan != undefined; | |
| const doesAnswerDivExists = answerInput != undefined; | |
| if (!doesStartDivExists || !doesLeftDivExists || !doesProblemDivExists || !doesAnswerDivExists) | |
| return; | |
| const secondsLeft = parseInt(leftDiv.textContent.split(": ")[1]); | |
| if (secondsLeft <= 0) | |
| return; | |
| const sanitizedProblem = problemSpan.textContent.replace("÷", "/").replace("×", "*").replace("–", "-"); | |
| const generatedAnswer = eval(sanitizedProblem); | |
| answerInput.value = generatedAnswer; | |
| answerInput.dispatchEvent(new Event('input', { bubbles: true })); | |
| }, delay); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment