[Userscript] auto-commit; the end of the enter key

WillNiels said...The modified version uses the wanikani api to get a list of critical items. The script checks the list, and if the current item matches one of the critical items, it won't auto commit when you type the right answer. You can configure the percentage correct at which the items are considered critical by changing a variable in the script. 

[....]

Edit2: also @johmik,  if you want me to remove this version or incorporate it into yours just let me know. 
Thanks for your contribution! I understand your idea, you want to get sure to that you don't cheat your reviews with this script. 

Personally, I prefer not using your modification, because I can withstand the temptation to cheat. When something I type does not autocommit then I just hit enter anyway and I can get on with the review session.

But I will link to your post in this threads first post, as I am sure that some people might find your mod interesting.

----

Also regarding the issue with the Wanikani Override script I couldn't find a possible error. Instead I tested the two scripts (Override and Autocommit) one more time concurrently running on both a Chromium  and a Firefox browser, and for me they worked without any issues.

Okay, so I just wanted to let you guys know, I did an update to the edited version of the script. It allows you to choose which mode you want. This will probably be my last update. 

Script still works wonderful, but I found a little bug in combination with the script “Katana Madness” (replaces hiragana of on’ reading with katakana): This script is not able to auto-commit words spelled in katakana.
Workaround: exclude the review-page in the katakana madness script. (Add // @exclude https://www.wanikani.com/review/session to the preamble)

1 Like

I use this because hitting the Enter key so often was giving me serious pinky finger strain. I combine it with WaniKani Lightning Mode, so I never have to hit Enter on an item I get right.

However, this script presses Enter twice for you, which was making the input box shake after every review if used in combination with Lightning Mode.

I fixed it by changing this line (line 70):

setTimeout(function(){ $("#answer-form form button").click();}, click_threshold);

into

if (!$('#lightning-mode.active').length) {
    setTimeout(function(){ $("#answer-form form button").click();}, click_threshold);
}

To others considering this: I would apply similar caution to when using the Override script; if you notice an item doesn’t commit, don’t backspace and write something else, just commit it and accept your failure :​)

4 Likes

The audio wasn’t playing until after the next item already appeared, which annoyed me, so I fixed the script via changing these two functions:

var commit = function () {
	$("#answer-form form button").click();
	if (document.getElementsByClassName("audio-btn")[0].disabled == true) {
		window.setTimeout(waitAudio, click_threshold * 1.5);
	} else {
		window.setTimeout(waitAudio, click_threshold * 2.5);
	}
};

var waitAudio = function () {
	var skip_timeout = false;
	if (document.getElementsByClassName("audio-play").length == 0) {
	   setTimeout(function(){ $("#answer-form form button").click();}, (skip_timeout === true) ? click_threshold : 0);
    } else {
	   skip_timeout = true;
	   window.setTimeout(waitAudio, click_threshold); /* this checks the flag every 100 milliseconds*/
	}
};

Edit: I updated the values of click_threshold * X to make the extension a bit faster, however, you should tinker with those values to suit your needs.

2 Likes

That has also been bugging me, where exactly do I add your code?

Thank you for the extension.

I am currently doing the level 1 radicals and kanji again such that I can check your code :slight_smile:

If I can confirm that this works correctly on Firefox and Chromium I’ll update the script on Greasemonkey.

Sure, you might want to mess around with the click_threshold a bit before updating,. Sometimes it feels too slow or too fast.

I use Tampermonkey.

Go to the Tampermonkey Dashboard, click the extension title, scroll down and overwrite var commit (...) with everything my original the code block above, then hit control S to save.

1 Like

Hey @johmik, I really appreciate this script! Installed it a while back and it helps a lot. One reason I went on such a long hiatus from WaniKani was because my little finger was hurting a lot from pressing the key so much, so this script was a great help in bringing me back.

I was wondering, though, if you (or anyone with the capabilities) could make a similar script for KaniWani. I’d like to start using KaniWani to help with vocabulary recall, but the need for repeatedly pressing the enter key is a bit of a barrier. Also, such a script would help with the frustration of putting in the “wrong” girl (女子、女の子、少女) answer, since you would have a chance to “correct” your answer when you realized the word you chose isn’t entering.

1 Like

did anyone with the knowledge get back to you on this? wiould be really helpful!

1 Like

Unfortunately, nobody has. So I’m still not using KaniWani for the same reasons.

Hello mate!
I always get the ‘no API key entered’ alert.
Where should i enter the API key?

Thanks and have a good day :slight_smile:

AFAIK, for this plugin there is no need for an API key.

Where do you get this error?

Annotation 2020-09-30 085542
Every time i want to do reviews/lessons, right away after i clicked ‘Start Session’

I use Google Chrome Version 85.0.4183.121 (Official Build) (64-bit)
Tampermonkey v4.11

EDIT: Issue Resolved! Sorry for bothering you mate, apparently i used the edited version of the script, not the original one.

Does anyone know of a script a bit like this, that simply only presses enter for me when I answer correctly? If you’ve used BunPro you know what I mean. Where you only have to press enter once and if it’s correct, it proceeds to the next item but if it’s wrong, it stays and you can study why it was wrong. This makes sure you don’t accidentally proceed from a wrong answer without studying your mistakes.

This already works like that unless I’m misunderstanding what you mean

The Double Check script supports Lightning Mode that does this.

1 Like

I read the post as "it’s checking what you write and if its correct it enters in the answer for me. I’d rather if it just automatically continues if I enter in my answer and its correct.

Where is that script?

1 Like