8 1
Contact Author Sign in to rate

Flexible Cloze

0.02MB. Updated 2022-05-27. Only supports Anki 2.1.x.
The author has shared 8 other item(s).


FLEXIBLE CLOZE Flexible cloze is an Anki addon (https://ankiweb.net/shared/info/1632356464) for a configurable cloze note type for keeping related information (and cards) on the same note (Anki forum thread https://forums.ankiweb.net/t/flexible-cloze-support-thread/14504). Ideas for the functionality of this cloze variant blatantly stolen from trgkanki's Cloze (Hide all) [https://ankiweb.net/shared/info/1709973686] and RisingOrange's Enhanced Cloze (for Anki 2.1) [https://ankiweb.net/shared/info/1990296174] - both of which are excellent addons. However all code written from scratch (ok, I peeked at some other code). ALL CREDIT FOR INNOVATION GOES TO TRGANKI AND RISINGORANGE General /* FLEXIBLE CLOZE CONFIGURATION======================================= */ .fcz-config { --cloze-element: div; --inactive-prompt: ; --active-prompt: ; --expose: ! begin; --scroll: center iterate-min click-min; --iterate: active hide loop top; --key-next-cloze: j; --key-previous-cloze: h; --key-toggle-all: k; --show: info-front additional-back info-front; }/* ANSWER SIDE STYLING ============================================== */ /* Show all button/bar styling (and if visible or not) */ .fcz-show-all-btn { display: inline; background-color: #465A65; color: white; text-align: center; text-transform: uppercase; font-size: 15px; font-weight: bold; padding: 5px; border-bottom: 1px solid white; }Regarding styling As there have been a few questions regarding the default styling of the template not looking like "regular Anki clozes". You can have the clozes display however you want by adjusting the CSS on the "Styling" page of the "Cards" dialog. To achieve the "regular Anki cloze styling": In the "FLEXIBLE CLOZE CONFIGURATION" section set: --cloze-element: span; --inactive-prompt: [...]; --active-prompt: [...];Replace all the content under the "CLOZE STYLING" section with .fcz-active { color: blue; font-weight: bold; }. If by chance I am little off on the font-weight you can fine-tune it by starting at 400 which is normal font-weight and going upward (900 would be "very bold"). Similarly if by chance the blue nuance is off you can insert the correct RGB instead, e.g. #0000FF. Main difference from the earlier mentioned add-ons There is effectively no add-on, it's all JavaScript (and HTML/CSS) and runs 100% "client side" (the only python is the update logic). This has a number of effects: Similarities with the above two add-ons Changelog


As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:


If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author


on 1646519334
Amazing work. This is game-changing for my studies. Would you consider adding support for iOS devices?
on 1644889349
I am sure this is a nice add-on but since it uses ! to unhide clozes it has the same problems as Cloze Hide All. If you want to use TTS or type your answer the ! is spoken or required to be typed. You can solve this by adding a new field "ClozeCopies". Copy all Clozes. Cloze hints and other text aren't required. Delete any leading ! from the copies. Then have your TTS and typing use the new field.
Comment from author
Thank you for the feedback. Unfortunately, as far as I can tell, your suggested solutions are not viable with the design choice to keep the add-on "client-side" only (all JS on the card), i.e. not to manipulate fields or notes. See FCZ support thread for how to achieve similar functionality but without copying fields.
on 1643981287
on 1643442082
Nice add-on! But text field cannot be displayed on AnkiDroid.
Comment from author
Thanks! Could you specify the issue you are having? I myself as well as several others I know use Flexible Cloze on AnkiDroid (I do all my reviews on an Android tablet). Please do it in the support thread of the forum as the comment section is not really conducive for ongoing communications.
on 1640604358
Hi, thanks for this wonderful add-on, I love it.

Just 2 problems:

1. When I modify the cloze style and colour in Anki Desktop, then in Ankidroid clozes appear in a different colour…

2. Is it possible to avoid writing text in the "Title Box" when not needed?
Comment from author
I am not sure I understand the first problem, which styles are you editing and which clozes (Flexible clozes or Anki "regular" clozes)? Please reply in the support thread instead (https://forums.ankiweb.net/t/flexible-cloze-support-thread/14504/32).
Regarding problem 2: It seems Anki requires data in the first field of the note, which is "Title" in the "shipped" note configuration. You can change the field order from the main windows Tools -> Manage Note Types -> Flexible Cloze -> Fields. Move "Text" up to first position as well as possibly set "Text" to "Sort by this field in the browser" and you will not need to enter any data in "Title" (It will not affect how the cards look).
on 1639840197
Ottimo e funziona anche in Ankidroid
on 1639327042
Wow! no, WOW!!! Just how cool this addon is!
Its author greatly managed with all the custom cloze addons' heritage and added on top whole lots of own awesome stuff to make things perfect.
I can't even imagine what was not implemented. Perhaps, same number of dots (or underscores) representing the hidden words with the same number of letters (in theory might be useful with monospace fonts - the rest of the text won't move even a bit after showing up the clozes plus it also hints the number of symbols in correct answer). This is used in the Cloze Anything project.

Anyway I'll put a suggestion here - just in case the author could take this into account if he liked it:
Suggestion: to set a slightly different behaviour for left/right/top side taps:
1. Left tap opens (iterates/toggles) neighboring to the 'active' cloze(s) 'inactive' cloze(s) - that is, the next closest before (if exists - i.e. if the 'active' cloze isn't the first - and the only 'active' cloze) and the next closest after (also if exists i.e. if 'active' cloze isn't the last one and the only active cloze in a card).
2. Right tap opens one by one all the (i.e. not only the neighboring as in 1.) inactive clozes.
(Based on the existing configuration, tapping left or right side is closing - or not - the previously opened cloze(s)).
3. Top tap opens/closes all inactive clozes together at once.

By the above mentioned behaviour, the hints achieved through opening inactive clozes is gradual - if the answer can be given without opening the inactive clozes - great. If it's too hard, first you easily (for right-handed people, so it may be customized) open the least hint (the closest clozes). If even it didn't help - you further stretch your finger to right side and open more hints one by one. If it doesn't help too, you open all the inactive clozes (by tapping the top of the screen) together to bring the maximal hint reinforcement.
Also, this way the active clozes are respected (by being protected from occasional opening too early) as they should be. I.e. you only can open them directly by tap on them, or hitting the 'Show answer' button' (as it actually IS the answer).
Comment from author
Thanks! Looking at your suggestions, the hide prompt should be easy enough to implement. As for the edge tap behavior, I think the correct way forward would be to make the edge behavior configurable (potentially with a configurable number of zones, i.e. upper left, middle left, lower left etc.) for larger screens. That shouldn't be impossible but a little more work. Maybe I will have a look at that later as I have another project that I want to finish (as I need it myself).
on 1638206488
EDIT 2.1: I have reformulated the query in the add-on's forum using the username “elaltavoz” (29/11/2021) with more details.
EDIT 2: Thanks a lot for your instructions. Now I've changed the style and I guess I'm ok with the results. On the other hand, I would like to know how to adjust the "auto-scroll" function in order to automatically scroll a little below. That is because I always have more than one c1 or c2 in each flashcard, so I wouldn't have to manually scroll down to see the other c1's.
EDIT 1: What I meant is showed in the images of this link https://imgur.com/a/rbx0lmT .
What I pretend is to achieve the same revealed result that I have with the "Revealed Clozes (Enhanced Cloze Add-on)", with the text looking as a unique structure without boxes that alter the “naturality” of the original text.
The idea behind this project is great, however, after some testing I realized that the format of the showed text when I reveal it breaks the aesthetic structure of the flashcard. With the add-ons you mention above, the hidden text is showed in the format that you originally used. This is a disadvantage, it would be great to have a solution for this.

In any case, thanks for your effort and your time, have a great day.
Comment from author before post was edited
[EDIT2]Ok, then I understood you correctly. As mentioned you can change the styling to whatever you want, including looking like Anki regular clozes. As remarked below in edit 1, I have separated the styling from the functionality to facilitate personal styling and I have updated the description with a detailed instruction on how to get "regular Anki styling" of clozes.[/EDIT2]
[EDIT1] Greater separation between functionality and styling has been made and more commenting/explanation of the styling and how to change/override in the CSS ("Styling" page of "Cards").[/EDIT1]
I'm not sure I understand which styling you refer to but you can undo any styling in the CSS-file and then set it to any style you want. For instance, deleting everything below the /*--FCZ end --*/ tag on the "Styling" page for the card and adding the following at the end:
.fcz-active, .fcz-inactive
{ margin: unset; padding : unset; vertical-align: unset; min-width: unset; min-height: unset;
border-color: unset; border-width: unset; border-style: unset; background-color: unset; }
.fcz-active[state=hint], .fcz-active[state=hide], .fcz-active[state=show], .fcz-active[state=answer], .fcz-inactive[state=hint], .fcz-inactive[state=hide], .fcz-inactive[state=show]
{ display: inline; background-color: unset; }
{ --inactive-prompt: " [...] "; --active-prompt: " [...] "; }
{ color: blue; font-weight:bold }
on 1636461913
Good add-on, but can you add a function to always show a particular cloze? For example:

{{c2::Info 1}} {{c3::Info 2}} {{c3::Info 3}}

On the other addons this is solved by putting a special character following the cloze syntax, e.g {{c1::! or {{c1::#
The cloze c1 should be always visible when clozes 2, 3 and 4 are prompted.

EDIT: First use case, "{{c1!::" should be visible all the time, except of course when anki is prompting for cloze 1.

Most common use case: headings, e.g. c1! is a disease, c2, c3, c4 is pathology, c5, c6, c7 are the symptoms. When answering c2-c7 it would be good to know what the question is about. However, you also want to be tested on whether you know the disease - therefore Anki should prompt for c1 also.

In the current state you do have a heading field, however it's not prompted unfortunately. I think it's better to put the headings into the cloze field directly, similarly to cloze hide all.
Comment from author
[EDIT] Ok, implemented.
Seems easy enough to implement but could you explain the use case? Do you mean "All {{cx::!" are always in shown state when inactive" or do you mean some sort of grouping (i.e. show c1 when c2, 3 or 4 are active but not when c5, 6 or 7 is active)? I have a couple of other things that are ahead of it but I can fix it after that.