[Userscript] WK Vocab Breakdown

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);
    
    ↩︎