[Userscript] WaniKani Lesson Filter

Best news this weekend. Can confirm the script works with console. Many thanks.

Console trick doesn’t work for me on Firefox. Nothing happens at all.

Are there errors in the console or just nothing happens?

Alright, as far as I can tell I got it working now. You can get the new unofficial console-only version here. Please let me know if you run into any issues. At this point I’ll be pivoting to the UI to try to get that working again, and once that is working I release the update officially to everyone. (It’s possible that won’t be for a bit since I don’t plan to work on this every day.)

8 Likes

Sorry mate, it was pilot error because I misinterpreted what a “null” value did. I just tried it again with 1.9.1 and I can confirm it does in fact work. Thanks for getting a fix out so quickly, I can now get back to my normal routine :grinning:

2 Likes

Looking for more feedback!

As already mentioned, I do have the core functionality of Lesson Filter working again. However, there are some compatibility issues if you use other scripts that change the queue, such as Reorder Omega. In Omega’s case, this happens just by it being installed, even if you don’t have it set to do anything during lessons. It’s possible that I can integrate with Reorder Omega by using the same library that Omega uses for manipulating the lesson queue, but some Lesson Filter behavior would have to change to accommodate that. So I wanted to poll a few more things to see if that’s desirable.


First I want to see how important compatibility with other scripts like Reorder Omega is by finding out how many people have a script like that installed or use it.

Do you use another script for lesson filtering or reordering? (e.g. Reorder Omega)
  • Yes, during the lesson learning portion (the part Lesson Filter is available in)
  • Yes, but only during the lesson quiz portion
  • No, but I use one for reviews / self-study / something else that’s not lesson-related
  • No, I do not have a script like this installed

0 voters


Next I want to know if people use Lesson Filter to make changes after completing at least one batch of lessons.

Do you Filter or Shuffle after having already completed the quiz for at least one lesson batch (without page refresh)?
  • Yes, sometimes I filter again after completing a batch
  • Yes, sometimes I shuffle again after completing a batch
  • No

0 voters

Related to this, right now if you filter multiple times (in a row or again after the quiz) the filters apply on top of each other. For example, if you first do radicals=0, kanji=5, vocab=20 and then do radicals=3, kanji=7, vocab=12, you actually end up with radicals=0, kanji=5, vocab=12. I want to know if this is desirable behavior or if it would be better to “throw out” the first filter and then apply the second filter to the whole/original set of lessons.

How do you want filtering multiple times with different values to work?
  • Apply the filters cumulatively (how it works today) as explained above
  • Throw away previous filters and apply the new filter to the whole queue
  • No preference / I won’t use filter more than once anyway

0 voters


Adding compatibility with Reorder Omega would require some changes (as alluded to in the above polls), but ultimately I don’t know which is more important.

Which of these is more important?
  • Lesson Filter and Reorder Omega work together
  • Filtering more than once applies cumulatively (option #1 above)
  • No preference / I don’t care about either of these things

0 voters


I’ll leave these polls open for the rest of the week and decide what to do this coming weekend.

3 Likes

i use a script to sort reviews by srs level, and one to sort lessons (to give me a mix of kanji and vocab, rather that 30 kanji followed by 120 vocab). as these are really quite different tasks, i reckon they are best left to separate scripts.

I very rarely filter more than once. It might happen if I change my mind at the last minute about the mix of items I want, so it would only happen before a quiz rather than after.

However, if I did filter more than once, I think it would be confusing if the effect of the filters were cumulative, if I’m understanding this correctly. Seems to me that this is not something users would expect to happen.

If multiple filters are cumulative, the user would need a way to back out of the process, or be stuck with (for example) zero of one category with no way to increase it after the initial filter.

1 Like

To be clear I’m not planning to add functionality beyond what Lesson Filter already does. It’s just that right now Reorder Omega breaks Lesson Filter if it’s enabled on the lesson page.

1 Like

Right, the fact that no one has complained about this in the past (since this is how it worked before the recent WaniKani update) indicates that it’s probably not common to filter more than once.

Well up until now the “reset” was to refresh the page. :slight_smile: But yes I agree with your point on the whole. I was thinking of making a new Reset button to allow this (exposing the method I already added behind the scenes). But just changing Filter to start from scratch would probably achieve the same goal while keeping things simpler.

3 Likes

I occasionally filter more than once if I finish a batch of 5 and then want to do another batch of 5 but I am totally okay with just having to refresh the lesson page and start a new filter from scratch in that case if it would be difficult to code.

EDIT: based on your previous reply about how it used to work, I think I might have been refreshing between most of the time anyway and so never noticed?

I’m a little confused by the description of the filters applying on top of each other.

If applying filters consecutively, expected behavior from my perspective would be that any new numbers entered would apply to the remaining lesson queue (minus the ones already quizzed).

For example:

radicals: 3,  kanji: 1,  vocab: 1

for one batch of 5 lessons, take the quiz, then:

radicals: 0,  kanji: 2,  vocab: 3

for another batch of 5 lessons.

3 Likes

Yeah, perhaps my description wasn’t great. With either approach, filtering again after the quiz will obviously exclude the completed/quizzed lessons.

The difference is that currently it will not add back filtered out lessons. Currently, if you filter to zero radicals, complete a lesson quiz consisting of kanji and vocab, then decide you do want some radicals, you can’t filter again to add the radicals back. You’d have to refresh the page.

If I switch to use this shared library that Reorder Omega already uses, this would no longer be the case. In this case any filter would apply to the unfiltered queue (completed/quizzed lessons excluded of course). So using the example above, you could add back in radicals after the quiz without refreshing the page. (I can easily change Lesson Filter to work this way even without using that library. It’s just that with the library I have no choice.)

2 Likes

Any insights? I thought I ran this correctly, but the page isn’t updating.
Wanikani Lesson Filter 1.9.1
Firefox 104.0.2

Console output

Other installed scripts:
image
I know this image says 1.3.2, but it’s 1.9.1 I set the version to make sure an official update would prompt to overwrite. I am not familiar with how tampermonkey determines how/when to install over things.

I’m not sure why you’re getting this error, but you don’t need to worry about the version thing. I used 1.9.x for the unofficial release because I plan to use 2.0.0 for the official release. So even if you keep 1.9.1 you’ll get the official update.

1 Like

I don’t know what causes the error you are seeing but I would turn off all the other scripts and see if that’s the problem. I am using 1.9.1 on Firefox 111 with the following scripts enabled.

image

1 Like

There is one possibility. The script assumes that Turbo is available on page load, but maybe in some weird situations it’s not. If that’s the case I think I can tweak how I access Turbo to reduce the chance of this happening. I can’t guarantee it will fix the issue, but if it doesn’t cause any problems I’ll do it just to be safe. Since I’ve already started making the UI changes though it’ll probably have to wait for the full release.

2 Likes

Might have missed something, but where do I actually get version 1.9.1?

There’s a link a few posts back. It’s a partial fix until I can get the UI fully working.

2 Likes

Ahhh, interesting. I actually had no idea it did that, but I realize I probably was refreshing the page between each filter application since usually I find I do want to start with something like “2 kanji, 3 vocab” and then if I feel comfortable with that (or already know some of the kanji or vocab in question from outside WK) after the quiz do another group of “2 kanji, 3 vocab” or “1 kanji, 4 vocab.”

But again, I’m definitely fine with having to refresh the page in between or click a “refresh” or “reset” button in order to get that behavior.

I don’t know if this supports your hypothesis or not; but pasting the whole script into the console and then calling the window.lessonFilter.filter function works.

The context hider user-script was also not working. When I re-pasted that it snapped to working. So I tried with the lesson filter script.

1 Like