[Userscript] Wanikani 100% Review Fanfare

Wanikani 100% Review Fanfare script written by me.
Inspired by @PabloM from Victory sound for 100% review result

:tada: A 100% review score is hard! Congratulate yourself with a wonderful fanfare!


Latest version: v0.3.1

Download: https://greasyfork.org/en/scripts/410114-wanikani-100-review-fanfare
Contribute: https://github.com/evolutionxbox/WaniKani-100-Review-Fanfare/

Known issues:

  • Firefox and Chrome can sometimes block autoplay audio due to a user not “interacting” with the website
  • Wanikani must have been given permission to play audio before the script will work

Credits:

  • Original script: me
  • Idea by: @PabloM
  • Audio by: Nintendo

If you encounter any problems, please let me know below!


Please note this uses the Zelda BotW “Key Item” fanfare. I used this tool to encode the audio file. To use your own audio, swap out the value of base64audio with your own encoded audio.

9 Likes

Installed, thanks for making this! :smile_cat: now, to just ace my reviews!

Edit : Confirmed to be working, this is great!

3 Likes

Congrats on the 100% review!
(I’m totally not jealous)

Please may you keep an eye out for performance issues as well?

2 Likes

It was a small session :wink:

And I’ll keep an eye out for any issues!

1 Like

I’ve tried it a few times, and I’m not getting anything… :face_with_raised_eyebrow:
I assume it’s meant to trigger when you return to the Review page after the review.

Not sure what the problem might be. I’ve allowed sounds in Site Settings (Chrome).

If I have other sound-playing tabs open, might that interfere…??
:man_shrugging:

Hmmm. I’ll do some more testing in chrome.
Thanks for the heads up though!

Hmmm. I can’t seem to replicate your issue.

Would you mind making a github issue? Or reply here with the following:

  • OS
  • Browser version
  • any relevant browser console errors (Ctrl + alt + J)

Edit: I smell a bug I don’t know how to fix…

So I’ve been using this element (it has a timestamp)

image

to figure out how long ago the last session was, so the fanfare doesn’t play before a session is started.

However I didn’t properly read the text. It says

Your last session started

le sigh

So I have two options:

  1. Remove the “less than a minute ago” restriction. This means the fanfare will play before you start a session if your last session was 100%.
  2. Everyone must 100% all their reviews in under a minute…
1 Like

Windows 10
Google Chrome v85.0.4183.83 (Official Build) (64-bit)

I don’t know anything about console errors etc, sorry.
But i had a noodle around. I found Inspect (Ctrl + Shift + I), and found what looks like what you’re asking for.

This is what I got right after getting a 100% review:

DevTools failed to load SourceMap: Could not load content for chrome-extension://fceblikkhnkbdimejiaapjnijnfegnii/retailerContent.bundle.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
www.wanikani.com/:8
GET https://js.honeybadger.io/v2.2/honeybadger.min.js net::ERR_BLOCKED_BY_CLIENT
/review:1
GET chrome-extension://hfapbcheiepjppjbnkphkmegjlipojba/fonts/fontawesome-webfont.woff2 net::ERR_FILE_NOT_FOUND
/review:1
Unchecked runtime.lastError: The message port closed before a response was received.
?empty_queue=true:6
GET https://js-agent.newrelic.com/nr-1177.min.js net::ERR_BLOCKED_BY_CLIENT

I don’t know what any of that means, but I can’t see anything related to this script…

1 Like

I’d probably go for option #1.
You get a fanfare again. I can live with that!

1 Like

Ah, this explains it! It worked well yesterday with a small review session, but was just about to post that it didn’t play any sound after my latest session. I don’t mind having a sound play before the sessions too, feels like opening my own little treasure chest of Kanji :smile_cat:

Whatever scenario you decide to go with, I’m sure it’ll be the right choice! Thanks again for making this!

ikr? It’s like a little reminder of your previous victory!

2 Likes

Thanks for the reply. It doesn’t look like those logs are related to the user-script (which is good I suppose).

I have removed the “time since last review” restriction, and I’ve also added some logs for when things go wrong. They will be prefixed with “Wanikani 100% Review Fanfare”.

1 Like

Haha! That’s awesome! :smile: :+1: :trophy:

EDIT: @evolutionxbox So I’ve got myself a little base64 playlist now. :crazy_face:
But I have no idea how I would randomise which audio gets played.
Can you help with that? :pleading_face: :wink:

I would turn the base64audio variable into an array, and then choose one at random.

For example:

/* array of base64 audio files (there is likely a better way to do this) */
base64audio = [
  'data:audio/mpeg;base64,AAA... ',
  'data:audio/mpeg;base64,BBB... ',
  'data:audio/mpeg;base64,CCC... '
];

theSound = new Audio(
  base64audio[base64audio.length * Math.random() | 0]
);

For the curious, the user-script is not written in ES6 mainly because I couldn’t be bothered to set up transpilation…

1 Like

Interesting. Thanks!

EDIT: @evolutionxbox I did some editing and managed to get a cool randomised fanfare! :grin:
I tried to post it to RustySpoon but the file was too big. I did have like 16 base64 audio clips encoded in it, though. :rofl:

1 Like

Good effort! (What’s rustyspoon?)

I‘ll probably add a feature to use any audio you like via a preferences panel or something.

This way we won’t need to encode the audio ourselves.

1 Like

This sounds like a madeup word…

I wish it were. It’s caused me many a headache since 2013…

According to https://en.m.wikipedia.org/wiki/Source-to-source_compiler the word has existed since 1993 or maybe even since 1988!

https://babeljs.io/ is one example of a transpiler

1 Like

:rofl: I meant Greasy Fork. I was trying to make a stupid joke.

Hahaha :joy:
That went straight over my little head

1 Like