[Userscript] Kana Vocabulary Injector (for testing)

Kana Vocabulary Injector (for testing)

This script injects a sample Kana Vocabulary into the results returned by wkof.ItemData.get_items(), so script developers can test scripts that use wkof as their data source.

It does not inject anything into non-API data sources such as the review queue.

:warning: This is a third-party script/app and is not created by the WaniKani team. By using this, you understand that it can stop working at any time or be discontinued indefinitely.

[Download / Install]

10 Likes

@kumirei, @prouleau, @Gorbit99, @Sinyaven

Please tag anyone else who may find it useful.

5 Likes

Very nice.

This should be added to the forum post to all user scripts, as well as pinned to the `API and Third-Party-Apps" category.

I’m adding it to the writeup of my two simple (and one obscenely complicated and currently broken) scripts.

2 Likes

Wanikani sent out an email, presumably to everyone that [signed up] for the developer email list, asking developers to add the message to script threads.

I used the text they provided, and added the :warning: icon and quote block.

3 Likes

@rfindley Thanks for this. It will be definitely useful.

@seanblue tagging you in case you find this useful.

Thanks again for this script. I was able to test and debug all my filters as well as Item Inspector. I am as ready as I can get for the release of kana vocabulary items on next Wednesday.

Item Inspector relies on some of your (@rfindley ) scripts for some of its functionality. Here is the current status as far as I can tell.

  • Self Study Quiz never asks questions for kana vocabulary items, not even when they are responsive to the quiz filters.
  • WKOF Item Type filter does not provide UI for the new kana vocabulary item type.
  • Item List Filter does not provide UI for the new kana vocabulary item type.
  • Blacklist Filter does not provide UI for the new kana vocabulary item type.
  • Part Of Speech filter does not return the kana vocabulary item even when it is responsive to the part of speech query.
1 Like

Thanks for the info, and I’m glad the script has been useful.

Hmm… it should on the latest wkof and Self-Study Quiz.

Again, it should on the latest wkof.

Yes, that’s correct. I haven’t updated that one.

Is that my script? I don’t remember writing a blacklist.

I forgot I made that script. I’ll try to track down the thread.

2 Likes

I see the wkof is updated but not Self Study Quiz. Perhaps this is just a case of greasyfork not having propagated the update to the server servicing me. I will check it again in a couple of days.

You definitely wrote a blacklist filter

I got the Self Study Quiz working now. I noticed something is off with the CSS of kana items. Wanikani has indicated they will use the same purple background as for regular vocabulary. SSQ uses black background.

I’ve updated [Item List Filter] and [Blacklist Filter], and fixed the background color on [Self-Study Quiz].

Also, in case it’s helpful, here’s a code snippet to replace the Review queue with a single Kana Vocab:

document.querySelector('[data-quiz-queue-target="subjects"]').innerHTML='[{"id":9210,"type":"KanaVocabulary","subject_category":"Vocabulary","characters":"おやつ","meanings":["Snack"],"auxiliary_meanings":[]}]';
document.querySelector('[data-quiz-queue-target="subjectIdsWithSRS"]').innerHTML='[[9210,1]]';
function get_controller(name) {return Stimulus.getControllerForElementAndIdentifier(document.querySelector(`[data-controller~="${name}"]`),name);}
let quiz_queue = get_controller('quiz-queue');
quiz_queue.initialize();
quiz_queue.nextItem();

2 Likes

Thanks a lot. If I followed correctly there is only the Part of Speech filter that is missing.

Also @Sinyaven @Kumirei @Gorbit99 @seanblue there is a test code snippet for scripts that manipulates the review queue in the previous post. Please tag more people that could be interested.

2 Likes

No need to tag me in these. I’m not doing anything with kana vocab right now.

Not even the lesson filter?

Is there a reason it should differ from kanji-based vocab?

1 Like

Their object type is not vocabulary. There is a new object type called kana_vocabulary.

To make matters worse kana item will have the same purple background as the vocabulary. The new object type has no UI visibility on users but it wreaks havoc on scripts that care about object types.

sigh

Alright, thanks for the heads up.

1 Like

The background color on Self Study Quiz has not been fixed everywhere,

SSQ

Thanks, although I’m not sure I’ll have time to update my scripts before the change goes live. I have been very busy recently

1 Like

This is making it a bit hard to decide how to handle this in Lesson Filter. I can either pretend vocabulary and kana_vocabulary are the same, and have just a single filter value that includes both sets and generally lumps them together. Or I can treat them separately by adding a new filter input for kana_vocabulary, but then I’m making them into two things when the vanilla WaniKani UI will treat them the same.

1 Like