[UserScript] Leech List Burn-Only Upgrade

I wasn’t expecting this thread to be so old. It’s amazing the script still works after all this time. I see that OP hasn’t been seen in a bit over a year, but I thought it good to share here anyway. I noticed today a couple of problems with the script: that the config for get_items has an error, resulting in open framework returning all items on WaniKani; and that a couple of items that should have been marked 不可能 were not. This original method to determine if a leech will only reach a value of 1.00 by burning is not correct.

If anyone wants to edit the code manually, here’s what to do.

The correct config is:
const config = {
    wk_items: {
        options: {
            review_statistics: true,
            assignments: true
        },
        filters: {
            srs: {value: '-1,0,9', invert: true}
        }
    }
};
To fix the calculation of 'impossible':

We can replace the line that sets item.startleech and the entire switch statement that follows with:

item.mustBurn = (item.highestincorrect - item.highestincorrectstreak) + item.assignments.srs_stage >= 9
if (item.mustBurn) {
    item.impossible = "不可能";
    item.impcnt = 1;
}
else {
    item.impossible = " ";
    item.impcnt = 0;
}

Furthermore, we can replace the srs stage name switch by making use of a const declared near the beginning of the function and a single line to replace the switch:

Better code for assigning stage name
// near top of function, probably right after globals comment
const srs_stages = [
    'Initiate',
    'Apprentice 1',
    'Apprentice 2',
    'Apprentice 3',
    'Apprentice 4',
    'Guru 1',
    'Guru 2',
    'Master',
    'Enlightened',
    'Burned'
];

// then replace switch(item.assignments.srs_stages) with the following line
item.srsstagename = srs_stages[item.assignments.srs_stage];

If you’re still around using this, I hope these fixes help :3

1 Like

Looks like the userscript has finally croaked. It’s no longer showing up on my dashboard.

Oh, not necessarily, it just looks like they changed the structure of those tables at last. At some point I’ll figure out the fix for it and make another update post here to go along with what I put above.

Update: I’ve gotten it working again on the dashboard but I don’t have any critical condition items to test out on the Critical Items page. If someone with critical items could supply the outerHTML of the div with the class subject-character-grid--single-column that’d help a lot.