[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: GitHub - evolutionxbox/WaniKani-100-Review-Fanfare: 100% review score is hard! Congratulate yourself with a wonderful 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 Source-to-source compiler - Wikipedia 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