[Request] Indicator of time used, shown in the review summary

It would be really neat with a feature that showed how long you
used on a session in the review summary. It would give you a better
sense of how much time you use, and would help you manage it more
realistically in everyday life. Setting an egg timer every time seems like a bother.

What’s your opinion?

1 Like

this is actually in the realm of incredibly easy, ill probably make it if no one else has after i finish working today

edit: https://greasyfork.org/en/scripts/16316-wanikani-egg-timer

1 Like

So like you’d basically know how long your reviews are taking?

1 Like
mahum said... So like you'd basically know how long your reviews are taking?
Yup. It differs from day to day, so an automatic indicator would be nice.
1 Like
Frouzich said...
mahum said... So like you'd basically know how long your reviews are taking?
Yup. It differs from day to day, so an automatic indicator would be nice.
That'd be cool. I'm sure it would help a lot of people because you see a bunch of threads on how long to spend on reviews. It would probably help people gauge how much time they have to do wk. :D Nice idea! 
horusscope said... this is actually in the realm of incredibly easy, ill probably make it if no one else has after i finish working today
 Can't wait @horusscope! 

// ==UserScript==
// @name        Wanikani Egg Timer
// @namespace   wkeggtimer
// @description Adds a timer during reviews and displays the final time afterward
// @include     WaniKani — Log in*
// @include     WaniKani — Log in*
// @version     0.1
// @author      Horus Scope
// @grant       GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @license     GPL version 3 or later: The GNU General Public License v3.0 - GNU Project - Free Software Foundation
// ==/UserScript==

function timeStamp( inc = 0 ) {
    var prev = GM_getValue(“eggtimer”);
    prev += inc;
    GM_setValue(“eggtimer”,prev);
    //  Yes, parseInt is prettier.
    var hours = Math.floor(prev / 60 / 60);
    var minutes = Math.floor( (prev - (hours6060)) / 60 );
    var seconds = prev - hours6060 - minutes*60;
    return “”
      + (hours? hours+"h " : “”)
      + (minutes? minutes+"m " : “”)
      + (seconds? seconds+“s” : “”);
}
var timeSpan; // referenced in go( )
function generate(  ) {
    var display = document.createElement(‘div’);
    display.className = ‘timerSessionDisplay’; // no style actually defined
    timeSpan = document.createElement(‘span’);
    timeSpan.className = ‘timerSessionSpan’; // no style actually defined
    timeSpan.textContent = "Last review: " + timeStamp( );
    display.appendChild(timeSpan);
    return display;
}

// start counting. [or, dont]
function go( )
{
    // style
    var styleStr = “”; // <div class=“timerSessionDisplay”><span class=“timerSessionSpan”>
    GM_addStyle(styleStr);;
    // change behavior depending on screen [summary, reviewing now]
    if(/session$/.exec(window.location.href)) { // review/session [ reviewing now ]
        GM_setValue(“eggtimer”,0); // time start
        var header = document.getElementById(‘summary-button’); // because easy
        var display = generate( ); // makes div object
        header.appendChild( display );

        setInterval(function() {timeSpan.textContent = "Elapsed: " + timeStamp( 1 );}, 1000);
    } else { // review [ summary screen ]
        var footer = document.getElementById(‘last-session-date’); // makes sense
        var display = generate( );
        footer.insertBefore(display, footer.childNodes[0]); // probably float:left btw
    }
}

window.onload = go( );

horusscope said... // ==UserScript==
// @name        Wanikani Egg Timer
// @namespace   wkeggtimer
// @description Adds a timer during reviews and displays the final time afterward
// @include     http://www.wanikani.com/review*
// @include     https://www.wanikani.com/review*
// @version     0.1
// @author      Horus Scope
// @grant       GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @license     GPL version 3 or later: http://www.gnu.org/copyleft/gpl.html
// ==/UserScript==

function timeStamp( inc = 0 ) {
    var prev = GM_getValue("eggtimer");
    prev += inc;
    GM_setValue("eggtimer",prev);
    //  Yes, parseInt is prettier.
    var hours = Math.floor(prev / 60 / 60);
    var minutes = Math.floor( (prev - (hours*60*60)) / 60 );
    var seconds = prev - hours*60*60 - minutes*60;
    return ""
      + (hours? hours+"h " : "")
      + (minutes? minutes+"m " : "")
      + (seconds? seconds+"s" : "");
}
var timeSpan; // referenced in go( )
function generate(  ) {
    var display = document.createElement('div');
    display.className = 'timerSessionDisplay'; // no style actually defined
    timeSpan = document.createElement('span');
    timeSpan.className = 'timerSessionSpan'; // no style actually defined
    timeSpan.textContent = "Last review: " + timeStamp( );
    display.appendChild(timeSpan);
    return display;
}

// start counting. [or, dont]
function go( )
{
    // style
    var styleStr = ""; // <div class="timerSessionDisplay"><span class="timerSessionSpan">
    GM_addStyle(styleStr);;
    // change behavior depending on screen [summary, reviewing now]
    if(/session$/.exec(window.location.href)) { // review/session [ reviewing now ]
        GM_setValue("eggtimer",0); // time start
        var header = document.getElementById('summary-button'); // because easy
        var display = generate( ); // makes div object
        header.appendChild( display );

        setInterval(function() {timeSpan.textContent = "Elapsed: " + timeStamp( 1 );}, 1000);
    } else { // review [ summary screen ]
        var footer = document.getElementById('last-session-date'); // makes sense
        var display = generate( );
        footer.insertBefore(display, footer.childNodes[0]); // probably float:left btw
    }
}

window.onload = go( );
What do you even do with this? ;A; 

Works wonderfully. Thanks.

@mahum
Copy it. Open your add-ons tab on Firefox. Go to user scripts. New user script… Click “Use Script from Clipboard”.

@mahum
add it as a greasemonkey userscript
just paste it in there :stuck_out_tongue:

mahum said...
horusscope said... // ==UserScript==

What do you even do with this? ;A; 
 I'm guessing you don't have a greasyfork account @horusscope ?

https://greasyfork.org/en/scripts/16316-wanikani-egg-timer
added to greasyfork

never mind

horusscope said... https://greasyfork.org/en/scripts/16316-wanikani-egg-timer
added to greasyfork
 Thanks horusscope, it didn't seem to work when I copied and pasted, but I will find out whether this will work in about an hour
Crunderwood said...
horusscope said... https://greasyfork.org/en/scripts/16316-wanikani-egg-timer
added to greasyfork
 Thanks horusscope, it didn't seem to work when I copied and pasted, but I will find out whether this will work in about an hour
 If you're using Chrome, I'm pretty sure what the issue might be. (even without looking at the code)
horusscope said... https://greasyfork.org/en/scripts/16316-wanikani-egg-timer
added to greasyfork
 Thank you!

Yeah, doesn’t work on Chome. No duration displayed at the summary page.

Haha, yea, Chrome doesn’t like GM_* functions…

I use jStorage for local storage now. (very handy because Tofugu does so too)

Mempo said... Haha, yea, Chrome doesn't like GM_* functions...

I use jStorage for local storage now. (very handy because Tofugu does so too)
 How do I use jStorage? (want to know before I go through downloading etc.)
Crunderwood said...
Mempo said... Haha, yea, Chrome doesn't like GM_* functions...

I use jStorage for local storage now. (very handy because Tofugu does so too)
 How do I use jStorage? (want to know before I go through downloading etc.)
 It's already on the website actually. WK uses it for reviews and lessons. But there's nothing you can do with it though, unless you want to rewrite horusscope's script. I merely meant I use it whenever I write a new script because it works on any modern browser.