[For Userscript Authors] WK Item Info Injector

Thank you so much! And don’t sweat it. Besides, I’ve had way longer wait times before so it’s no big deal. :bowing_man:

2 Likes

Version 3.2 (only a very small update):

Bugfix for Waterfox users

In version 3.0, I replaced [...stateSelector.under].reverse().find() with stateSelector.under.findLast(), but it seems that Waterfox is a bit behind the major browsers which adopted findLast() at the beginning of last year. For compatibility, I switched back to [...stateSelector.under].reverse().find.

// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1181453
1 Like

It would nice if the script supports Kana-Only vocabularies.

Currently, it doesn’t run in Review for those vocabularies, working only in item pages.


I am able to fix by installing the Injector manually (in the last order), and editing Line 265 to _currentState.type = (currentItem.subject_category || currentItem.type).toLowerCase();

Now, scripts like Anime Context and External Definition, start working.

1 Like

Thanks for reporting the problem – I have updated the script to support kana vocabulary. However, I have decided to not group kana vocabulary together with the other vocabulary. Instead, there are now four types: radical, kanji, vocabulary, and kanaVocabulary. I have updated the documentation in the first post accordingly.

Unfortunately, that means that scripts like Anime Context Sentences, that should work for vocabulary and for kanaVocabulary, have to be updated by adding “kanaVocabulary” in the forType selector.


Version 3.3:

  • Added kanaVocabulary support
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1207013
2 Likes

I have an update for this script to support the new Recent Mistakes feature. I don’t have permission to update the main script but I made a forked version here (link shows my code changes):

It’s a very simple change, it just treats it the same way as Extra Study. I found I also had to increment the version number to make it work. @Sinyaven please update when you can.

In the meantime anyone should be able to edit their local script with these changes in the Tampermonkey dashboard if you want to.

1 Like

Thanks for providing an update for Item Info Injector – I did not closely follow the developments on WaniKani for the last few months, so I did not even see the new Recent Mistakes feature yet. I am a bit surprised that they gave it its own URL instead of adding it as another extra study.

This also leads me to the question: should Item Info Injector differentiate between extra study sessions and the recent mistakes session? I’m wondering if it wouldn’t be better to treat recent mistakes as just another extra study session. :thinking: I feel like it’s all the same thing and can be grouped together, and I cannot think of a situation where a userscript author would want to inject their section only in recent mistakes, but not in extra study (or vice versa).

I will think about it again in the evening, and if there are no arguments against it, I will probably just include recent mistakes in extraStudy.

1 Like

That makes sense to me, that’s probably easier :slight_smile:

1 Like

Version 3.4:

Added support for recent mistakes quiz+lessons

Thanks again @chiaracoetzee for letting me know about this WK change and providing code addressing it. I decided to put the recent mistakes quiz into the extraStudy category and the recent mistakes lessons in the lesson and lessonQuiz category.

Bugfix for review queues longer than 100 items

Thanks @theusaf for reporting this issue. I based my code on the assumption that the DOM element containing the item details would be updated when new items are loaded, but it seems that isn’t the case (I never tested it because I was too lazy to go through >100 items – I’m not using WK anymore. I also did not test the bugfix of this version, I just hope that it will work :laughing:).

Bugfix for hotkey E not expanding custom sections correctly during reviews

The hotkey functionality seems to have broken at some point. This should be fixed now.

// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1241826
2 Likes

The script is now broken in Lessons. Also, Lesson URLs have changed /subject-lessons/-${session_id}/...

1 Like

See the following for the full URL changes:

2 Likes

I will try to look into adapting this to the WaniKani lesson changes after I come home from work.

1 Like

Version 3.5:

  • Updated to work with today’s lesson URL change
  • Inserting nav links at the top of item pages was also broken – fixed as well
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1276163
1 Like

If some scripts use an older version of Injector (while some use the latest), the nav bar would be broken.

1 Like

Thanks for the bug report. I did not have time yet to look into this problem, and I’m not sure if I want to invest too much time into this, since it can be solved by installing Item Info Injector so that all depending scripts use the same version. But I will try to see if it is easily fixable sometime this week.


Version 3.6:

  • Bugfix (lesson queue_id in the URL can be negative)
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1276693
1 Like

@Sinyaven seems something broke a bit, I got a bug report, that my script wasn’t working, and apparently it seems the object received by the callback functions doesn’t contain “composition” anymore. Do you perhaps know what could be up?

1 Like

Thanks for letting me know.


Version 3.7:

  • Extracting composition info from the HTML was broken after some WK update; should be fixed now
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1285431
2 Likes

Neat, thank you, that seems to fix my userscript!

1 Like

Version 3.8:

  • Updated so that it works again on “recent mistakes” lessons
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1326536

Version 3.9:

  • Fix for missing icons after WK removed FontAwesome
  • Fix for wrong font being used
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=1343973