WaniKani SRS Reorder Button

Hello,
I don’t know if this has anything to do with your recent update but I just did some reviews and I encountered a minor bug that wasn’t there before: the breakdown of the items SRS levels on the top right corner didn’t update while I was progressing through my reviews. And also, when I pressed Enter to move on to the next item it would make the entry area shake, as if I had just pressed enter twice and submitted an empty response.
Apart from that, the script worked normally, the items arrived in the correct order.
Btw, thanks for making this script, it’s great!

Edit: forgot to mention, I’m using Firefox 64.0.2 on Win10, Tampermonkey 4.8.5847 and I normally shouldn’t have any other script active while doing reviews (I use the WK Open Framework for Ultimate Timeline and a few others).

You’re right, apparently I’ve removed one thing too much while doing clean-up of the code. It should be fine now. Thanks!

Thanks for reacting so quickly but unfortunately, the bug persists for me. Do I have to update the script in any way or is it automatic?
By the way, i wrote yesterday that items arrived in the correct order but just now, it seemed the first item after I clicked the button was not in the right order. The reading came first, whereas I normally have the meaning come first. If that’s any help…
But anyway, thank you for spending time on this!

And now, merely one hour after my previous message, it works perfectly again…

If you’re using Tampermonkey I think the default is daily updates

This script doesn’t get updated automatically because the preferences you’ve set manually in the code would get overwritten with every update. I didn’t want that to happen without the user explicitly asking for it.

So remember to always check if your preferences are set correctly.

1 Like

Ok, thanks for the info!

hey i added functionality to this script:
-option to sort automatically
-keybind default is the number 3
-update the counter when finishing a card
https://pastebin.com/hy7LpRmj
@Towe pls update the greasefork and unlocalise the link lol. not everyone speaks polish

also for me the reading for meaning does not work

I love this script! I’ve been looking for something like this for a long time. Don’t know how I didn’t find this one haha

Thank you!

Hi, thanks for your contribution! I’ve played with your changes, modified them a bit and everything seems to be working fine. Also, good point about the localisation, I haven’t even noticed it’s in the URL.

Besides, what do you mean by “reading for meaning”? Is it some other script?

i have no clue what i meant.

anyway, i have added one more quick and dirt change. i wanted to have some randomness in the order. so i randommised the first 10 items to be tested.
i saved the random function to keep the original and not get into problems if other scripts mess with it
const ornd = Math.random;
and i changed one line to add the shuffle
$.jStorage.set('activeQueue', items.slice(0, 10).sort(() => ornd( )-0.5));

edit. hm that seems to dirty as it separates meaning and reading. if i have more time i might make a better randomiser. i think the best way would be instead of sorting the hole array to sort it into pots that all have the same sorting priority and the these can simply be shuffeled

Isn’t the order random already? I mean, when you refresh the page, it’s different every time and when you use the reorder button it only sorts items enough to enforce rules defined in the script but besides that the randomness should be preserved.

yeah but i use ignore script for typos and it also has the sideeffect that a wrong asnwer will directly be asked again which is not helpful. so its much better for me to have a bit of randomness in there for the case, but that gives me an idea. i guess i will do the shuffle before the sorting

hey guys, hopefully someone can help, since I am terrible with code. I would like to have the items come in in reverse SRS order, i.e. burn items first. What exactly do I need to change in the script to allow that?

Edit: These are the standard settings and I guess I need to change something here, but I don’t know what to.

/* Settings */

const questionTypeOrder = 1; // 1 - reading first, 2 - meaning first, 3 - random
const itemTypeOrder = 1; // 1 - rad->kan->voc, 2 - voc->kan->rad, 3 - random
const ascendingSRS = true; // low-level items first
const priotitizeSRS = true; // SRS order more important than item type order
const force1x1 = true; // meaning and reading directly next to each other
const sortOnStartup = false; // sort items on startup
const hotkey = ‘Digit3’ // keyboard shortcut (key code)

@sirati97 Not to hijack this thread, but my reorder script might be closer to what you want. Or at the very least, the code may help you figure out what to do to tweak this script so it does what you want.


@Saida This is just a guess based on the setting names, but try setting ascendingSRS to false.

1 Like

i do get that you might think that, but i had an exodus from wanikani and had like 5000 review about 3 weeks ago, i am down to 3000 now making sure to revise every item i revised the last days before going to new ones.

i do not want to reset because with kanji i am nearly done learning just vocab is where i so far behind, so for me it doesnt really apply because i do enough a day to revise everything due anyway and the levels in wanikani do not mean too much because of my break if they are below master

I thought that might be an option. I’ll try it out when I get back to my laptop later. Thanks!

1 Like

@seanblue just wanted to let you know that it worked. (It took me a while to find the save edit button, though, haha)

I’m very, very new to all of this, but I think I found a way. Further down in the code it has this under utilities:

function itemComparator(itemA, itemB) {
const srsOrder = ascendingSRS ? itemA.srs - itemB.srs : itemB.srs - itemA.srs;
const typeOrder = itemTypeOrder === 3 ? 0 : (getTypePriority(itemA) - getTypePriority(itemB)) * (3 - itemTypeOrder * 2);
return priotitizeSRS ? srsOrder || typeOrder : typeOrder || srsOrder;

I switched the bold items to show:

itemB.srs - itemA.srs : itemA.srs - itemB.srs

and it seems to work just fine.

1 Like

Thanks for going to the trouble. I got it working already, though