Fixed it already. (^^)b
You can open the URL to the userscript again, to install version 0.2.2
For anyone stumbling across this, with the same problem. It was a simple matter of wrapping the textarea in another tag with the class
note-reading. Apparently it doesn’t matter, if it is a div or something else, I used a fieldset. I also added
noSwipe for good measure, because the official textareas have that too, but no idea, what that does. ¯\_(ツ)_/¯
Oh and btw. It might be necessary, to activate the “Check for updates” option in the script setting of Tampermonkey, to enable automatic updates.
Fixed it already. (^^)b
Some other things that would be good to have:
-Community Mnemonics on the Kanji/Vocab pages.
-Randomization of the displayed Mnemonics. The first displayed item often has a tendency to get more votes.
I have planned the display on the Kanji/Vocab page for the next major version 0.3
And the order of the mnemonics is supposed to be sorted by votes at some point. I also thought about adding a toggle-able option to push a random one to the front, to give it more exposure.
You can check out the GitHub page for the features, I want to add in the next version. 【Dakes/WaniKaniCommunityMnemonics2】. But I am always grateful for suggestions.
I also thought about adding an option to hide the meaning/reading part, depending on what is currently being viewed, because seeing the reading mnemonic, when you got the meaning wrong, might be kind of a spoiler.
I just released a new Surprise Christmas update 0.2.3
I wanted to release a those features in 0.3, but now I already have them ready, so why wait. Instead you can enjoy them now already during the holidays
- Mnemonics are displayed on the item pages.
- Visually looks much prettier. Text highlight color more vibrant. Width dynamic. All Buttons have sick effects on click and hover.
- Added ? insert button. Because ? toggles shortcut help menu.
- Focus textarea after Button press.
Happy Holidays to everyone
To figure out why it doesn’t work for you, I will need a few logs from the developer console.
Can you open the Tampermonkey script editor and change the line 36 from
const devel = false; to
const devel = true;? That way more messages will be printed to the console.
Then open the developer menu with F12 and go to the Console tab. Unfortunately many other userscripts spam the console with garbage. So to filter that, in Chrome based browsers (Chromium, Vivaldi, Opera etc.) add
url:wkcm in the filter field in the top. In Firefox
WKCM2.user.js That way only logs from WKCM2 will be shown.
Then just visit a page with Community Mnemonics and copy paste the console output here.
Oh yea, what browser are you using? And are you using Tampermonkey, not Greasemonkey? WKOF doesn’t work properly with Greasemonkey.
It seems that this script uses the global
wkItemInfo object created by my library script WaniKani Item Info Injector, but does not include
// @require https://greasyfork.org/scripts/430565-wanikani-item-info-injector/code/WaniKani%20Item%20Info%20Injector.user.js?version=985948
to make sure that the library script is running, leading to these error messages.
@Dakes Aside from the missing
@require, you are not using
wkItemInfo the way it was intended. This line adds a new “event listener” every time
getItem() is called, and they are never deleted:
// No need to go scraping the HTML wkItemInfo.forType(getItemType()).under(`examples`) .notify((i) => item = i.characters);
EDIT: Since you are running this code only on item pages I assume your
getItem()function is only called once? In that case this is not really a problem. But I think the method suggested below is still clearer.
Alternatively, you could use
item = wkItemInfo.currentState.characters. Or fall back to scraping the HTML and remove the
wkItemInfo dependency (in WK Item Info Injector, I’m using
document.querySelector(".radical-icon, .kanji-icon, .vocabulary-icon").textContent.trim() to get the characters from the webpage; on item pages of radicals that are images instead of characters, this results in an empty string).
Wow this is super helpful, thank you.
Turns out, I copied that piece of code from a different userscript, without realizing, it itself was a userscript. oops. （−＿−；）
Thats what I get for rushing the Item page code. I also had no idea, about “image radicals”. Good to know, before a bunch of “null” items appear in the spreadsheet, lol.
For now I will remove wkItemInfo. But I had no idea that this script existed. Makes me wonder, if I actually should use it. That would make the community mnemonics blend more in with everything else and probably also simplify my code in a few areas.
I just pushed the fix to GitHub. I also implemented compatibility with image radicals.
You can either let Tampermonkey search for an update or reopen the script link.
By the way, an even easier method of getting the item (kanji, voc or radical) on the item pages seems to be to simply get it from the url with
decodeURIComponent( window.location.pathname.slice(window.location.pathname.lastIndexOf("/")+1 ) );
Thanks for taking a look! Hope it didn’t take up too much of your weekend.
Unfortunately, it seems like I’m still getting a similar error, even after updating the script.
Hmm. This is odd. There definitely is no occurrence of
wkItemInfo in the whole script any more. Are you sure it did update properly? I know for me it happened a few times, that it installed two versions of the same script for some reason. Can you check the Tampermonkey dashboard, to see if there are other WKCM2.
Then open WKCM2 at the top of the code it should say version 0.2.4
Check for updates checkbox set?
If that doesn’t help maybe paste the new version manually over the old one?
I deleted and reinstalled it, and now it works! (^^)/ Thanks for the tips.
Unfortunately I can’t reproduce the error. Do you have any more details?
Does it happen always ore just once? Did you do anything specific for that to show? Did the mnemonic at least land in the sheet and show correctly after reloading? What Browser and script addon are you using?
Hi . looks like everything is good now
Guys, how to download all the wk mnemonics for both the meaning and readings? *.csv
I have search the forum but only found the Old wk mnemonics that are no longer in use.
Just to clarify, do you want to download all Mnemonics from WaniKani, or just the ones added by this Userscript?
If it is just the latter, just go to the Google Sheet, where all Mnemonics are stored: WKCM2DB - Google Sheets and go to File → Download → .csv / .tsv. Since it stores JSON data, which contains commas, you might want to choose .tsv
If you want the ones from WaniKani, I am not aware of a program that does exactly that. However, the API allows you to access the Mnemonics: WaniKani API Reference
Edit: One quick Google search later, I found this script, which should do what you want: [Userscript] Wanikani Item Inspector
So, for anyone wondering, Wanikani is apparently transitioning the webpage to a new framework, which is why the script just broke on the item overview pages.
Keisei Semantic-Phonetic Composition just got fixed, so it should be doable if some kind soul is willing
Some buttons might look a bit weird on the item pages, due to the new framework. And fixing them would require me to use different CSS on every site, so I just left it. Once all of WaniKani is moved to the new framework, I will fix that as well.