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

Mempo said...
horusscope said...
johmik said... EDIT: It does not work with Firefox and Greasemonkey, as Greasemonkey seems to be more restrictive about the use of jQuery than Tampermonkey.
 False, jQuery is fine.


Edit: As a random aside, when I read through the WK override script I noticed it had
$ = unsafeWindow.$;
to alias jQuery, either way the script won't load in GM until you fix the URL match
 That's not really necessary. My scripts work fine without it. JQuery doesn't even need to be included because WK itself already uses it.
I made it work with Firefox and Greasemonkey for now.
It looks like that the site jQuery can not be accesed if there is not a "// @grant none" line in the header.
Therefore, because I used "// grant GM_addStyle" the site jQuery could not be accessed, and the variable $ was left as  not defined.
I amended the script slightly, such that it does not use the GM_addstyle anymore.

For me, it works in Firefox with Greasemonkey, as well as in Chromium with Tampermonkey now. Tested with FF 43.0 and GM 3.6, as well as Ch 47 and TM 3.12.

Thanks for all your feedback! :)
nibarius said... I really want something that let's me avoid the enter key. I'm starting to develop a RSI in my pinky from stretching out to the enter key after each word I type. But sadly I don't dare to try this one, I know I would cheat way too much.

I can see myself answer しゅく as reading for something, see that it's not autosubmitted and fix it to しゃく instead and get it autosubmitted and I succeed with a word that I would actually fail.
Exactly, with only 100 reviews, its like hitting the enter key 200 times only for the reviews. About the cheating, well its the same discussion as with the Override script I would say, some people won't misuse this where others would.

nibarius said...What I would love were if double tapping space submitted the word. That's not something you do by accident and extra spaces at the end of a word doesn't mark it as wrong.
 Yes, I like this idea too !
1 Like

This works great!

Though I still got the pinky reflex ;p

EDIT: didn’t know about the @grant:none JQuery thing. Learned something today!

Are you planning to include this in lessons too?

I didn’t plan to, because in my case lessons are way less than reviews.

Yet, I will have a look on it this weekend, I think it’ shouldn’t be too difficult to adapt to the lessons page.

there actually is already a script for that, called Wanikani Improve, but you can’t really find it anymore and it hasn’t been maintained for 2 years or so, so it doesn’t work without some tweaking. I still have it from back then.

I don’t want to suggest to drop yours, because having a script for this that is still being maintained is definitely useful. You might want to consider to copy a feature from WaniKani Improve though:
It has a button to show you the definition from the last item and what your answer was. It also shows by color coding of the button if there were other possible answers around, or if your answer wasn’t spot on and the typo correcter jumped in (mostly these are the cases where you use the button, to check if it really was a typo or if your answer was wrong).

Naryoril said... there actually is already a script for that, called Wanikani Improve, but you can't really find it anymore and it hasn't been maintained for 2 years or so, so it doesn't work without some tweaking. I still have it from back then.

I don't want to suggest to drop yours, because having a script for this that is still being maintained is definitely useful. You might want to consider to copy a feature from WaniKani Improve though:
It has a button to show you the definition from the last item and what your answer was. It also shows by color coding of the button if there were other possible answers around, or if your answer wasn't spot on and the typo correcter jumped in (mostly these are the cases where you use the button, to check if it really was a typo or if your answer was wrong).
 I know and use the WK Improve script. It has some overlap in functionality, but it's still not quite the same. It reduces the need to ENTER by one, but this script eliminates it completely. But the Improve script, as you said, also does a number of others things on the reviews page. Therefore it's useful to have this one, because it improves on only one function found in the Improve script and could potentially branch out to improve lessons.

johmik said... I didn't plan to, because in my case lessons are way less than reviews.

Yet, I will have a look on it this weekend, I think it' shouldn't be too difficult to adapt to the lessons page.
 Well, apparently it's not as simple as add the lesson URL's to the @match, because I already tried that! ;p
You'll probably have to find a way to postpone the binding of your 'checkAnswer' function to the review box until the lesson info pages are over.
Though I haven't looked at it any further than described above, I'm guessing the script now goes like 'Welp, couldn't find that HTML element you're looking for, so good look without me, mate!'

Overall it would just be nice to have because I quickly got used to no more ENTERs, and whenever I do lessons now, it bugs the hell out of me. Mostly because I just stare at the screen, waiting for it to commit, but a few seconds later I realize that doesn't happen on the lessons page and I go like AAAAAARRRGGHH and this happens far too often!

Updated the script to make it work on the Lessons page too.

https://greasyfork.org/en/scripts/16466-wk-auto-commit

I did not test if it works with radicals on the lessons page, though, but should not be a problem.

johmik said... Updated the script to make it work on the Lessons page too.

https://greasyfork.org/en/scripts/16466-wk-auto-commit

I did not test if it works with radicals on the lessons page, though, but should not be a problem.
 Great, thanks! Gonna have to wait a few more days before I can test it on radicals, but as you said, that's probably not going to be a problem!

The button doesn’t work when WK Override is enabled.

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.