您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Input multiple readings/meanings
- // ==UserScript==
- // @name Wanikani Multiple Answer Input
- // @namespace mempo
- // @version 1.0
- // @description Input multiple readings/meanings
- // @author Mempo
- // @match https://www.wanikani.com/review/session
- // @match http://www.wanikani.com/review/session
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- console.log("/// START OF WKMAI");
- $('input#user-response').on('keydown',function(event){
- if (event.keyCode === 13){
- //event.preventDefault();
- event.stopPropagation();
- console.log("/// WKMAI: PROPAGATION: " + event.isPropagationStopped());
- var WKMAI;
- var wrong = false;
- if($.jStorage.get("questionType")==="meaning"){
- WKMAI = ["en","syn"];
- }else{
- WKMAI = ["kana","kana"];
- }
- $('input#user-response')[0].value.split(/[;]|[ ]{2,}/).forEach(function(element){
- if(element !== "" &&
- $.jStorage.get('currentItem')[WKMAI[0]].indexOf(capitalize(element.trim())) === -1 &&
- $.jStorage.get('currentItem')[WKMAI[1]].indexOf(capitalize(element.trim())) === -1 ){
- console.log(element + " is wrong!");
- wrong = true;
- }
- });
- if(!wrong){
- $('input#user-response')[0].value = $('input#user-response')[0].value.split(/[;]|[ ]{2,}/)[0];
- }
- $("#answer-form form button").click();
- }
- });
- function capitalize(str){
- return str[0].toUpperCase() + str.substr(1);
- }
- })();