[UserScript] WaniKani SRS Ranks


#1

Hi everyone! I’ve created another fun little UserScript that adds more SRS ranks, AND lets you change the rank labels in WaniKani’s SRS system to whatever you want them to be.

Did you know that there are 10 SRS levels (i.e. you have to get an item right 10 times to burn it), but only labels for 5 of these? Apprentice (4), Guru (6), Master (8), Enlightened (9), Burned (10). What’s more, is that they’re all weighted towards the later levels (see brackets), so earlier on you’ll see “Apprentice” and “Guru” a lot. This script fills the gaps and adds some new ranks that I’ve come up with:

  1. Layman (you won’t see this unless you get new items wrong)
  2. Initiate
  3. Novice
  4. Apprentice
  5. Journeyman
  6. Adept (This is the default ‘Guru’ level)
  7. Guru
  8. Master
  9. Enlightened
  10. Burned

I tried to keep the new order and rank labels logical, (drawing some inspiration from Skyrim, heh). These are in a list at the top of the script though, so you can change them to be whatever you like! :^)

Download the script here:
https://greasyfork.org/en/scripts/39258-wanikani-srs-ranks

and find the source here:

NOTE: For simplicity’s sake, this only affects review sessions. What’s more, if you’re using something like WaniKani improve (also known as Lightning Mode), this isn’t compatible (since you don’t see SRS labels when you skip for correct answers).

Screenshots:


The New And Improved List Of API and Third Party Apps
#2

I made a version of this as well. It’s interesting to see how we solved the problem differently though. :slight_smile:


#3

Oh cool! Sorry, I hadn’t seen this before. I feel like I’d been through just about all of the available UserScripts but I must have skimmed over yours. Interesting approaches indeed, thankfully the nature of how WaniKani made it relatively simple ,like you said.

I tried to make a point of having only a single reference so it’d be easy for people to update the rank labels without having to do it in more than one place.


#4

Screenshots maybe?


#5

There are screenshots in the GreasyFork link - not much to show tbh! I’ll upload some to the OP as well though, no problems :slight_smile:


#6

Sorry to necro the thread, but I found a bug. It turns out that the CSS breaks if a rank name has a space in it, like “Mostly Harmless”. I was able to fix it, and I’ve tested the fix in Firefox Nightly. I couldn’t figure out how to submit this on GitHub, so here are the bits I changed:

CONST.SRS_RANKS.forEach(function (rank) {
    var safeRank = rank.replace(' ', '-');
    CSS += ['.srs .wk-srs-rank-' + safeRank.toLowerCase() + '::after {', '\tcontent: \'' + rank + '\';', '}'].join('');
});
$('#question-type').bind('DOMNodeInserted', function () {
    var _$srsTile = $('.srs > div');
    var levelUpOrDown = _$srsTile.hasClass('srs-up'); // True = Level up, False = Level down
    var currentItem = $.jStorage.get('currentItem');
    var nextSrs = currentItem.srs + (levelUpOrDown ? 1 : -1);
    var rankLabel = CONST.SRS_RANKS[nextSrs].toLowerCase();
    var safeRankLabel = rankLabel.replace(' ', '-');

    console.log('current rank:', CONST.SRS_RANKS[currentItem.srs], levelUpOrDown);
    console.log('triggered for rank:', rankLabel);

    _$srsTile
    // Remove legacy SRS rank
    .removeClassPrefix('srs-')
    // Re-add class to trigger up/down animation
    .addClass('srs-' + (levelUpOrDown ? 'up' : 'down'))
    // Add our new SRS rank
    .addClass('wk-srs-rank-' + safeRankLabel);
});

Note: I am basing these changes off v1.0.0, since that’s what I downloaded when I went to Greasyfork. It looks like the GitHub source might be a later build, though.

Thanks for making this!


#7

Wonderful, thank you @saxoncameron.

I actually wanted @seanblue’s “Show Specific SRS Level” script, but for whatever reason, it doesn’t work for me on Google Chrome (script has no noticeable effect).
This one does work, however. So I’ve just tweaked my local copy of the script to replace @saxoncameron’s rank names with Apprentice 0 through 4 and Guru 1 and 2.
@The1AndMany’s last comment was helpful here, too, as without it, it may have taken me a while to realise that I needed to remove the spaces in the rank names used under the hood. Though I don’t know where it is that The1 has encountered said bug, or where this rank name “Mostly Harmless” came from? Did you also replace the rank names with space-containing variants, The1?

Happy to help out anyone wishing to emulate this, but basically: You can just replace the names in the SRS_RANKS list initialised in lines 25 and 26 with your preferred names (applicable line numbers are likely to change with future versions of the script, of course); and if your preferred names don’t include any spaces, then you’re done, but if they do, then you can do what @The1AndMany did. :slight_smile:
Unless, of course, there is some problem with this solution that I am still blissfully unaware of.

I guess the ideal thing would be to provide a “settings” page where users can set the rank names to whatever they want.

Cheers


[Userscript] WaniKani Show Specific SRS Level in Reviews
#8

Oh and, indeed, as @The1AndMany has pointed out, we’ve both been talking about the 1.0.0 version that’s deployed on Greasyfork. But from what I see, everything we’ve said also applies to version 1.1.1 found on GitHub (except for such things as the line numbers being different :slight_smile: ).


#9

Good to hear that my effort helped someone out!

To answer your questions, “Mostly Harmless” is the only space-containing alteration I made. It comes from the combat ranks in Elite Dangerous, the first two of which (Harmless and Mostly Harmless) are nods to The Hitchhiker’s Guide to the Galaxy. I found the bug when I tried to mirror those combat ranks, adding Civilian to round out the number of entries.

But yeah, a settings page would be much better. It looks like @saxoncameron might not update this for a while, though…


#10

Hi everyone! Thanks for all the comments, and apologies for not getting back to you all sooner. I’m no longer an active user of WaniKani, but I’m glad you’re finding this script useful.

Good catch on the spaces-in-ranks bug - that’s an edge case I didn’t come across because all of my “made-up” ranks I tested were single words. My bad! I’ll update the script and test the changes, and also update the GitHub repo and Greasyfork script to be up-to-date.

I still get email notifications for this, and I’m happy to make alterations and fixes as they are reported. Thanks for your support! ETA for this fix, maybe 1 or 2 days depending on how busy I am in the evenings.

Cheers!


#11

Hi all! I’ve fixed the issue and tweaks a couple of other things under the hood; the build output should be easier to edit now too (each rank on a new line).

GreasyFork has been updated to v1.2.1:
https://greasyfork.org/en/scripts/39258-wanikani-srs-ranks

@The1AndMany - I applied the patch similar to how you had, but I used a global regex replace instead of the string replace, because your snippet only fixed the first space it encountered, rather than all spaces in the name. i.e. rank names now support any number of spaces, rather than 0 or just 1.

I’ve tested this and it seems OK, let me know if you all have any issues. Thanks!

cc @sebigator


#12

Cool, I look forward to checking out your update. :slight_smile:

Perhaps I’ll do a pull request with the added feature of being able to set one’s own rank names via a settings “page” inside the app. I guess I’d mainly do this to get my hands dirty with UserScript design.


#13

Where and how do you set the rank names? Searched, couldn’t find a settings page.


#14

Hi Omukai! In the script at the very top there is a list of rank names that you can edit. Unfortunately there is no settings page, and you have to modify the script source. However, it is a simple edit, and what you need to change is right at the top and hopefully clear enough.

If there’s enough demand in future maybe I’ll update the script to have a “settings” page to make it easier to change these.


#15

This has been made to be very easy with rfindley’s Open Framework, if you do end up adding settings.


#16

Oops. Yeah, I’m admittedly a novice programmer. I wrote that fix before I learned how to make a global replace search. Nice catch. I’m just glad I could help, even if my code was a little inelegant…


#17

Thanks! I’ll keep that in mind, I did have the Open Framework bookmarked in case I ever wanted to do some more complex stuff. This script, and my other “Stealth Mode” script, were just me dipping my feet in UserScript land here.


#18

No sweat! If anything it sped up the process for me, seeing where you had made your changes. :grin: