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


#1

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?


#2

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


The New And Improved List Of API and Third Party Apps
[Request] Review Session Time Length Estimates & Reports
#3

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


#4
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.

#5
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! 

#6
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! 

#7

// ==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 - (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( );


#8
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; 

#9

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”.


#10

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


#11
mahum said...
horusscope said... // ==UserScript==

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

#12

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


#13

never mind


#14
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

#15
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)

#16
horusscope said... https://greasyfork.org/en/scripts/16316-wanikani-egg-timer
added to greasyfork
 Thank you!

#17

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


#18

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

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


#19
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.)

#20
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.