[Userscript] WaniKani Show Specific SRS 2

Where to get it

Here.

What is it

Displays the specific category of apprentice or guru when getting an SRS popup.
This means that instead of
image
you will get
image
This is a rewrite of the old script from @seanblue that does the same thing, but no longer works after recent updates. (The example images are also shamelessly stolen). It also does the same thing as the script from @Kumirei, who was also working on this in parallel. I am still publishing this because at the time of writing, this version is the only one that is compatible with doublecheck, although I expect that to change soon.

4 Likes

deja vu

1 Like

He was slightly faster than me, but I made it and it works a tiny bit better for now, so I thought I might as well share it anyway.

2 Likes

No worries. More ammo for @seanblue’s point that this shoul be base functionality.

Nobody is faster than @Kumirei!

2 Likes

Seems to work for me, including double check compatibility. Thanks for sharing.

2 Likes

Amazing, thank you!

I can’t resist offering a bit of unsolicited code review:

    let value;
    switch (e) {
        case 1:
            value = "Apprentice 1";
            break;
        case 2:
            value = "Apprentice 2";
            break;
        case 3:
            value = "Apprentice 3";
            break;
        case 4:
            value = "Apprentice 4";
            break;
        case 5:
            value = "Guru 1";
            break;
        case 6:
            value = "Guru 2";
            break;
        case 7:
            value = "Master";
            break;
        case 8:
            value = "Enlighten";
            break;
        case 9:
            value = "Burn";
            break;
    }
    // console.log('obtained srs value:',value);
    return value;

That could be refactored into a simple table lookup:

const srs_lut = ["Apprentice 1", "Apprentice 2", ...];
return srs_lut[e - 1] || ("SRS " + e);
1 Like

This was my first foray in both userscripts and javascript in general, so I am not aware of any best-practices and just went with whatever worked first. I think this was actually the only piece of the old script I adapted that I could reuse, so I saw no need to change what was already working. I am always happy to hear feedback on how to improve though.

1 Like

Yeah it’s really unimportant, just caught my eye when I opened the script. Thank you again for your work!

Did this stop working for anyone else today? (Is it still working for you right now?)

It worked fine for me this morning, now it’s not doing anything even after a re-install.

I just noticed it wasn’t working for me neither. I will look into it when I have time.

Can confirm. It stopped working for me too.

After some testing, it looks like the problem is actually not with this script, but with doublecheck. Some change in the wanikani backend caused srs popups to stop working entirely if doublecheck is installed, and this script can’t modify what is not there in the first place. I am afraid the doublecheck script is too large and complicated for me to fix, so we will have to wait for a fix from their side.

2 Likes

Doublecheck got fixed, and now this script is also working again. I did have to manually get tampermonkey to update the scripts as it only checks once every so often by default.

1 Like