[Userscript] Summary Page: Revival

Have you made sure it’s updated? You can click into the installation page to check - sometimes Tampermonkey seems to struggle with automatic updates.
If it is fully updated and hasn’t been working for a while then I’d suspect some kind of conflict with another script you have installed, as it’s been working without issue for me and others. Or maybe you use an unusual browser or something?

Looks like actually Tampermonkey required a change to enable dev mode which is odd (never needed to touch that before) but between doing that and reinstalling the extension it seems to be working again.

I bemoaned the missing summary page on here 18 months ago. I let my sub lapse almost a year ago, and it’s still not back? Unbelievable.

Just re-flagging this as I saw it again today (Creeper, specifically)

Unfortunately I still have yet to get a review for any image-based radical - I think I might have burned them all. I have however just pushed a tiny update (0.6.6) that might fix it? But it’s basically just a guess as I won’t actually be able to test it until I get a review with an image radical!

okay, i don’t have any bugs and any issues, but one fun thing I wish I would have xddd

I find myself often pacing in and out of review blocks in the middle of nowhere: it would be pretty cool if in addition to the session accuracy/history, there could be a graph of the velocity of the reviews over time over the course of the review? Just to be able to see how many times did I get distracted, how many times I slowed down to review a specific item

I do understand it could be a bit stressful for some people to have it, so definitely as an option, but even without this the script is really cool :heart_eyes: :heart:

That’s actually a pretty good idea, I could picture myself finding that useful as well! I’ll take a look at it when I next have time…

0.7.2 released - Time Graphs

This update adds the following:

  • Graphs to show your speed at answering meaning and reading questions throughout a review session
  • A bar chart to show the total time taken for each item in the review session (hover to see items)
  • Small fixes which will make the percentages slightly more accurate (the first answer wasn’t being properly counted in everything)

These work correctly with the double-check script, and don’t include time you spend looking at item info in between answers.
As always, let me know if you come across any issues…

It worked! I lost the first review session because the graph didn’t show up then, and I didn’t open up the console to check what exactly happened, that one was on me :sob:

But on the second one it did:


I checked the local storage to find out if you keep the history of previous items in there, but I only found the key for accuracy history in terms of percentages, so my first review answer time is lost to time ^^

I wonder what happened that first time, oh well
Only things I can think of is I had 153 reviews at that time, but since I’ll be testing this extension each day moving forwards, I’m curious to see if I’ll be able to pick up a neat graph one day ^^

also, in terms of UX, as soon as I saw two graphs in a column right next to one another, my frontend senses started tingling because I’ve had a nightmare scenario of supporting that layout at work, so I decided to shrink the size of the window aaandd…

dont trust css columns they never work how you expect them to work xdd

thank you for the extension, i really appreciate the quick turnaround time on this one! hope i’ll get a fun graph before too long C:

None of the graphs resize very nicely as they’re rendered onto canvas elements - so it’ll definitely look bad if you resize after they’ve been rendered! :laughing: I also haven’t put any effort into making them work on portrait-orientation / narrow screens though, as it’s just for desktop.

Interesting that the graph didn’t show up for you the first time - if that happens again it would be interesting to hear if there’s any errors in your console. I didn’t have a chance today to test with a longer review session so I might have overlooked something.

None of the stats are saved currently other than the accuracy history as you saw I’m afraid, not much of a reason to :sweat_smile:

your billion dollar startup idea that might never take off is to extend the idea of the summary page and keep statistics corresponding to every single review corresponding to every single item in local storage and then visualize them in graphs, like “words you’ve seen the most time over the last 30 days”, “words that took you the longest amount of time to type ever since you downloaded the extension on average”, “total amount of time spent on reviews of kanji/vocabulary/radicals”, “total amount of times you pressed backspace on meaning/reading of a word”, “you type at a speed of x characters on average for readings and y characters on average for meanings”…

don’t listen to my advice (but also i’ve already started warming myself up to this idea) (but also i would probably never do anything with the data) (but also i like charts and graphs) xdddd

will report on whether tomorrow’s graph showed up or not ^^

I GOT MY CHART ITS SO PRETTY AND AAA I DIDNT EVEN GET DISTRACTED MUCH

…but wait, what’s that session accuracy :eyes:


(nice) xdd

but

aaaa by fixing this now my stats look worse xddd

but it’s only for the private use, so maybe i should be faced with how often i’m using backspaces and double checks, i don’t know, my brain is just not used to seeing the number of below 70% in any reviews at all :sob: xdddd

good graphs for timing, thank you very much, this is what i was looking for ^^

Good to see the charts are working! That’s also a crazy long session, I think the max I’ve ever reached in one go is around 250 :laughing:

0.7.3 Released
I just took a look and there was actually another bug with the percentages that I’d missed! Getting an answer wrong and then correcting it using Double Check was counting it as incorrect and correct, even though using double check backspace should “invalidate” the answer that was given before that (i.e. the whole point of Double Check - for situations where you know you had the right answer but WK marks it as wrong, e.g. typo). So your percentage should go back up slightly in future sessions if you update!

Updated to 0.7.3 ^^

And exactly this is the effect of the tool I was looking for after 0.7.2: all of the times when I just changed the tab and went like “i like this tab”, and then like “OH SHOOT I HAVE JAPANESE REVIEWS I NEED TO FINISH”


seems like i got distracted 8 times today, and two twice seriously, and now I’m wondering what to do with that information, other than being like >:[[[ at myself xddd

Thank you for the functionality being added!

This script has stopped working after the latest Wanikani update. I have managed to get the base functionality working again with the following relatively small change. The formatting of the summary page is also slightly broken, but at least this gives a summary again. @Hubbit200, are you still around to get this integrated into the script?

code changes

The didCompleteSubject event is no longer a thing, so I merged the relevant event listener into the one for a related event which took over its role. Replace this code:

// Add an event listener for the didAnswerQuestion event
window.addEventListener("didAnswerQuestion", function(e) {
// Calculate and store answer time
if (((isDoubleCheckEnabled && e.constructor.name === "CustomEvent") || (!isDoubleCheckEnabled && e.constructor.name === "DidAnswerQuestionEvent")) && startTime > 0) {
    const timeTaken = (performance.now() - startTime) / 1000; // Time in seconds
    if (currentQuestionType === "meaning") {
        meaningAnswerTimes.push(timeTaken);
    } else if (currentQuestionType === "reading") {
        readingAnswerTimes.push(timeTaken);
    }
    // Add time to the current item's total time
    const currentTime = itemTimeMap.get(currentSubjectId) || 0;
    itemTimeMap.set(currentSubjectId, currentTime + timeTaken);
}
});
 
// Add an event listener for the didCompleteSubject event
window.addEventListener("didCompleteSubject", function(e) {
// Get the subject data from the event detail
let subject = e.detail.subjectWithStats.subject;
let didSRSUp = e.detail.subjectWithStats.stats.meaning.incorrect === 0 && e.detail.subjectWithStats.stats.reading.incorrect === 0;
let reading = null;
if(subject.type == "Vocabulary" || subject.type == "KanaVocabulary") {
    reading = subject.readings?.filter(m => ["primary", "alternative"].includes(m.kind)).map(m => m.text);
} else if (subject.type == "Kanji") {
    reading = [
        subject.readings?.filter(r => r.type === "nanori").map(r => r.text),
        subject.readings?.filter(r => r.type === "onyomi").map(r => r.text),
        subject.readings?.filter(r => r.type === "kunyomi").map(r => r.text),
    ].map(r => r?.length > 0 ? r : null);
}

with this

 // Add an event listener for the didAnswerQuestion event
window.addEventListener("didAnswerQuestion", function(e) {
// Calculate and store answer time
if (((isDoubleCheckEnabled && e.constructor.name === "CustomEvent") || (!isDoubleCheckEnabled && e.constructor.name === "DidAnswerQuestionEvent")) && startTime > 0) {
    const timeTaken = (performance.now() - startTime) / 1000; // Time in seconds
    if (currentQuestionType === "meaning") {
        meaningAnswerTimes.push(timeTaken);
    } else if (currentQuestionType === "reading") {
        readingAnswerTimes.push(timeTaken);
    }
    // Add time to the current item's total time
    const currentTime = itemTimeMap.get(currentSubjectId) || 0;
    itemTimeMap.set(currentSubjectId, currentTime + timeTaken);
}
if(e.detail.complete){
    handle_didCompleteSubject(e);
}
});

function handle_didCompleteSubject(e){
// Get the subject data from the event detail
let subject = e.detail.subjectWithStats.subject;
let didSRSUp = e.detail.subjectWithStats.stats.meaning.incorrect === 0 && e.detail.subjectWithStats.stats.reading.incorrect === 0;
let reading = null;
if(subject.type == "Vocabulary" || subject.type == "KanaVocabulary") {
    reading = subject.readings?.filter(m => ["primary", "alternative"].includes(m.kind)).map(m => m.text);
} else if (subject.type == "Kanji") {
    reading = [
        subject.readings?.filter(r => r.type === "nanori").map(r => r.text),
        subject.readings?.filter(r => r.type === "onyomi").map(r => r.text),
        subject.readings?.filter(r => r.type === "kunyomi").map(r => r.text),
    ].map(r => r?.length > 0 ? r : null);
}

let isWarning = e.detail.subjectWithStats.stats.meaning.incorrect + e.detail.subjectWithStats.stats.reading.incorrect > 2 || (e.detail.subjectWithStats.stats.meaning.incorrect > 0 && e.detail.subjectWithStats.stats.reading.incorrect > 0);

// Calculate the new SRS level
let newSRSLevel = didSRSUp ? currentSRSLevel + 1 : (currentSRSLevel < 2 ? currentSRSLevel : (currentSRSLevel < 5 ? currentSRSLevel - 1 : currentSRSLevel - 2));

// Get total time for this item from the map
const totalTime = itemTimeMap.get(subject.id) || 0;

// Push the subject data to the items list array
let subjectInfoToSave = { characters: subject.characters, type: subject.type, id: subject.id, SRSUp: didSRSUp, meanings: subject.meanings?.filter(m => ["primary", "alternative"].includes(m.kind)).map(m => m.text), readings: reading, oldSRS: currentSRSLevel, newSRS: newSRSLevel, isWarning: isWarning, incorrectEntered: incorrectEntered.get(subject.id), totalTime: totalTime };
itemsList.push(subjectInfoToSave);
}

My review sessions stopped completing with the recent changes (I keep getting presented the last item in my review over and over until I hit refresh, which kicks me successfully back to the main landing page). I figure it probably has to do with a userscript, possibly this one? Maybe I’ll try the code replacement above and see if that helps.

Doing this caused the items to appear duplicated on the summary page.

What solved the issue was reverting to the original script, changing the event name from “didCompleteSubject” to “didFinalAnswer,” and checking the “complete” field that exists in this event’s “details” before adding the item

Change this:

window.addEventListener("didCompleteSubject", function(e) {

To this:

window.addEventListener("didFinalAnswer", function(e) {
    if(!e.detail.complete) {
        return;
    }

I think didFinalAnswer is something introduced by DoubleCheck, so this would only work if DoubleCheck is installed as well.

I did not notice any duplicated entries on my end, but I could have just glanced over it. Are you sure you did the full change I suggested? I do basically this exact change, but added to the didAnswerQuestion event instead of the didFinalAnswer event.

edit: I am now also seeing the duplication on my end. Maybe something changed, but I probably just somehow overlooked it. Thanks for noticing and for the fix.