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

embe said... The button doesn't work when WK Override is enabled.
Thanks for the feedback. Just tested with Chrome and Firefox, for me it does work with WK Override.

Which browser do you use? Does the button work if you disable WK Override? 

Latest Chrome. Yes, when WK Override is disable Auto Comit button works.

embe said... Latest Chrome. Yes, when WK Override is disable Auto Comit button works.
 Sorry, I could not reproduce this problem yet. I will have a look on both script's source code on the weekend to look for any incompabilities.

If anyone is interested, I made a modified version that doesn’t auto commit items that are under a certain % correct. This is so you can’t be sure that an item is wrong if it doesn’t auto commit.

WillNiels said... If anyone is interested, I made a modified version that doesn't auto commit items that are under a certain % correct. This is so you can't be sure that an item is wrong if it doesn't auto commit.
 Explain yourself
Mempo said...
WillNiels said... If anyone is interested, I made a modified version that doesn't auto commit items that are under a certain % correct. This is so you can't be sure that an item is wrong if it doesn't auto commit.
 Explain yourself
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. I have updated the edited version so that you can cycle through different modes. ( Always Auto Commit, Critical Mode, Random Mode, and Off )

The limitations to this are:
1) If you always get everything right, then the modification has no effect. ( So don't cheat with new items, or everything will auto commit again.)
2) There is probably a performance hit when checking the list.
3) It brings back the need to hit enter sometimes.
4) The way I check the critical list is by character only. So it won't work with some radicals, and if a vocab uses the same symbol as a kanji, neither will be auto committed if one is on the list.

Example:

I get 方 right 90% of the time. If I set the percentage to 90 and I type the right answer in a review, it will auto commit. If I set the percentage to 91, it will be considered a critical item, so when I type the right answer in a review it will require me to press enter.

I'll try to figure out how to post my modification and I will add a link to it here.

Edit: Here's a link to the edited version, https://greasyfork.org/en/scripts/16969-wk-auto-commit-edited/code
Edit2: also @johmik,  if you want me to remove this version or incorporate it into yours just let me know. 
Edit3: I updated the script so you can change which mode you are on. Should be the same link.
Edit4: I made a bug fix. Random mode should work as expected now, hopefully.
WillNiels said...
Mempo said...
WillNiels said... If anyone is interested, I made a modified version that doesn't auto commit items that are under a certain % correct. This is so you can't be sure that an item is wrong if it doesn't auto commit.
 Explain yourself
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. 

The limitations to this are:
1) If you always get everything right, then the modification has no effect. ( So don't cheat with new items, or everything will auto commit again.)
2) There is probably a performance hit when checking the list.
3) It brings back the need to hit enter sometimes.
4) The way I check the critical list is by character only. So it won't work with some radicals, and if a vocab uses the same symbol as a kanji, neither will be auto committed if one is on the list.

Example:

I get 方 right 90% of the time. If I set the percentage to 90 and I type the right answer in a review, it will auto commit. If I set the percentage to 91, it will be considered a critical item, so when I type the right answer in a review it will require me to press enter.

I'll try to figure out how to post my modification and I will add a link to it here.

Edit: Here's a link to the edited version, https://greasyfork.org/en/scripts/16969-wk-auto-commit-edited/code
Edit2: also @johmik,  if you want me to remove this version or incorporate it into yours just let me know. 
Hmmm, potentially interesting...
I haven't used it yet, but I hope you added a visual cue to warn the user that they have to ENTER again in a subtle, yet clear way.
Mempo said...Hmmm, potentially interesting...
I haven't used it yet, but I hope you added a visual cue to warn the user that they have to ENTER again in a subtle, yet clear way.
 I will have to think about that. The point for me was to keep myself from second guessing if it doesn't auto commit. I don't know if it is helps really, I might have to tinker with the list for a while. It might work better for me if the list was partially random.

Basically I'm trying to fix the problem that nibarius mentioned on the first page, by making it so you can't be sure if the answer is wrong. 

If my edit is popular enough, I might polish it up more. But right now it's just something that helps me out. 
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)

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 :​)

3 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.