How to use the next-generation spaced repetition algorithm FSRS on Anki?

Wait so now the icon is completely gone? Is there a way to display it in the bottom left corner so I know the FSRS is enabled?

You can enable it by setting const display_memory_state = true;. Its default value is false now.

1 Like

Ok that worked. I would update that in the explanation of setting up the FSRS.

New problem now is that this change enables a scroll wheel on the right side. It does not seem to fit the screen perfectly. I need to scroll down to see it in the reviewer. The dimensions might be off?

The iOS version seems to be up a bit too high? Sorry I am a perfectionist :sweat_smile:

1 Like

// display if FSRS is enabled
if (display_memory_state) {
var fsrs_status = document.createElement(‘div’);
fsrs_status.innerHTML = “
FSRS enabled”;
fsrs_status.id = “FSRS_status”
fsrs_status.style.cssText = “font-size:12px;opacity:0.5;font-family:monospace;text-align:left;line-height:1em;position:absolute;bottom:0.5em;”
document.getElementById(“qa”).appendChild(fsrs_status);
document.getElementById(“qa”).style.cssText += “min-height:65vh;”

This seems to be the sweet spot for the Desktop version. However messing with the absolute bottom pushed the iOS version up higher?


Sorry to that, I’m not a professional frontend developer. Maybe you could just close this function. Maybe someone like @kleinerpirat could help me solve this problem.

Using ChatGPT for a while I have gotten somewhere closer to a product that works. The iPhone does not work yet but the iPad works pretty close to what I want. I dont think this code is great since I used AI but nevertheless it works for my iPad Pro 12.9 inch.

// display if FSRS is enabled
if (display_memory_state) {
var fsrs_status = document.createElement(‘div’);
fsrs_status.innerHTML = “
FSRS enabled”;
fsrs_status.id = “FSRS_status”;
fsrs_status.style.cssText = “font-size:12px;opacity:0.5;font-family:Arial Greek;text-align:left;line-height:1em;position:absolute;bottom:0.5em;”;
document.getElementById(“qa”).appendChild(fsrs_status);
document.getElementById(“qa”).style.cssText += “min-height:65vh;”;

// Add media query to target iPad Pro 12.9 inch 2021 edition
var iPadProLandscape = window.matchMedia(“(min-device-width: 1024px) and (max-device-width: 1366px) and (orientation: landscape)”);
iPadProLandscape.addListener(updateOrientation);
var iPadProPortrait = window.matchMedia(“(min-device-width: 1024px) and (max-device-width: 1366px) and (orientation: portrait)”);
iPadProPortrait.addListener(updateOrientation);
updateOrientation(iPadProLandscape);
updateOrientation(iPadProPortrait);

// Add media query to target iPhone 13 Pro
var iPhone13ProLandscape = window.matchMedia(“(min-device-width: 375px) and (max-device-width: 812px) and (orientation: landscape)”);
iPhone13ProLandscape.addListener(updateOrientation);
var iPhone13ProPortrait = window.matchMedia(“(min-device-width: 375px) and (max-device-width: 812px) and (orientation: portrait)”);
iPhone13ProPortrait.addListener(updateOrientation);
updateOrientation(iPhone13ProLandscape);
updateOrientation(iPhone13ProPortrait);

function updateOrientation(device) {
if (iPadProLandscape.matches || iPhone13ProLandscape.matches) {
// Apply specific styles for landscape
fsrs_status.style.cssText = “font-size:12px;opacity:0.5;font-family:Arial Greek;text-align:left;line-height:1em;position:absolute;bottom:-2.5em;”;
document.getElementById(“qa”).style.cssText += “min-height:65vh;”;
} else if (iPadProPortrait.matches || iPhone13ProPortrait.matches) {
// Apply specific styles for portrait
fsrs_status.style.cssText = “font-size:12px;opacity:0.5;font-family:Arial Greek;text-align:left;line-height:1em;position:absolute;bottom:-2.5em;”;
document.getElementById(“qa”).style.cssText += “min-height:73vh;”;
} else {
// Use default styles
fsrs_status.style.cssText = “font-size:12px;opacity:0.5;font-family:Arial Greek;text-align:left;line-height:1em;position:absolute;bottom:0.5em;”;
document.getElementById(“qa”).style.cssText += “min-height:65vh;”;
}
}
}

I prefer clean code.

Now that FSRS" has an ID (fsrs_status.id = “FSRS_status”)
Everyone can implement what they think is best in their own card via CSS.

So your FSRS is protected against updates.

Sorry, I couldn’t change the CSS by changing the card style.

Would it be an Anki error when rendering?

Tried skimming this and other threads, but are there any additional steps to setup FSRS with AnkiMobile? I’ve been using FSRS for around 20 days so far on desktop only. I remember there was a post somewhere that read that it did not work with AnkiMobile so I avoided it.

Two ways to use FSRS in AnkiMobile:

  1. Use AnkiMobile Beta (The stable version is coming soon)
  2. Use FSRS4Anki Helper

https://ankiweb.net/shared/info/759844606

1 Like

A new stable AnkiMobile release was sent to Apple for approval this morning, so it should hopefully become available in a few days. Once approved, it will roll out slowly, but you will be able to visit the app store page to fetch it without waiting.

4 Likes

Just double checking, you’re referring to 2.0.88, correct?

UPDATE: Assuming 2.0.88 is the correct version, I believe I’m having an issue. I opened up the same review on AnkiMobile and on Anki Desktop and they have drastically different intervals when hitting Good. 1.2 months vs. 2.5 months.

Yep, I referred to 2.0.88. Did you enable v3 scheduler in AnkiMobile and sync on both devices?

Yes, V3 schedule is enabled on AnkiMobile and I see the FSRS4Anki (3.11.0) code in the study options, but the intervals are still different. Just tested it again with a few more cards.

Could you use FSRS4Anki 3.12.1? And please enable the display_memory_state. You will see this state variable shown in your card’s front. Then you can compare it between PC and Phone.

Updated to 3.12.1 and enabled display_memory_state. On the desktop I see this:
image
and on the phone, I don’t see anything (in the deck options on AnkiMobile, everything is in sync). I’m not sure if it is because of my card’s CSS. I’m using the Prettify Nordic Cards.

I grabbed a copy of your collection on AnkiWeb, and display_memory_state was false. I changed it to true locally, and opened your RTK deck in AnkiMobile 2.0.88. I get identical results as the desktop - 2.6months for good, and the same numbers on the bottom left.

2 Likes

Hmm. That’s strange. I see the FSRS enabled on AnkiMobile now, but good is still different. For example, Card ID = 1613453384941 is showing me 1 month on AnkiMobile and 2.3 months on the desktop when hitting good.

If you look at the review history of that card on each device, does everything match? It sounds like your devices may not be fully in sync. After syncing normally, please force a one-way sync in the preferences screen and download from AnkiWeb - does that resolve the issue?