[Userscript] Community Mnemonics (v0.9.7.8)

Magnord said... Thank you very much for this userscript
I'm already enjoying it.

I tried to make the text more readable here
https://www.wanikani.com/kanji/%E8%A5%BF
but it didn't work well. (I tried some <br> too but they were refused)



 I really should allow those...

Edit: They should work now with the new update.
Samuel-H said...
Magnord said...
but it didn't work well. (I tried some <br> too but they were refused)



 I really should allow those...

Edit: They should work now with the new update.
<br> works fine now  but it seems that the 4 <span class="..."></span> are not allowed anymore.

(I'm going to sleep so don't wait for me !)


Magnord said...<br> works fine now  but it seems that the 4 <span class="..."></span> are not allowed anymore.

 Fixed. I should have thoroughly tested that first.
I'm an oddball who prefers Safari.  At first I tried to run this using NinjaKit, but it apparently runs user scripts directly in Safari's isolated script context, without a builtin way to inject into the real page, so this script's usage of JavaScript functions from the page fails.  This can be fixed by creating a script element containing the script to be run from page context and inserting it into the DOM, or, of course, by not using the page's JavaScript functions; it might be nice for any fellow Safari users if you did one of these.  I did the former.

While I was at it, in the interest of minimizing overhead, I converted the script to a native Safari extension; the wrapper is trivial, but I don't know whether you have a Mac or are interested in maintaining it.  If so, it's at http://a.qoid.us/wkcm-safari.zip

is there someplace to see what items a mnemonic has been requested for?

comex said... I'm an oddball who prefers Safari.  At first I tried to run this using NinjaKit, but it apparently runs user scripts directly in Safari's isolated script context, without a builtin way to inject into the real page, so this script's usage of JavaScript functions from the page fails.  This can be fixed by creating a script element containing the script to be run from page context and inserting it into the DOM, or, of course, by not using the page's JavaScript functions; it might be nice for any fellow Safari users if you did one of these.  I did the former.
While I was at it, in the interest of minimizing overhead, I converted the script to a native Safari extension; the wrapper is trivial, but I don't know whether you have a Mac or are interested in maintaining it.  If so, it's at http://a.qoid.us/wkcm-safari.zip
 Yeah, I know absolutely nothing about Macs so I couldn't really maintain it. I can put this in my main post though.

ShotgunLagoon said... is there someplace to see what items a mnemonic has been requested for?
You can just go through the level pages and look for the yellow badges. There's the spreadsheet itself where a requested mnemonic is simply labeled "!" but I don't want to link to it here for concerns that someone might mess around with it.

Hello! I appreciate the work of the people who support this useful crowdsourced tool. I list some issues that coul be fixed:

  1. When I press backspace in the mnemonic editor, it deletes two characters at time instead of one. It is a little annoying some times (>_<)
  2. This is a more difficult problem to fix, but i have to say it: the script controls everything. This not only exposes the database to hacking, but also makes the code of the script much higher than it should be. If the system has both client-server sides, the script would only have to worry about making requests to server. This prevents hacking, because the business logic is stored away from the client, and also slims the code of the script. But such a change would need a complete refactoring of the code…
Also, I’ve seen expressions like this:
boolvar = (boolexpr) ? true : false;

but there is no need to use a ternary operator, boolexpr evaluates itself to true or false and is assigned to boolvar.

Keep up the nice work!!

Supaa said... Hello! I appreciate the work of the people who support this useful crowdsourced tool. I list some issues that coul be fixed:

1. When I press backspace in the mnemonic editor, it deletes two characters at time instead of one. It is a little annoying some times (>_<)

I know why this happens but it doesn't happen for me. I don't know if it's because I use Chrome but in reviews the backspace doesn't normally do anything (and in your case it works properly) and I basically coded the functionality in myself to compensate. What happens to you is the result of my compensation code and the native backspace function happening together. I'm not sure what keeps it from working for me and until I find out, it'll be difficult to fix this.

2. This is a more difficult problem to fix, but i have to say it: the script controls everything. This not only exposes the database to hacking, but also makes the code of the script much higher than it should be. If the system has both client-server sides, the script would only have to worry about making requests to server. This prevents hacking, because the business logic is stored away from the client, and also slims the code of the script. But such a change would need a complete refactoring of the code...

This is due to my lack of professional coding experience. The need to rewrite the code is probably why I won't be getting to this anytime soon.
Also, I've seen expressions like this:
boolvar = (boolexpr) ? true : false;

but there is no need to use a ternary operator, boolexpr evaluates itself to true or false and is assigned to boolvar.

Yeah, I have derp moments when I code sometimes and this is the result. I should fix those...

Keep up the nice work!!
 Thank you, I will.

I’ve tried this out and… just, wow! What a brilliant idea! I’ve added a couple of my own mnemonics already. I’ll probably add some more when I get around to it. No idea if anyone will find them helpful or not, but who knows. Couldn’t hurt to try!

I have just discovered that the double backspace issue happens using Chrome while not having WaniKani Augmenter with mistake deletion enabled. I found this out when the extension stopped working for me today for some reason. Unfortunately, it’s difficult to fix this when the extension is no longer working. I’m still not sure why this doesn’t happen in Firefox.

Edit: It started working again so I was able to fix it.

Woo, another awesome add-on!  I’m in there right now, adding sexy mnemonics as we speak :smiley:

Haven’t had time to really sink my teeth into this awesome script yet, but I do have one suggestion/request:

Change:
 
   window.onload = function() { checkCMNewestVersion(0); };


To:

   document.addEventListener( “DOMContentLoaded”, function(){
        checkCMNewestVersion(0);
});


I’m not saying that yours is the only script to use ‘window.onload’, but you probably shouldn’t assume it is, my guess is that it should be avoided since only one function can be there when the page actually does load.

Why does the spreadsheet have so many empty rows with just the item and nothing else?

Ethan said... Why does the spreadsheet have so many empty rows with just the item and nothing else?
 Those have no mnemonics but the item is inserted in the spreadsheet when seen for the first time by anyone using the script.

Is anyone else having issues with the script? It won’t load at all for me and I’ve looked into it and it doesn’t seem to be directly related to the script but something prevents the external script that retrieves the spreadsheet data from executing its callback function. This external script isn’t the problem either as it hasn’t been updated recently. I don’t know how long it will take me to figure this out but right now I’m stumped.

Edit: OK, I’ve determined that it does in fact load but it just takes so long that nobody would be willing to wait for it. I don’t know what is causing this extreme delay as this wasn’t a problem before this morning but hopefully I can figure it out soon.

Samuel-H said...Is anyone else having issues with the script? It won't load at all for me and I've looked into it and it doesn't seem to be directly related to the script but something prevents the external script that retrieves the spreadsheet data from executing its callback function. This external script isn't the problem either as it hasn't been updated recently. I don't know how long it will take me to figure this out but right now I'm stumped.

Edit: OK, I've determined that it does in fact load but it just takes so long that nobody would be willing to wait for it. I don't know what is causing this extreme delay as this wasn't a problem before this morning but hopefully I can figure it out soon.
 I have had this problem, but just as often it doesn't load at all, but instead says that an error has occurred. I haven't had a good look at how the code handles searches but my hunch would be it has to do with the growing size of the spreadsheet. If the code hasn't changed then the spreadsheet is the only thing I can think of that would make a difference over time.

Maybe if you could delete the rows that don't have mnemonics or requests and see if the load time improves, then you'd know if you're on the right track.
Ethan said...
Samuel-H said...Is anyone else having issues with the script? It won't load at all for me and I've looked into it and it doesn't seem to be directly related to the script but something prevents the external script that retrieves the spreadsheet data from executing its callback function. This external script isn't the problem either as it hasn't been updated recently. I don't know how long it will take me to figure this out but right now I'm stumped.

Edit: OK, I've determined that it does in fact load but it just takes so long that nobody would be willing to wait for it. I don't know what is causing this extreme delay as this wasn't a problem before this morning but hopefully I can figure it out soon.
 I have had this problem, but just as often it doesn't load at all, but instead says that an error has occurred. I haven't had a good look at how the code handles searches but my hunch would be it has to do with the growing size of the spreadsheet. If the code hasn't changed then the spreadsheet is the only thing I can think of that would make a difference over time.

Maybe if you could delete the rows that don't have mnemonics or requests and see if the load time improves, then you'd know if you're on the right track.
 I highly doubt it. The sheet size hasn't changed much since yesterday when it was loading almost instantly. I think it may have to do with the accessing of the spreadsheet but I don't know specifically what. It seems to work normally for me on Firefox but not on Chrome.

It’s been a while since anyone’s mentioned anything about this, so I’ve got two things:

1) This thing takes significant processing upon first opening a review or lesson session. I don’t know if there’s something in the coding that can be done to ease that, but it basically locks up my browser for about 5-8 seconds without fail.

2) The format of the lessons doesn’t come out right for me. Scratch that: I just did some testing and figured out the issue. If anyone gets something that looks like this during their lessons…


then disable a script called WaniKani Example Sentences. That script didn’t seem to be working for me anyway…

3) (wasn’t there only two things? oh well) When using another script to reorder the lessons, it seems to affect the ability of this one to grab from the database. Basically, it shows up as if nobody has made a mnemonic yet. I feel like I’ve had this happen at other times too, but haven’t been able to track down any other distinct cause.

Having the same problems as the previous posts here: once i start doing my reviews, i have to wait several seconds for the script to process. The same goes for the page of several Kanji, once i try to load them and they have a community mnemonic.

Does anyone have a solution to the problem yet? It’s not that i can’t use the script any longer, but it can get really annoying over time :slight_smile:

Tolotos said... Having the same problems as the previous posts here: once i start doing my reviews, i have to wait several seconds for the script to process. The same goes for the page of several Kanji, once i try to load them and they have a community mnemonic.

Does anyone have a solution to the problem yet? It's not that i can't use the script any longer, but it can get really annoying over time :)
 I no longer work on this script but the annoying wait is likely because it has to access the large spreadsheet containing the mnemonics. This could probably be fixed by storing and accessing the data in an SQL database or maybe even smarter implementation of the spreadsheet method but honestly I can't be bothered at this point. Maybe I eventually will but I don't really have motivation to continue this at the moment due to work and another project. Sorry to disappoint you.