Closed nihil-admirari closed 1 year ago
So it's:
Hmmm… 🤔
more complicated for the end user (additional files in media)
{{cloze:Text}}
+ {{FrontSide}}
or the entire script copy-pasted).and will work in select webviews newer than 2020
Android System WebView is available for Android 7+ devices, and if I'm not mistaken, is updated automatically when the user logins to Play Store. Android 7 will turn 7 this August. Even devices running Android 5.0, which is the minimal version supported by AnkiDroid, can install 95.0.4638.74 from December 2021, and get a modern-ish JS.
Having said all that, I've recently discovered that Anki allows clozes to nest, and that clozes are supported within MathJax equations. MathJax support is relatively easy, but nested clozes aren't. They certainly can't be handled with a simple String.prototype.replaceAll
. Nested clozes allow for multiple cloze prompts, like the original Cloze Overlapper:
{{c1::{{c2::A}}}} {{c2::{{c3::B}}}} {{c3::{{c4::C}}}} ...
After support for nested clozes was added, “simple” cloze overlapper blew up in complexity. Since I personally don't have an Android device, don't wanna pay for Anki Mobile, and don't wanna register on Anki Web; testing on these platforms would be quite problematic. I guess I'll just go on with my own separate fork rather than committing upstream.
Great, thanks for all the effort! Perhaps it'll serve as an inspiration to others :bow:
Actually, it's a wholesale rewrite :slightly_smiling_face: of the entire thing in modern JS.
I haven't really understood what the script is doing, and when I finally did, I realised it can be simplified with the use of
String.prototype.replaceAll
. It's become available since 2020, much later than arrow functions, modules and the rest, so the script uses all that just as well.I haven't tested it on AnkiDroid, but if I'm not mistaken, an update of Android System WebView should suffice. AnkiWeb and AnkiMobile are also not tested.
Reveal All button is implemented as a bonus. I've also renamed
Overlapping
toBefore|After|NonContext|RevelAll|InactiveHints
as a form of documentation.