Making cloze deletes pop up one by one on Anki for the Mac

johnpaydar's Avatar


26 Apr, 2018 10:53 AM

Hi I am looking to make cloze deletes pop up one by one. I found a forum that had a scrip made by someone called itraveller. He/she mentioned that this script would allow me to click open a cloze delete if I added this script to the back template of a card. Heres the script:

var clozes = document.getElementsByClassName("cloze");
var clr = window.getComputedStyle(clozes[0]).color;
var bg = window.getComputedStyle(clozes[0]).background;
for (i=1; i<clozes.length; ++i) {
  clozes[i].style.background = clr;
  clozes[i].onclick = function() { ;}

Now I'm not sure if this is not working for me b/c I am a mac user or I'm not familiar how to add in scripts.

Someone help!!

Thank you

  1. 1 Posted by Vit on 29 Apr, 2018 03:02 AM

    Vit's Avatar

    This works for me:

    <script>  <!-- by Mixeev in Tender , to open C1 with Space-bar, one-at-a-time -->
    var handled = false,
    clozes = document.getElementsByClassName("cloze"), clr = window.getComputedStyle(clozes[0]).color, bg = window.getComputedStyle(clozes[0]).background; for (i=1; i<clozes.length; ++i) {
    clozes[i].style.background = clr; clozes[i].onclick = function() {;'text';} clozes[i].style.cursor = 'help'; } document.onkeypress = function(ev){
    if (handled) return false;}
    document.onkeydown = function() {
    for (i=1; i<clozes.length; ++i) {
    if (event.which==32 && clozes[i].style.background!=bg){ clozes[i].style.background=bg;handled=true;return false} } handled=false;return true; } window.setTimeout(function(){ window.focus()},0);

Comments are closed, but you can start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac