Closed gregorias closed 4 months ago
Awesome! Thank you :)
One can wait for Anki to update the class list by appending a callback to onUpdateHook
array (the call chain is _showQuestion()
-> _updateQA()
-> onUpdateHook
).
There are complications on other Anki platforms, e.g. on AnkiWeb the hooks are completely absent, and class list is taken from #qa_box
and not from <body>
(MutationObserver
doesn't show #qa_box
class list to be changing though).
See https://github.com/nihil-admirari/modern-cloze-overlapper/blob/master/_cloze-overlapper-loader.js for the details.
In https://github.com/gregorias/anki-code-highlighter/issues/86, we’ve discovered that Simple Cloze Overlapper renders a blank screen. I’ve discovered that’s due to the plugin’s script not working with an up-to-date class list (https://forums.ankiweb.net/t/card-card-classes-only-injected-separately-now/27387)
This commit adds an observer to className to address the issue.