[No Longer Working] WaniKani Lesson User Synonyms

@kobayashi This script stopped working for me recently. Neither enter nor the add button properly adds the user synonym during lessons. I used this script all the time, so I would massively appreciate it if there was a way to fix it.

Anyone else encountering the same problem?

Using Chrome 61 on Windows 10.

Yes, I have the same issue. The error in the browser console is
https://www.wanikani.com/user_synonym/create/ 404 (Not Found)

The call when adding a user synonym succesfully during reviews uses:
PUT “https://www.wanikani.com/study_materials/idhere

I’m not very familiar with the WaniKani API yet so I don’t know whether user_synonym/create was deprecated, never meant to be used or what else might be going on here.

1 Like

Things like this aren’t part of the official API. These scripts are built with the understanding that WaniKani can make breaking changes at any time without warning.

Ah thanks, I see. So they probably changed that path from user_synonym/create/ to /study_materials/idhere”.

@kobayashi hasn’t been online here for a while, not sure if he/she is planning on fixing it. Is anyone else looking into this? Otherwise I’ll give it a try.

1 Like

So using that new URL seems to work but some parts of the script have to be adjusted a bit because it expects a list of synonyms now instead of just a single string, nothing major. I’m currently travelling (to Japan, yay :slight_smile: ) so it might take a little while. But if this hasn’t been fixed when I get back online then I will post an update here with a fix as soon as I can.

2 Likes

Thanks for offering to take up fixing the script! Take your time, I’ll deal for now and just look forward to when the code is adjusted for the changes.

@irrelephant thank you, that would be wonderful, I also use this script a lot since I tend to put synonyms in my language instead of trying to remember what it means in English, so having it functioning would be a great deal.

Thanks!

@Eman527 @chofas I made some changes and it seems to work for me but please let me know if I missed anything: https://greasyfork.org/en/scripts/34839-wanikani-lesson-user-synonyms-2 I didn’t test it long and only in Chrome so… who knows :wink:

@seanblue you mentioned some issue above (to be honest, I didn’t read all the previous comments). Is that still happening? I could try and look into it eventually. For now I have to get back to my reviews, there are too many piled up right now :-/ . (edit: haha, thanks btw. for posting the "Can’t continue reviews after canceling “wrap up” thread; I was having the same issue and I did initially think I broke this with my script and had no idea how I managed to do that :wink: )

@kobayashi I hope this is OK for you. I didn’t see a way to fork or suggest changes on greasyfork. If you ever return to this thread and want to update your original script then please of course feel free to copy my changes and I will remove my forked version from greasyfork.

2 Likes

It’s working! Thank you very much!

1 Like

@irrelephant Thank you so much! I was also using this script to translate things into my native language and it’s way easier to add synonyms during lessons than reviews. :relaxed:

May I suggest a minor adjustment? Usually after I type in a new synonym I press enter to confirm it, instead of clicking the little “+”. When I pressed enter just now it automatically took me to the next page, the reading section. Is there a way to fix this? If not that’s cool, I’ll just have to get used to it. Cheers.

@raegefilth To be honest I noticed that too and wasn’t sure if that was the behaviour of the original script or not because I think the original had never worked for me. For now I have 300 reviews waiting for me and am also a bit busy but I’ll look into it and will get back to you.

1 Like

@irrelephant If you’re referring to the issue about the notes, then I don’t know if the issue (where notes would seem to disappear) is still happening, but I assume it does. I can’t say for sure because I modified the script to delete the offending code. I wonder if this script was originally written at a time when you couldn’t add notes during lessons. You can definitely do that now, so having anything with notes in the script doesn’t make sense to me.

Here’s the code I deleted to stop the script from (visually) deleting my notes:

// delete keys for notes
if (currentQuizItem.rad) {
	$.jStorage.deleteKey('l/note/rad/m/' + currentQuizItem.id);
} else if (currentQuizItem.kan) {
	$.jStorage.deleteKey('l/note/kan/m/' + currentQuizItem.id);
	$.jStorage.deleteKey('l/note/kan/r/' + currentQuizItem.id);
} else if (currentQuizItem.voc) {
	$.jStorage.deleteKey('l/note/voc/m/' + currentQuizItem.id);
	$.jStorage.deleteKey('l/note/voc/r/' + currentQuizItem.id);
}

I also made it so that the script only runs on the lessons page and not on the other pages. I never saw the point adding synonyms before lessons.

@seanblue I see, thanks, makes sense. I removed that code from my version of the script as well.

@raegefilth I think I fixed the enter issue. It’s a bit of a hack but it seems to work. Updated version is 0.2.2.

2 Likes

There’s probably more code related to notes that you could remove if you want. I just did the bare minimum to get it working.

@irrelephant Ah, thank you! I haven’t tried it yet but I’ll see how it works during tomorrow’s lessons. :slight_smile:

@irrelephant thank you a lot for the update, it seems to be working just fine now.

1 Like

@irrelephant Once again, thank you very much for the update! It appears to be working just as before now.

1 Like

@Bourdel since you asked about it in another thread: the link to my fixed version is here: https://greasyfork.org/en/scripts/34839-wanikani-lesson-user-synonyms-2

I was wondering if I should update the title of this thread to include an info about there being a version 2 now but I felt like it might be rude since this is not my thread. I personally do however always have troubles finding the information that I’m looking for when I have to wade through an old and long thread to find it.

I recommend making a new thread (mentioning this one for credit of course) so that you have full control over the thread. I’m going to change the title of this one now.

OK, thank you!. I wasn’t sure if that would be considered spammy behaviour or something like that.

Posted the new thread here: [Userscript] WaniKani Lesson User Synonyms v2