Last active
July 20, 2024 03:33
-
-
Save NightSling/076b9dc957a9f97d5e5d982b46dd5ac1 to your computer and use it in GitHub Desktop.
Add All Question Macro for Markhint
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 timeout(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function sleep(fn, ...args) { | |
await timeout(500); | |
return await fn(...args); | |
} | |
async function runMacroA() { | |
let all_questions = [...document.querySelectorAll("h3")].filter((a) => a.innerText.startsWith("Question")); | |
let size = all_questions.length; | |
for (let i = 0; i < size; i++) { | |
await sleep(async () => { | |
let question = all_questions[i]; | |
question.click(); | |
console.log("Clicked (H3) #" + i); | |
await sleep(() => { | |
[...document.querySelectorAll("button")].filter((a) => a.innerText == "Add").forEach((e) => { | |
e.click(); | |
console.log("Clicked (BTN) #" + i); | |
}); | |
}); | |
}); | |
} | |
} | |
runMacroA() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This can be customised and made into a userscript with keyboard shortcuts however I'm busy atm.