[For Userscript Authors] WK Item Info Injector

Version 1.2:

Now works with the recent update to the lesson quiz

Recently, the additional information panel in the lesson quiz was converted to React. WK Item Info Injector should now work again during the lesson quiz (both with and without script compatibility mode).

In the React version, the item info is created when the user proceeds to a new item (in the old version, it was only created once the user opened the item info). I decided to match the new WK behavior and also inject the info at that point instead of waiting for the user to open the item info. This speeds up opening the (unexpanded) item info, but causes a lot of unnecessary injections (for every review instead of just on demand). I’m not sure if this was the best solution or if I should change it in the future – especially once the review page is also converted to React.

Kanji lesson meaning side info column added on demand

During kanji lessons, the side info column is not rendered anymore if there are no meaning synonyms. WK Item Info Injector now adds that column on demand (as was already done in the case of radical lessons) so that it is still possible to inject item info in this location.

Minor bugfixes/improvements
  • In some cases, side info was injected at the wrong place on item pages.
  • WaniKani now displays side info in a darker text color (class="text-gray-700"). WK Item Info Injector now automatically adds this class to injected elements.
// @require      https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=985948

Can someone explain to me how userscript authors are supposed to make use of WaniKani.version? I was expecting the compatibility mode to be on an older version number, but both modes are on the same version. WaniKani.wanikani_compatibility_mode can be used to differentiate between compatibility mode on/off. But if the version number is always the latest, is the version number even useful in any way?