Hi! So I am pretty much a beginner in JS so sorry for this noob question. I was trying to detect a review being passed while not messing up my Double-Check script. (It’s basically a script that allows you to re-type an answer you’ve given by intercepting the WK handler (at least that’s what I understood while reading its source code correct me if I am wrong)) After experimenting a bit with the elements window open I realized that this fieldset changes values when answered
You could either monitor the element with a mutation observer or you could monitor jStorage (which WK uses to store session data, such as current item and review queue) using $.jStorage.listenKeyChange("*", callback)
I’ll second the suggestion of the MutationObserver. In my ConfusionGuesser script, I’m using it for the same purpose:
let fObserverTarget = document.querySelector("#answer-form fieldset");
let observer = new MutationObserver(m => m.forEach(handleMutation));
observer.observe(fObserverTarget, {attributes: true, attributeFilter: ["class"]});
This will cause handleMutation() to be called for every class change in the element. In handleMutation(mutation), you can then check if the classList now contains “correct”: mutation.target.classList.contains("correct").