Wanikani: Random voice actor

Randomises the preferred voice actor

02.12.2019 itibariyledir. En son verisyonu görün.

// ==UserScript==
// @name        Wanikani: Random voice actor
// @description Randomises the preferred voice actor
// @include     https://www.wanikani.com/review/session*
// @include     https://www.wanikani.com/lesson/session*
// @version     1.1.1
// @author      Kumirei
// @license     MIT; http://opensource.org/licenses/MIT
// @run-at      document-end
// @grant       none
// @namespace https://greasyfork.org/users/105717
// ==/UserScript==

(function() {
	let rand = Math.random;
	$.jStorage.listenKeyChange('currentItem', randomize_voice_actor);
	$.jStorage.listenKeyChange('l/currentQuizItem', randomize_voice_actor);
	$.jStorage.listenKeyChange('l/currentLesson', randomize_voice_actor);

	function randomize_voice_actor() {
		let r = rand();
		let voice_actor = (r > 0.5 ? 2 : 1);
		WaniKani.default_voice_actor_id = voice_actor;
	}
})();