[Userscript] WaniKani Lesson User Synonyms 3

Installation

Download/install “Lesson User Synonyms 3”
General script installation instructions
Open Framework installation


Lesson User Synonyms (by @kobayashi) and Lesson User Synonyms 2 (by @irrelephant) are not maintained anymore, so I decided to recreate the main functionality in a new script.

What does it do?

WaniKani allows to add your own synonyms for the meaning of items so that those will also be accepted answers during reviews. By default, user synonyms can only be edited on item pages and during reviews. With this script, the user synonyms can also be edited during lessons and the lesson quiz, and will be accepted as correct answers during the lesson quiz. User synonyms that are on WaniKani’s hidden block list (meaning that WaniKani will not accept them as answers during reviews) will be displayed in red.

Screenshot

22 Likes

It’s great that you’ve stepped in an kept this useful script running. Well done! :+1:

8 Likes

Hi Sinyaven, is this plugin still alive? It was working fine for me but for whatever reason in lessons it does not show up anymore. The following is my order of plugins on tampermonkey.
2022-11-28_17-55-37

1 Like

The script is still working for me. Can you take a look at the suggested steps in this guide to see if any of them lead to more information on why the script does not work for you?

Perhaps the most obvious edit is // @match https://www.wanikani.com/*. I am not sure this one is broken yet?

I don’t think the lesson page can be reached without a complete page load, so // @match https://www.wanikani.com/lesson/session should still work.

However, I just noticed that WaniKani.wanikani_compatibility_mode is still true if the compatibility mode is enabled in the settings, even though the page only delivers the version without compatibility mode anymore. Therefore, there is a mismatch between the expected version and the actual version, leading to the script not working during the lesson quiz if compatibility mode is enabled in the settings.

5 Likes

I followed the steps in the guide, and it does work again but not always. Sometimes the page goes through and it isnt there for whatever reason during lessons

Now that WaniKani has finished the removal of the script compatibility mode, are you still having problems with this script, or is everything working again?

i am thinking of extending this script of the optional functionality of adding some synonyms automatically:
replace someone / someone’s / somebody / somebody’s with sb
replace something with sth
replace $to (.*) with $2

just because i always do that manually and it just gets annoying haha

1 Like

I feel like this would make more sense as a separate script: either a script that intercepts the answer submit handler to expand any abbreviations in your answer, or a script that runs only once, goes through all WK items, and adds the desired synonyms in a bulk. Both of these approaches have the advantage that the synonyms can be changed/added even for already learned items.

yeah i get that but that would require me to either figure out how to do that which takes time
or
make sure i am compatible with scripts like double check. i guess modifying double check also works, maybe even better hmmm
just checked: double check doesnt run in lesson mode

i actually just looked into the console and there is an error thrown:

regardless it still works

Uncaught (in promise) TypeError: can’t define property “syn”: Object is not extensible
updateUserSynonymsInLessonQueue moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1015
insertUserSynonyms moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1038
userSynonymSection moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1026
addUserSynonymSection moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1020
_handleCallbackEntry moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:555
_handleCallbacks moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:513
_handleCallbacks moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:513
_handleStateChange moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:494
_handleLessonMutation moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:201
nrWrapper https://www.wanikani.com/lesson/session:6
MutationObserver https://www.wanikani.com/lesson/session:6
_registerLessonPageListeners moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:161
_initOnNewPage moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:110
_initIfNewPage moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:146
_init moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:99
_publishInterface moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:959
window[“__f__ldpwi729.an”]/</< moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:962
window[“__f__ldpwi729.an”]/< moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:963
St https://www.wanikani.com/lesson/session:9
window[“__f__ldpwi729.an”]/< moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1
“__f__ldpwi729.an” moz-extension://b7caf43c-20a1-4b32-b27e-fa239399c9dc/userscripts/WaniKani Lesson User Synonyms 3.user.js?id=f015da8a-cf45-4605-8dae-83c885adb88d:1
St https://www.wanikani.com/lesson/session:9
n https://www.wanikani.com/lesson/session:71
https://www.wanikani.com/lesson/session:74
g https://www.wanikani.com/lesson/session:68

It seems that WK Item Info Injector fires twice when I go to the meaning tab during lessons, and on the second time the object returned by $.jStorage.get() is not writable. Strange, but when I fix the main problem of WK Item Info Injector firing twice the exception should be gone.

i have just done some test based on what i read in the code:
if you skip over the meanings tab during learning then synonyms for that item are not loaded and still not be available during the quiz. this is only relevant for very few users tho as I have reset my level and because of that synonyms can already exist in wanikani’s database for items that i have not learned yet and were not touched by this script

I know – I decided that this “flaw” will probably never affect anyone, so I did not fix it. It only affects the bonus feature (synonyms already working during lesson quiz) and not the core functionality (adding synonyms during lessons) of this script anyway.

2 Likes