This is a script for Anki that enhances the functionality of cloze cards, allowing individual revelation and hiding of clozes still on the front of the card. It supports touch gestures and keyboard shortcuts. It is compatible with AnkiDroid, AnkiMobile and supports MathJax rendering.
- Individual Cloze Reveal: No more revealing all clozes at once!
- Touch Gestures: Set your preferred gesture using User Action in AnkiDroid/AnkiMobile; swipe gestures are auto-enabled for AnkiWeb and AnkiDesktop with touchscreens.
- Keyboard Shortcuts: Use keyboard shortcuts to reveal or hide clozes.
- Auto Scroll: Enhance your reading experience with a smooth auto scroll to the next cloze.
- Auto Flip: The card is automatically flipped after revealing all the clozes, if enabled.
- MathJax Support: Include complex mathematical equations in your clozes with MathJax rendering.
There are two ways to install the Cloze Interactive script:
- Download the
.apkg
file from the releases page on GitHub or from AnkiWeb. - After the file is downloaded, double-click on it to open it in the desktop program. If asked which application to use, choose Anki.
- The deck should now be imported into your Anki app.
- Navigate to the card folder in the GitHub repository.
- Copy the contents of the
template-front.html
file. - Open your Anki Desktop app. In the main Anki window, go to Tools → Manage Note Types and find the Cloze note type where you want to enable the Cloze Interactive script. Proceed by clicking on Cards to invoke the card template editor.
- Replace your existing front template with the copied content.
- Repeat the process for the
styling.css
file, replacing your existing styling.
Please note that these instructions are for the Anki Desktop app. The process may vary slightly for AnkiMobile or AnkiDroid.
- Click a cloze to reveal it.
- On touchscreen devices, tap a cloze to reveal or use gestures (for AnkiDroid/AnkiMobile, configure swipe gestures via User Actions; on AnkiDesktop and AnkiWeb, swipe right to reveal or left to hide clozes).
- Use keyboard shortcuts to reveal or hide clozes. Default keys:
W
or→
for the next cloze, andQ
or←
to hide a cloze.
Both gestures and keyboard shortcuts can be customized in the script's user settings.
You can customize the script's behavior by modifying the user settings at the top of the script. Here are the available options:
gesturesEnabled
: Enables or disables gestures on AnkiDesktop and AnkiWeb with touch screens.invertGestures
: Inverts the touch gestures, only AnkiDesktop and AnkiWeb.swipeThreshold
: Adjusts the swipe sensitivity.scrollDuration
: Adjusts the smooth scroll duration.autoFlip
: Controls whether the card automatically flips to the back after all clozes are revealed. Options include"all"
,"off"
, or specific platforms like["AnkiDesktop", "AnkiDroid", "AnkiMobile", "AnkiWeb"]
.revealNextKeys
: Sets the keys to reveal the next cloze.hideLastKeys
: Sets the keys to hide the last revealed cloze.
Note for AnkiMobile users: To activate
autoFlip
, set tap gestures to show answers in AnkiMobile's settings, choosing from:"topCenter"
,"midCenter"
, or"bottomCenter"
. Then, adjust the"msg"
parameter in theflipToBack
function of the script accordingly. This feature is currently functional, but may break in future updates due to AnkiMobile's private API.
Gestures are not automatically enabled on AnkiDroid and AnkiMobile. Follow these steps:
AnkiDroid
- Go to Settings.
- Navigate to Controls.
- Enable gestures.
- Under User Actions, configure a preferred gesture. Set User Action 1 to reveal the next cloze and User Action 2 to hide the last revealed cloze.
AnkiMobile
- Go to Settings.
- Navigate to Review settings.
- Open Taps or Swipes.
- Under "WHEN THE QUESTION IS SHOWN", select a preferred gesture and assign User Action 1 to reveal and User Action 2 to hide clozes.
This script is compatible with:
- Anki Desktop: Version 2.1.55 or higher.
- AnkiDroid: Version 2.17.0 or higher.
- AnkiWeb: Compatible.
- AnkiMobile: Tested on version 23.12.1.
This project is licensed under the GNU General Public License v3.0.
This script was inspired by the work of ruin1990 and kleinerpirat. For more details on their contributions, you can visit this AnkiWeb forum discussion. I also want to acknowledge thiswillbeyourgithub for creating the Clozolkor script, which I used before developing this script.