Memrise card template [support thread]

Card info (minor add-on update)

The add-on now makes certain learning info available to templates so the card appearance can be adjusted accordingly.

For example, @trongan04032002 and @butter_muffin previously asked about displaying full card details the first time it is studied instead of starting with a test right away:

Now this can be implemented by adding

(()=>{
  infoL = document.getElementById("lt-card-info");
  if (!infoL || !!document.getElementById('backwrap')) return;
  info = JSON.parse(infoL.textContent);
  if (info.reviewCount === 0 && window.pycmd) {
    pycmd("ans");
  }
})();

to the front sides (user scripts section) of a Memrise template, and adding

(()=>{
  infoL = document.getElementById("lt-card-info");
  if (!infoL) return;
  info = JSON.parse(infoL.textContent);
  if (info.reviewCount === 0) {
    MemFlip(true);
  }
})();

to the user posterior scripts section of the back template.

Unfortunately, there will likely remain a brief flash of a test side on the first card viewing, because Anki has to go through the front to get to the back details. Although this is corrigible too, that will require a bit more drastic modifications to the template, so I won’t post them here unless someone really wants to dig into the matter.


As another usecase, if there still are people interested in displaying card learning progress in the old memrise style with flower images, this also became possible


In general, any other template can make use of the card info (as long as the card is reviewed in the desktop app and the support add-on is installed and updated to the latest version). The minimal code required to access the data in a script:

info = JSON.parse(document.getElementById("lt-card-info")?.textContent || "{}");