Script that Displays Vocab Word

One of my biggest frustrations is having to go outside of the program to find words that a kanji is in. When you get an item wrong and look at the info, I want the vocab words there. Very useful when I know a word that the kanji is in.

These words are there in the lessons! I don’t understand why they aren’t in the info page

Anyone know of a script that puts the lesson examples in the info page?

I tried to create one, but I couldn’t put the CSS in. WaniKani Review Session Kanji Get Vocab Info

@acm2010 Any advice on how to add a CSS style like your Keisei, so that it resembles Kanji Info pages?

1 Like

@polv I have reached a quite usable state for this, please try:

In your .user.js (includes a CSS file with the the relevant styles taken from WK)

// @resource chargrid https://raw.githubusercontent.com/mwil/wanikani-userscripts/7caebf537b4d02084d85f1a19d26b50c185d8d05/styles/css/chargrid.css

// @grant       GM_addStyle
// @grant       GM_getResourceText

In your JS (adds the style, and guards it from crashing into WK’s styles).

GM_addStyle(GM_getResourceText(`chargrid`)
            .replace(/wk_namespace/g, GM_info.script.namespace));

You need to add the contents of GM_info.script.namespace as a class to your surrounding container as well (and add // @namespace your_name_here of course!).

Also, I’m using the sandbox of GM (instead of @grant none), if you do stuff with the global variable window you might see that that doesn’t work anymore, you need to use @grant unsafeWindow and window = unsafeWindow as well once you add @grants.

The class of the <ul> should be multi-character-grid, and the <li> inside need class character-item and id vocabulary-1 with increasing numbers (the important part is that it starts out like that, and the hyphen). Then it should work already.

2 Likes

Thanks & Updated.

I don’t know why it is ‘Locked’, though; still, I can easily remove it via $('.item-vocabulary li').removeClass('locked');

→ Perhaps a login issue. I wonder if @rfindley has dealt with this in Burn Manager?

1 Like

mmm… I’m not sure what you’re talking about. Certain vocab items are showing up as locked on your Found In Vocabulary section? I don’t recall seeing that, but I’ve been on Level 60 for a long time…

1 Like

You guys rock!

I just installed it and I will report back from my level nine viewpoint.

EDIT:

So this is working well. It displays the sentence examples information in there when it’s a vocabulary word or kanji and the related kanji when it’s an on’yomi.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.