Wanikani: Expected Daily Number of Reviews

Displays the expected number of daily reviews given the current SRS distribution

目前為 2018-03-05 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Wanikani: Expected Daily Number of Reviews
// @namespace    Wanikani: Expected Daily Number of Reviews
// @version      0.1
// @description  Displays the expected number of daily reviews given the current SRS distribution
// @author       Kumirei
// @match        https://www.wanikani.com/dashboard
// @grant        none
// ==/UserScript==

(function() {
		'use strict';
		//check that the Wanikani Framework is installed
		if (!window.wkof) {
				alert('Wanikani: Expected Daily Number of Reviews script requires Wanikani Open Framework.\nYou will now be forwarded to installation instructions.');
				window.location.href = 'https://community.wanikani.com/t/instructions-installing-wanikani-open-framework/28549';
				return;
		}
		else {
				//if it's installed then do the stuffs
				wkof.include('ItemData');
				wkof.ready('ItemData').then(fetch_items);
		}
})();

//retrieves the data
function fetch_items() {
		wkof.ItemData.get_items('subjects,assignments').then(function(items){
				var srs_counts = {};
				var by_srs = wkof.ItemData.get_index(items,'srs_stage');
				Object.keys(by_srs).forEach(function(srs_name) {
						srs_counts[srs_name] = by_srs[srs_name].length;
				});
				display_info(srs_counts);
		});
}

//adds the info to the dashboard
function display_info(srs_counts) {
		var daily_count = 0;
		//this list means means that, in 24 hours, a lesson will be reviewed 0 times, an apprentice-1 item 2 times (comes back as apprentice-2 too),
		//apprentice-2 items 1 time, apprentice-3 items 1 time, apprentice-4 items 0.5 times, guru-1 1/7 times, guru-2 1/14  times, master 1/30 times, enlight 1/120 times, and burn 0 times.  
		var srs_intervals = [0, 0.5, 1, 1, 2, 7, 14, 30, 120, 0];
		for (var i = 1; i < 9; i++) {
				daily_count += srs_counts[i] / srs_intervals[i];
		}
		daily_count = Math.round(daily_count);
		$('head').append('<style id="dailyExpectedCss">'+
						 '.review-status>ul>li {width: 24.90% !important; border-left: 0 !important;}'+
						 '.review-status .timeago {height: auto !important; overflow-x: visible !important; white-space: normal !important;</style>'
						);
		$('.review-status > ul').append('<li class="expected-daily"><span>'+daily_count+'</span><i class="icon-inbox"></i> Expected Daily</li>');
}

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址