[Userscript] How to make scripts?

What doc did you use to make user script ?
There not much information/ examples about it exept on the GitHub - rfindley/wanikani-open-framework: Open framework for writing userscripts for Wanikani.
I have few idea of non existant script that i will be happy to code by myself.

1 Like

Userscripts are generally written in Javascript, and generally have the same access to a page as normal Javascript running on the page has. So if you search for documentation or tutorials on how to use Javascript on websites you should be able to find everything you’re looking for. Aside from that the Open Framework you’ve already found is a library most userscripts on WK use to help with fetching data from WK’s API. If you want specific examples for userscripts, I’d recommend looking at the code for some of your favorite userscripts to see how they do things.


yes, i noticed they were using the dom , and javascript. i checked some script but the lack of comment on the code and the complexity of them make it hard to follow and to reverse engineer ( at least require more effort than i willing to give).
So mostly they use the open framework to make some request in json from the api ?
Im willing to take more input if somebody has a better way ? :grin:

Most of them do. The Open Framework also caches requests between various scripts, and since most of them will be querying similar information (usually item information), that makes loading a lot smoother. It’s also a lot easier to use the Open Framework than to manually use the raw API.

Most scripts will have something along these lines to fetch data from WK:

// Check if the Open Framework is installed, and if not display some error message
if(!window.wkof) {
    alert("WKOF isn't installed");

//Load the ItemData module, which provides access to item information from the WK API

// This function is called when the ItemData module is loaded
function fetch_items() {
    //ItemData is ready, we can now query subjects, as an example, let's get level 1's radicals
    var config = {
        wk_items: {
            filters: {
                item_type: 'rad',
                level: '1'

// This function is called when the items are retrieved, it's first argument is a list of all the items we asked for.
function process_items(items) {
    // This is where you would do something amazing with the data, for now we'll just print it all to the console.

The objects given to you by the Open Framework match the format of the JSON objects returned by WK’s API, as described on this page. I’d recommend just playing around with it a bit, and see if you can get everything to work. :grin:


Seem pretty good , yep i think i will play with the console and so on.

Depends on what you want. Writing userscripts is not hard, just time consuming. I would choose a simple goal and try to achieve it first, that would teach you more than trying to reverse engineer someone else’s script.

1 Like

Looking at the jStorage in the chrome inspector → Application → Session Storage → jStorage
helped me a lot to understand what going on.
I had to learn using jStorage from here GitHub - andris9/jStorage: jStorage is a simple key/value database to store data on browser side
Weirdly enough while coding the script im doing my review and im not even noticing me working on them.
It’s good way to cheat your brain while doing something you like .