WaniKani Lesson Overlearning

Always automatically click the 'Need more time' button after lessons to enable overlearning.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         WaniKani Lesson Overlearning
// @namespace    normful
// @version      0.2.0
// @description  Always automatically click the 'Need more time' button after lessons to enable overlearning.
// @author       Norman Sue
// @include      http://www.wanikani.com/lesson/session
// @include      https://www.wanikani.com/lesson/session
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var bindHandlers = function() {
        var needMoreTimeButton = $('#quiz-ready-read-lessons');

        var clickNeedMoreTimeButton = function() {
            if (needMoreTimeButton.is(':visible')) {
                needMoreTimeButton.click();
            }
        };

        var keyHandler = function(event) {
            var isRightArrow = event.which === 39;
            var isEnter      = event.which === 13;
            var isD          = event.which === 68;

            if (isRightArrow || isEnter || isD) {
                clickNeedMoreTimeButton();
            }
        };

        $('#next-btn').on('click', clickNeedMoreTimeButton);

        $(document).on('keyup', keyHandler);
    };

    setTimeout(bindHandlers, 5000);

})();