[Userscript] WaniKani Lesson Examples Audio

What is it?

This script adds audio buttons underneath the example vocab during kanji lessons.

How to Install?

  1. As always, make sure you have a script manager installed. If you don’t, follow these instructions.
  2. This script depends on the WaniKani Open Framework. Make sure you have that installed by following these instructions.
  3. Get the script here: https://greasyfork.org/en/scripts/370373-wanikani-lesson-examples-audio

Support

  • This script has only been tested in Chrome using Tampermonkey, but will likely work in Firefox as well.
  • Please post any bugs/requests and I’ll get back to you as soon as I can.

Revision History

1.0.2 - Add support for preferred pronunciation voice setting.
1.0.1 - Decrease the chances of conflicting with other scripts.
1.0.0 - Initial release

11 Likes

Aw, I just realised that this doesn’t work for me. There are no errors in console, so it’s probably not compatible with one of the other 31 scripts I have running on the lessons page.

Does the audio button just not show up? Or is there no sound when you click it?

No button.

Maybe it can’t find the element on the page from the style changes. You’re welcome to debug through to see where it’s failing if you want. If so let me know what you find and I’ll see what I can do.

I wasn’t going to bother looking into it, but I changed my mind. The issue seems to be that the $('#supplement-kan-related-vocabulary').on('show', ... on line 44, in initialize, isn’t triggering. Not sure how the show event works, so I don’t know why it’s not triggering.

I see from your picture that the Examples tab isn’t in the normal place. It’s possible that it uses a different ID. In the console run $('#supplement-kan-related-vocabulary'). Does it return any elements? If not then you can probably update the selector in my script to use the right ID.

Sorry, forgot to mention, but I checked that. It’s the same ID. Also, the tab transmutation script was a likely candidate for interference, so I tried disabling that before posting, so it’s definitely not that.

Ah okay then. Well I don’t have any other ideas off the top of my head.

I finished all my lessons, but I’ll have another look next time

I just released a minor update to decrease the chances of this script conflicting with other scripts. Let me know if anything weird happens.

@Kumirei There’s a slight chance that these changes will fix the script for you, so let me know.

1 Like

I just updated the script to support the recently added preferred pronunciation voice setting. Now the button will play audio by your preferred voice if it exists for that vocab item. Otherwise, it will just play whatever audio is available. If no audio is available at all, the speaker icon won’t be added for that vocab item.

1 Like