[Userscript] WaniKani External Definition from Weblio (JP) and Kanjipedia



CORS has to be done on the server side, so unless you control the server, the only option is to use a CORS Proxy. A proxy is a middle-man server that adds the headers needed to bypass CORS.

See [here], for example, though I haven’t tested this particular proxy.

Updated the screen for Kanji. Also removed する for the する verbs

If you need a proxy, delete Line 23

proxy = '';

Confirmed not to work


Works with GM_xmlhttpRequest (greasemonkey has better examples, same API).

1 Like

Just as I am getting fucked by HTTP (Kanjipedia), but not HTTPS (Weblio). Works like a charm. Also works without ‘Disable Cross-Origin Restriction’.

BTW, it needs // @grant GM_xmlhttpRequest

Interestingly, it is GM_xmlhttpRequest, but GM.xmlHttpRequest. I use TamperMonkey on Safari, BTW.

Use @connect to whitelist domains by default and to avoid a spooky prompt window.

// @connect kanjipedia.jp
// @connect weblio.jp


Fixed the script to use observer() and MutationObserver. Please see if it still breaks.

Assuming you want to update new item:

$.jStorage.listenKeyChange(‘currentItem’, function(key, action) {
// do your stuff

jStorage documentation
Then you can just listen see if the info tab was opened or if whatever event you care about was triggered.
Anyways, doing this through jStorage might save you some sanity points.

Now, also added to lesson pages and item info pages.

ERROR: Execution of script 'WaniKani External Definition' failed! Argument 1 ('target') to MutationObserver.observe must be an instance of Node

Seems it is no longer works on info pages.
On review session all is ok.

Safari 12.1.1

1 Like

Which userscript can change “Vocabulary Meaning” to ”意味” in the prompt banner, as seen in the OP’s screenshot? I’ve searched for probably 3 or 4 hours and thought there wasn’t anything that could do that.

BTW, I noticed that during some vocabularly lessons this script was generating many 404s for random images like 7.png and others which looked like they could be icons for definitions. I couldn’t tell why the images were being loaded from the stack trace but once I disabled this user script they went away.

I think there is v0.6 – https://greasyfork.org/de/scripts/376666-wanikani-external-definition by @NicoleRauch

Is it fixed yet?

Uh - thanks for the reminder! :see_no_evil: :flushed:

I worked on it for some more but then life happened… Will look into it asap!

Also, @NicoleRauch


Might be fixed now, by using https://www.npmjs.com/package/@lyo/cheerio

// @require https://cdn.jsdelivr.net/npm/@lyo/cheerio

I just checked the code of the version I released more than a year ago (v0.6) and it fixes the problem with the WK error messages. So all good so far :slight_smile:

Back then, I had noticed that there were quite a few situations where the userscript would not work correctly for me (i.e. it would not give me a definition, and there were some issues with displaying the definition), and so I slowly started rewriting the userscript to address these issues. As it has been a while, I’ve released the current code today as v0.7: https://greasyfork.org/en/scripts/376666-wanikani-external-definition

If anybody still notices vocab words or kanji for which the information is wrong or is not being displayed, or any other issues, please feel free to notify me here.