[Userscript] WaniKani Show Specific SRS 2

Where to get it

Here.
This depends on the wani kani open framework

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.

5 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

Since the latest big WK update (the whole Turbo thing), this script was working fine after opening the review page, then refreshing (just like Jisho for example), but since today for some reason it breaks when submitting a review that should update an itemā€™s SRS.

Iā€™ve tested reviews with disabling exclusively this script and it works fine, but with the script enabled, when submitting the ā€œfinalā€ review on an item (the one that should update its SRS and get the little popup) I have to submit the answer several times, at which point it becomes ā€œundefinedā€ and I lose connection and have to refresh the page, and this error appears in the browserā€™s console:

Iā€™m not sure if something has changed today on WK side or whatā€¦ It was working fine since the last big update (after refreshing the page) until today. :confused:

1 Like

I ran into the same problem 15 minutes ago. It should be fixed now, if you update to the latest version. If not, please let me know.

Works with the latest version, thanks!

1 Like

As of this afternoon, this is the only WaniKani userscript I use that I can still get working. I really like Show Specific SRS 2 and am grateful for it, but to be totally honest it isnā€™t exactly the one that, when it stops working, really impacts the way I use WaniKaniā€¦ I wasnā€™t sure where to post my question, so Iā€™ll just link to it here in case it sets off any lightbulbs, Iā€™m desperateā€¦

Now that some of the larger scripts have been updated to deal with the whole turbo page load business, I can apply the good old computer science technique of looking over the shoulder of someone who knows what they are doing and copying their code. As a result, this script should now work both with and without manual page reloads. This did introduce a dependency on WKOF, but I figured almost everyone would have already installed that anyway.