WaniKani Review Wrong Info Click

Automatically click the info button upon wrong review answer.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          WaniKani Review Wrong Info Click
// @namespace     https://www.wanikani.com
// @description   Automatically click the info button upon wrong review answer.
// @version       0.1.0
// @include       https://www.wanikani.com/review/session
// @include       http://www.wanikani.com/review/session
// @run-at        document-end
// @grant         none
// ==/UserScript==

/*global $, console*/

/*
hook wrongCount jStorage
upon field update with increased value
automatically click the show info button
after a slight delay (to avoid a display glitch)
*/

(function () {
    'use strict';

    var lastWrongCount = 0;
    $.jStorage.listenKeyChange('wrongCount', function (key, action) {
        var wrongCount;
        if (action === 'updated') {
            wrongCount = $.jStorage.get('wrongCount');
            if (wrongCount > lastWrongCount) {
                setTimeout(function () {
                    $('#option-item-info').click();
                }, 100);
            }
            lastWrongCount = wrongCount;
        }
    });
    console.log('WaniKani Review Wrong Info Click: script load end');
}());