[Userscript] WaniKani Lesson Filter

It looks like the bar radical is one of the ones that are just images. I wonder if that is related.

Can you do the following?

  • Open the dev console
  • Refresh the page
  • Clear the console
  • Try to filter as you described

Sometimes having the console already open before reproducing the error gives a better stack trace. If the stack trace looks any different, please share it again. It would also help if you turn off all other scripts first, just in case that stack trace isn’t from this script or there’s some other interference.

1 Like

I tried what you suggested . Turning off all other scripts except the Open Framework causes the Mutation Observer error message to disappear. The console is blank when I do what you suggest. I mean if I clear the console before filtering no new messages are produced by the act of filtering but the problem is still there.

An additional point: When I filter the first item is a vocab item called One’s Origin. When I am done with this lesson and move to the next item the Bar radical shows. This doesn’t produce error messages at the console.

I think the error in the console is caused by my WaniKani Item Info Injector library script. Seems like I have to hurry up and fix it.

1 Like

The error message occurs when I turn on the Keisei semantic Phonetic composition script version 1.8.9. Does it use your library script?

Yes, I have used my library script to prepare Keisei for the recent breaking changes to the lesson screen.

1 Like

As a quick fix, you can install the fixed version of WaniKani Item Info Injector manually from here – all scripts that @require it will use the newest version instead.

1 Like

I am confused. I only use scripts that @require Infor Injector. Why should I install it? Shouldn’t I let @require do its magic and get the most recent version from greasyfork?

The @require includes the specific version, e.g.:

// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=962341

(it ends with ?version=962341)

If the version were not specified, Tampermonkey would by default only update externals every week. Because the version is included in the URL, scripts that @require the library script can force the update – because the URL changes and Tampermonkey immediately downloads the new external resource. The disadvantage is that the scripts have to keep their @require tags up-to-date.

I have changed my scripts that use WK Item Info Injector to @require the newest version, and I am going to create pull requests for the other scripts that use it, but it will probably take a while until they are merged.

Just to make sure I understand, you’re saying that the filter action still doesn’t work (it doesn’t remove all radicals despite setting it to zero) even though no errors appear in the console? You did set it to zero and not leave the input blank, right?

I can reproduce the bug @prouleau described. Maybe the problem is that $.jStorage.get("l/currentLesson").rad is now null for image radicals since the update a few hours ago?

1 Like

See my screenshot. I filter Radicals and Kanji to 0 and have only 10 vocab. The Bar radical is not filtered but it is not counted in the counters at the top of the screen. Other radicals seems to be filtered because when I go passed the bar radicals only vocab items show up. This is a test with my current lesson set. The mileage may vary if a different lesson set is used but I can’t test this.

Yeah, I just saw Viet’s post. That’s what it seems to be. I don’t have any lessons available, so I can’t really debug through myself.

Can you or @prouleau try changing line 202 to the following and let me know if it fixes the issue?

if (queue[i][typePropertyName] === undefined) {

I really do need to get around to making a test account for stuff like this…


Seems to work with this fix. :+1:

1 Like

This fix seems to work without adverse side effect as far as I can tell.

1 Like

There appears to be another bug. The radical count in Lesson Filter doesn’t match the count in Lessons Hover Details.



When I filter to get all radicals and nothing else the bar radical doesn’t show up in the lessons.

1 Like

Is this before or after my suggested change? I can’t think of why this would happen with the new change. If it’s with the new change, should I revert it? I already pushed it up, but I’m not sure which bug is worse.

To look into this new issue I think I’m going to have to create a new WaniKani account to debug through. Hopefully I’ll have some time this weekend.

1 Like

It is both. I was able to produce the bug in both cases.

1 Like

Oh hehehe hahaha :confused:

1 Like

?? but dude cmon now.

@prouleau Can you see if the bar radical appears when you disable all scripts? From other topics with similar complaints, it sounds like it might be an issue with vanilla WaniKani, not this script.