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.
For users of Self-Study Quiz
This scripts adds filters that allow you to study kanji by JLPT level, Joyo grade, and and Frequency bracket.
This script adds, in addition to the above three filters, another three filters which just add data to the items in your request. Note: This script only adds info to kanji.
include_jlpt_data: Adds a field jlpt_level to each item that has an associated JLPT level. Possible values are 1-5.
include_joyo_data: Adds a field joyo_grade to each item that has an associated Joyo grade. Possible values are 1-6 and 9.
include_frequency_data: Adds the following fields to each item that has the associated data:
frequency one of the integers 500, 1000, 1500, 2000, 2500 indicating the frequency bracket of the kanji, where 500 means it’s one of the 500 most frequent kanji.
nhk_frequency a float between 0 and 1 indicating the relative frequency in NHK Web Easy online news articles.
news_frequency a float between 0 and 1 indicating the relative frequency various news articles.
aozora_frequency a float between 0 and 1 indicating the relative frequency in Aozora Bunko fiction/non-fiction books.
twitter_frequency a float between 0 and 1 indicating the relative frequency in twitter posts.
wikipedia_frequency a float between 0 and 1 indicating the relative frequency in wikipedia articles.
When using these filters that only add data you can set the filter value to anything, it doesn’t matter whether it’s true or false or anything else.
Hope I’m the first developer who used it? The new version of Advanced Context Sentence now uses your filters.
One thing I noticed is that you don’t have a way for us to check if the script is installed of not, so I had to @require it. but this is bad since you require Wanikani Open Framework to be installed and I don’t want my script to be only runable if a certain script is installed first. so now anyone who didn’t install Wanikani Open Framework will get your script dialog every time they refresh the page
I would force Wanikani Open Framework usage, but since there are features that can be done without it (highlighting and audio, in my case), then it’s kinda bad to do
I see. I can remove the wkof check in the filter script.
I think requiring the filters is the best way though, to avoid having too many dependencies for users to download.
I’m using the filters too… So technically you’re not the only one
This was probably not necessary since it will be installed as long as the user has wkof (and you can just check whether they do), but I added a global variable to indicate whether the script is running. window.jlpt_joyo_freq_filters contains a boolean
I removed the alert asking the user to install wkof. If they do not have wkof then the script just won’t run. Should still be fine for my script and it should be fine for anyone using it with the self study script.
When a script needs to wait for a service to become available:
// wkof.wait_state(state_name, state_value[, callback[, persistent]])
// * If no callback, a Promise is returned
// * If persistent==true, the callback will be called each time the state
// changes to the desired value.
wkof.wait_state('ScriptA.status', 'ready', ready_callback);
@require refers to a specific version, and won’t receive updates
What if two scripts @require different versions of the same add-on? One will overwrite the other, depending on the order in TamperMonkey (or whatever).
This case never crossed my mind. In my current state, i think my script will break if wkof is ready but jlpt is not. Is there a way for @Kumirei to add his “ready” flag with wkof.ready? In this case i can just do wkof.readt(“Settings, Jlpt”) for example
For version 0.1.3, you added a flag to let us know your script is ready, but no flag for us to know when you’re ready to provide services. I think it’s better to follow @rfindley’s advice and go with wkof.set_state.