WaniKani Lesson Overlearning

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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

})();