[UserScript] Advanced Context Sentence

Feel free to tell me of any bugs you find or any improvements you wish for. Nothing can become perfect without others’ feedback, after all

1 Like

First I’d like to say thanks for this script, it’s really helpful!
The voice option is awesome, as with it I can check if the reading in my head actually made sense. Made these phrases something that I’d halfhearted read most of the time to pretty enjoyable for learning!

I do have two requests, however: is there a way to identify if you haven’t learned the kun reading for a kanji and mark it as gray? Some of the kanji will use readings that I have not learned yet, even if I’d already learn the on readings, like a reading from the same level that I haven’t encountered the kun form yet, but it’ll be on one of the examples. They are currently marked as “learned”. This is just an aesthetic though.

The second request is to be able to stop the voice messages after they started by clicking the button again. Currently if I press twice it’ll play two messages at the same time, and there’s no way of stopping them. Also, when I press enter to move to the next lesson it always plays back the last audio that I clicked, though it won’t interfere with the default behavior at all (ie, I don’t need to press enter twice).

Sorry for the requests, but really thank you for taking your time to develop this, @abdullahalt!

For the first request, i can highlight the reading you didn’t learn in the kanji review, but there is no way for me to know when you will take the other reading. Basically, gray will mean “hey, this is the other reading you didn’t learn in the kanji review” not “this is a reading you haven’t learn yet”.
As of the second, i think i can manage to do it.

Don’t be! And thank you for taking the time to write a review

1 Like

I don’t have this issue on Firefox, what browser do you use?

1 Like

I see, thank you anyways then!

I use Chrome, I’ll test it again and report back in a bit.

Edit: Couldn’t reproduce this on my other computer, so can be an old chrome version problem. I’ll check back again tomorrow!

I’m using WaniKani Breeze Dark theme and the custom colors on kanji isn’t working.
It’s all blue:

It works fine when I turn the theme off:


Maybe you can fix it? If you can’t it’s okay, I will keep using it. :blush:

Thank you for reporting this, it has been fixed now.

Done, check out the new version.

Sorry I totally forgot about this issue until @Poikkax posted the screenshot, it should be fixed now


Thank you! :heart:

1 Like

It’s working now, thanks!

1 Like

In the images besides the first one, there are two different colours of kanji. What’s the meaning behind the different colours?

Oh i might have updated the post too many times that i deleted it by mistake, the script highlights all kanji in two colours, the first colour for gurued kanji and the other for kanji you didn’t unluck yet or still in apprentice
Edit: but that’s only if you have Wanikani Open Framework, otherwise it will highlight all kanji regardless (since there would be no way for me to know whether you gurued the kanji or not)

Yeah, I have the WOF. I had to get it in order to install all of my favourite scripts that had been updated to use it on the new computer.

I’ll give this a try.

Do you mean “you did the lesson” vs. “Guru+ aka You Should Know This”? If so, can we change Guru to Enlightened or Burned? ?

EDIT: Oh wait, having now installed it I see that you mean “HAVE NOT yet learned” vs. “Guru +” Hmm… could there be a third option for “you did the lesson”? Or change that “not yet learned” to that… since the ones we haven’t learned should be the generic website/stylish/theme we’re used to seeing, and not stand out…

EDIT 2: Also, you mean “unlocked”, not “unlucked”. Although, to not know those kanji is pretty unlucky…

The second one, it means this kanji is in guru or higher and you should be able to recognise it

No, i don’t think there’s any reason to do that. The whole point is to tell you if you should be able to recognise it or not, it’s not for indicating the kanji SRS level. But in the other hand, i might add the Current SRS Level to the hover pop up


My reason for it to be burned instead (or a higher/variable level) is so that you know you’ve really learnt the item. At Guru, it’s still kinda only in your short-term memory. I suppose what the best feature would be, would be to allow the individual to decide which level for the items to be on their own.

Also, is it possible for it to recognize WK Vocab, and not only kanji? I noticed in one context sentence, for instance, that 第一 was separated into two separate items. The pronunciation (reading) works in this case, but the kanji and the vocab don’t always follow the same reading - especially in the case of rendaku or rare readings.

1 Like

Although, I suppose I could look at the code myself and see if I can change the word Guru to Burned and see if that works… *shrugs*

Right. I saw that too. Novel, 小説, was read kosetsu, instead of shousetsu, but it wasn’t 小説 whole kanji like this, it was 小せつ。

You’re probably right, although I really don’t see the point but it’s wrong for me to enforce my view to the user

Well that would require a lot of processing, it’s not easy to process a text not separated by space for vocab, not to mention trying to match it for a Wanikani vocab. don’t forget we should ignore the conjugations in the search too… yeah it’s not impossible but i didn’t find a library to do that for me and I really don’t have time to implement it myself from the ground up

in the function renderKanji you’ll find the line
!wkof || (kanji && kanji.srs > 4) ? "guruedKanji" : "unguruedKanji"
change 4 to a higher number for a higher SRS level, see how hard is that? can’t do it myself

1 Like

How far down the code is it? What line-ish should I be looking for? I think I will change it to burned in my case (8, I’m mostly certain).

EDIT: What would happen if I delete all the audio stuff? Would it break it?

As for the vocab: ah, I would have expected the list to be in the API v2 data or something you could call on easily - but even then, yeah, more time to program. Okay.

Hmm… still haven’t found the place to change the step yet, but I’ve done this…

        guruedKanjiColor: {
          type: "color",
          label: "Burned Kanji",
            "Kanji you have Burned will be highlited using this color",
          default: state.settings.guruedKanjiColor
        unguruedKanjiColor: {
          type: "color",
          label: "Unknown Kanji",
            "Kanji you have on Apprentice or have never been unlocked will be highlited using this color",
          default: state.settings.unguruedKanjiColor

EDIT: Hmm… made it to the end of the code and still missed it… CTRL-F doesn’t work either with the long string…

It’s not an issue, I can ignore any other reading and focus only on what Wanikani taught. would be also a great feature if I linked the jisho page for that vocab. But sadly, as I said, I didn’t find a language processing library for japanese that could serve me here

you can just ctrl+f and search for the function name
Edit: Line 357

No they’re not related in any way, in the function evolveContextSentence delete these two lines:
var audioButton = createAudioButton(japaneseSentence.innerHTML);


Edit: line 159 and 168