[Userscript] WK Vocab Breakdown

:warning: This is a third-party script/app and is not created by the WaniKani team. By using this, you understand that it can stop working at any time or be discontinued indefinitely.

This is a jukugo word, which usually means on’yomi readings from the kanji. If you know the readings of your kanji you’ll know how to read this as well.

“No, actually, I don’t”

Features

This userscript modifies the reading and meaning sections during reviews and lessons to include the mnemonics (and hints) from the kanji that make up the word. The script does its best to detect when a word can be broken up into the learned readings, sometimes this won’t work, tell me when they don’t, and I’ll try to fix them.


Usage

Just install the userscript and from then on, every time a word is cleanly split into it’s kanji readings, the script will do its magic and include the mnemonics.

Installation

The script requires Wanikani Open Framework to work (this is so I can get the mnemonics)
Visual Guide on How to Install a Userscript
Installing Wanikani Open Framework
Link to the userscript itself

Feedback

If you find a word that’s broken, the userscript is not working or it’s incompatible with another one, or you just want to request a feature, feel free to leave a reply. Please include screenshots for bug reports, it speeds up the fixing process around 10x.

6 Likes

Don’t forget to add your scripts to the list!

1 Like

I… uh… have some to add, currently I have 15 scripts for wanikani

1 Like

Seems pretty convenient for avoiding opening the kanji pages in new tabs. :slight_smile:

I’m assuming it only works for readings taught during kanji lessons? Or does it also help for items like 見当たる?


For 誇大 I get an error. In the line

&& frontRendakuTransforms[wordChar].includes(possibleChar)) {

wordChar is “だ” which is not in frontRendakuTransforms.

I have also noticed that sometimes your info is not added when I’m opening the item info – in these cases I have to close and reopen it. Maybe there is a race condition? I only took a glance at your code and noticed a setTimeout(handleNewItem, 200) – but maybe that’s unrelated to the problem.

It might be nice if your info is also added after a meaning question when the user completely expands the item info to also view the reading info.

More generally, I think it would be useful if your info would also be available during lessons, extra studies, and on the item pages.


And now some shameless self promotion :stuck_out_tongue:

Since writing code for injecting additional item info into WK can become annoying, I have written the library script “WK Item Info Injector”. You could use it to get notified when a new reading info section was created[1] and insert your DOM elements yourself, or you could let WK Item Info Injector handle the insertion[2].


  1. wkItemInfo.forType("vocabulary").under("reading").notify(yourCallbackThatInsertsTheDOMElements);
    
    ↩︎
  2. wkItemInfo.forType("vocabulary").under("reading").appendSubsection(null, yourCallbackThatReturnsDOMElements);
    
    ↩︎

Oh, thanks a lot, forgot that, if you have a character that can’t rendaku, you’ll get a nice old error.
I’ll look at it tomorrow or tonight if I can.

1 Like

Any chance this will be revived after the scriptpocalypse?

I’ll put it on my list.

1 Like

Decided to just completely rewrite this script, so first of all I’m now using @Sinyaven’s item info injector (thanks). This has 2 major effects. One, the script itself is much more reliable, since the previous method was kind of a patchwork of bad code and hopes and prayers. Secondly, I can be way lazier, which is always a big plus.

So, rewrite and stuff. The script is now not “Reading Breakdown” rather “Vocab Breakdown”. This is because instead of just showing the matching readings, it also shows up on the meanings panel. The whole look was also somewhat revamped, now it looks like this:


This should make it fit the wanikani aesthetic much better than the old design.

Readings only show up if their primary, taught readings are the one showing up in the vocab. The script tries to extract this from the mnemonic (since sometimes this is mentioned), but falls back to the first defined primary reading (yes, I’m really proud of this feature, thanks for noticing). For example in the above picture, す doesn’t show up, even though it’s marked as a primary reading, since the mnemonic actually teaches そ. Rendaku and breakdown detection was also greatly simplified and should be much less prone to errors.

3 Likes

1000 likes. yes. absolutely this!

1 Like

Small update, entirely forgot that small tsu is a thing that exists, so now that should be handled under the umbrella term of rendaku as well. Also now, if the reading breakdown section would be empty, it just gets omitted

1 Like

And another small fix, I made a mistake and that caused words such as 役割, where a kanji has two readings, one contained in the other (in this case わ and わり were both readings of 割), to accidentally prioritize the shorter reading of the two

1 Like

Stopped working :confused:

Is there a way to revive it?

Seems like the library I’m relying on broke. I already told Sinyaven about it, so I’ll get back to you once it’s fixed.

1 Like

@ikeben Sinyaven went and updated their script, so now this one is also working, if you update to 0.2.3

4 Likes

Thank you for the quick fix!

Don’t thank me, I’ve done nothing.

Hello, superbe script. Could you also add the list of onyomi and kunyomi reading within the reading breakdown ? Maybe by making it an option.

Do you have an example of when this would be helpful? Currently a kanji is only shown in that section, if the taught reading itself is used in the word. I don’t quite see the point of also including the rest of the readings in that section.

I just installed this script and I think people like you, providing the community with such neat features are truly undercover heroes. Thank you very much! <3

1 Like

It still works fine in lessons, but in reviews the readings stopped showing for me a few weeks ago.