jj-tetraquark / wanikani-burn

Adds a space on the wanikani dash that reviews random burned items
4 stars 2 forks source link

Reviews not working #2

Closed RayderBlitz closed 8 years ago

RayderBlitz commented 8 years ago

The reviews seem to not work at all, the new items appear on the page but don't seem to function. When hovering the "new item" button it shows a "javascript:void(0)" but isn't responsive in any way. API key already is where it should be in the script.

Something I noticed a few times with the old script (edit: just checked, it's the case here as well) is that when loading the page the item at first appeared like it was in the screenshot of the thread with a "start" button and then turned to what can be seen in the screenshot i appended here.

The browser used is Firefox (should be the newest version, or at least among the newest ones).

The console didn't throw any errors, just those warnings (I translated them here): getPreventDefault() should not be used anymore. Instead, use defaultPrevented. Empty string given to getElementById().

ss 2016-06-02 at 05 31 56

jj-tetraquark commented 8 years ago

Huh, oh yeah. It seems to be totally borked in Firefox for me too. No idea why. I'll investigate and report back.

jj-tetraquark commented 8 years ago

I found that the reason it wasn't working for me was because I was viewing the page www.wanikani.com/ rather than www.wanikani.com/dashboard. That's a separate issue - it seems to be working for me in Firefox.

Interestingly though issue #3 seems to be very similar to this, except it's happening in Chrome. In both instances of this bug, there is also a dark theme being used.

I tried installing this one: https://userstyles.org/styles/116150/wanikani-simple-black and this one: https://userstyles.org/styles/113986/wanikani-dark but I still couldn't reproduce the issue. Can you tell me what theme you're using?

RayderBlitz commented 8 years ago

I'm using the former - in case I'm messing them up somehow (since I'm kinda tired atm) the one I made.

Also, I just tried completely disabling stylish and the result was the same. After that I tried loading the one without /dashboard (which is the default it loads for me) and there the field didn't appear at all, not even while loading, like it (sometimes?) does on /dashboard.

Also, since my style doesn't do any resizing or reformatting of fields etc., only changing colors, I can quite confidently rule out the style(s) being the cause.

jj-tetraquark commented 8 years ago

Aha! I hadn't spotted you were the author, nice :D

I need to find out for definite if the widget is being created and exists in the DOM. It's possible it's there and is just incorrectly styled (somehow).

I've made a separate branch which should log a lot of stuff out to the console. If you don't mind, could you uninstall your current version and install from here:

https://github.com/jonnydark/wanikani-burn/raw/bugfix/reviews-not-displaying/WanikaniBurnReviews.user.js

Once you've done that, can you go to the wanikani dashboard and send me the output? I appreciate it's hassle but given that I can't reproduce this error, I don't have many other options to debug it.

RayderBlitz commented 8 years ago

If I'm not missing something obvious here I did exactly as you said (get rid of the old, get the one you linked and look at the console) and I get the feeling that it didn't do anything at all. The warnings mentioned in the OP were still there, but the fields didn't appear. No console output other than the one I get without the script active.

jj-tetraquark commented 8 years ago

You're not missing anything obvious - the code runs in Chrome but Firefox is a bit more standards compliant and didn't allow me to do something I used to be able to do. Annoyingly as well, Firefox fails silently rather than saying that there's an error. I'd assumed JS working in Chrome would work in Firefox, but clearly that is a dangerous assumption!

Thanks for being patient. Try installing from that link again, it should work now: image

RayderBlitz commented 8 years ago

Now the script showed the (functionless) fields again, like the one from the thread and the console gave me some outputs as well. Since right now I don't have the head for this kind of thing I just left the output as it was without shortening it in order to not fuck up and delete important info (the lines in german are just the warnings i mentioned in the OP).

script load end WaniKani_Level_Duration.user.js:298:1 started Wanikani Dashboard Active Topics Panel Wanikani_Dashboard_Active_Topics_Panel.user.js:12:1 WKBurnReview: Running! WKBurnReview: Loading... Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Checking for wanikana... kanjiSvg Object { getSvg: kanjiSvg</this.getSvg(), onload: kanjiSvg</this.onload() } kanjiSvg.js:112:1 WKBurnReview: Checking for wanikana... getPreventDefault() sollte nicht mehr verwendet werden. Verwenden Sie stattdessen defaultPrevented. application-654a3414e264d243defbc071caf669cb.js:15:7122 WKBurnReview: Checking for wanikana... pathname: /dashboard WaniKani_Level_Duration.user.js:280:2 main() WaniKani_Level_Duration.user.js:282:2 init() start WaniKani_Level_Duration.user.js:263:2 init() end WaniKani_Level_Duration.user.js:271:2 checkLevel() start WaniKani_Level_Duration.user.js:79:2 prev level: 32 WaniKani_Level_Duration.user.js:127:2 cur level: 32 WaniKani_Level_Duration.user.js:128:2 next level: 33 WaniKani_Level_Duration.user.js:129:2 checkLevel() end WaniKani_Level_Duration.user.js:130:2 displayLastLevTime() WaniKani_Level_Duration.user.js:139:4 diffDays = 14.1 WaniKani_Level_Duration.user.js:153:2 displayType = 0 WaniKani_Level_Duration.user.js:154:2 get fct WaniKani_Level_Duration.user.js:25:5 WKlvldurLBTxt WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 titlexxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 lessonsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 reviewsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 radicalsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 kanjixxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 vocabularyxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 accountxxlvlup WaniKani_Level_Duration.user.js:27:2 START OF WRN WaniKani_Real_Numbers.user.js:14:3 WKBurnReview: Checking for wanikana... WKBurnReview: Getting WaniKana data WKBurnReview: Initialising the Burn Review widget WKBurnReview: Getting the review page stylesheet... WKBurnReview: Undoing conflicting CSS WKBurnReview: Adding burn review section WKBurnReview: Getting first burn review WKBurnReview: Got the review page document. Extracting styles WKBurnReview: Adding to document head WKBurnReview: Adding to document head Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 Diese Website verwendet anscheinend einen scroll-verknüpften Positionierungseffekt. Dies könnte mit asynchronem Verschieben schlecht zusammenspielen; siehe https://developers.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects für weitere Details und nehmen Sie an der Diskussion über damit verbundene Werkzeuge und Funktionen teil! dashboard Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review WKBurnReview: Updating Burn review item Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review WKBurnReview: Updating Burn review item Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review WKBurnReview: Updating Burn review item Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review WKBurnReview: Updating Burn review item Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review WKBurnReview: Updating Burn review item Leerer String an getElementById() übergeben.

jj-tetraquark commented 8 years ago

JavaScript-fehler in Deutsch! Ich habe nicht Web-Browser übersetzt Fehler kennen. Lustig!

Thanks for this, this helps a lot. It's pretty clear that the widget just isn't being made at all and it's not a styling issue. I have two ideas as to why this is happening.

  1. The script isn't accessing the API properly and so isn't building to the widget.
  2. It has something to do with Leerer String an getElementById() übergeben. I did a bit of research on this and passing getElementById an empty string is an issue in jQuery, but it was supposedly fixed. I don't know why it has re-emerged.

Can you try this:

Open up your console and run this command: localStorage.getItem("apiKey");

It should return your API key.

RayderBlitz commented 8 years ago

Yes, I ran the command and the API key was shown properly in the console after that. All the other scripts like rfindley's hoovard's etc. seem to not have any issues accessing the API and the key in the localStorage.

Also, please don't post any google translate sentences, it's almost physically painful to read. xD

jj-tetraquark commented 8 years ago

Ahah! Sorry, it's been many years since I last studied German and I was never a particularly good student! I'll should pick it up again properly some day.

Oh well, that's a shame, I was hoping it'd be straightforward. I'm afraid I'm going to need more information to try and fix this. Can you update your script to use this new version?

https://github.com/jonnydark/wanikani-burn/raw/bugfix/reviews-not-displaying/WanikaniBurnReviews.user.js

Once again, thankyou for being patient with me in trying to fix this. It's a nightmare trying to fix bugs you can't reproduce!

RayderBlitz commented 8 years ago

Oh, I'm sorry.. For some reason I just presumed you used google translate on a whim, I didn't mean to be an ass. If that's what you recall off the top of your head after several years that's not bad at all. So if you want to pick it up again don't let some stupid remark like mine up there discourage you. Granted, the second sentence was a mess and I'm not sure what you meant to express, but the first one and the exclamation at the end are correct and not at all unlikely to be used like that except for Fehler either being uppercase or the dash being omitted.

Now, regarding the new script, the console output is different but everything else seems to be the same. I'll just post it here for you.

script load end WaniKani_Level_Duration.user.js:298:1 started Wanikani Dashboard Active Topics Panel Wanikani_Dashboard_Active_Topics_Panel.user.js:12:1 WKBurnReview: Running! (unbekannt) WKBurnReview: Loading... (unbekannt) Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Checking for wanikana... (unbekannt) kanjiSvg Object { getSvg: kanjiSvg</this.getSvg(), onload: kanjiSvg</this.onload() } kanjiSvg.js:112:1 WKBurnReview: Checking for wanikana... (unbekannt) pathname: /dashboard WaniKani_Level_Duration.user.js:280:2 main() WaniKani_Level_Duration.user.js:282:2 init() start WaniKani_Level_Duration.user.js:263:2 init() end WaniKani_Level_Duration.user.js:271:2 checkLevel() start WaniKani_Level_Duration.user.js:79:2 prev level: 33 WaniKani_Level_Duration.user.js:127:2 cur level: 33 WaniKani_Level_Duration.user.js:128:2 next level: 34 WaniKani_Level_Duration.user.js:129:2 checkLevel() end WaniKani_Level_Duration.user.js:130:2 displayLastLevTime() WaniKani_Level_Duration.user.js:139:4 diffDays = 0 WaniKani_Level_Duration.user.js:153:2 displayType = 0 WaniKani_Level_Duration.user.js:154:2 get fct WaniKani_Level_Duration.user.js:25:5 WKlvldurLBTxt WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 titlexxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 lessonsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 reviewsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 radicalsxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 kanjixxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 vocabularyxxlvlup WaniKani_Level_Duration.user.js:27:2 get fct WaniKani_Level_Duration.user.js:25:5 accountxxlvlup WaniKani_Level_Duration.user.js:27:2 START OF WRN WaniKani_Real_Numbers.user.js:14:3 WKBurnReview: Checking for wanikana... (unbekannt) WKBurnReview: Getting WaniKana data (unbekannt) WKBurnReview: Data items { RadicalData: 0; KanjiData: 0; VocabData: 0} (unbekannt) WKBurnReview: Initialising the Burn Review widget (unbekannt) WKBurnReview: Getting the review page stylesheet... (unbekannt) WKBurnReview: Undoing conflicting CSS (unbekannt) WKBurnReview: Adding burn review section (unbekannt) WKBurnReview: Getting first burn review (unbekannt) WKBurnReview: Overlay applied (unbekannt) WKBurnReview: Getting new burn item (unbekannt) WKBurnReview: Burn item type: 2 (unbekannt) WKBurnReview: Burn item: 1 (unbekannt) WKBurnReview: Got new item (unbekannt) WKBurnReview: Got the review page document. Extracting styles (unbekannt) WKBurnReview: Adding to document head (unbekannt) WKBurnReview: Adding to document head (unbekannt) getPreventDefault() sollte nicht mehr verwendet werden. Verwenden Sie stattdessen defaultPrevented. application-654a3414e264d243defbc071caf669cb.js:15:7122 Diese Website verwendet anscheinend einen scroll-verknüpften Positionierungseffekt. Dies könnte mit asynchronem Verschieben (Panning) schlecht zusammenspielen; siehe https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects für weitere Details und nehmen Sie an der Diskussion über damit verbundene Werkzeuge und Funktionen teil! dashboard Leerer String an getElementById() übergeben. application-654a3414e264d243defbc071caf669cb.js:14:10403 WKBurnReview: Getting burn review (unbekannt) WKBurnReview: Getting new burn item (unbekannt) WKBurnReview: Burn item type: 2 (unbekannt) WKBurnReview: Burn item: 1 (unbekannt) WKBurnReview: Updating Burn review item (unbekannt) Leerer String an getElementById() übergeben.

Btw, you don't need to thank me everytime, I'm grateful that you picked up the script and try to fix it, so those few clicks and copy-pasting some console output isn't a bother at all for me. As such, thank you for using up some time of your day(s) for me and the other users.

jj-tetraquark commented 8 years ago

Aha! Excellent! I know exactly what the problem is now.

WKBurnReview: Data items { RadicalData: 0; KanjiData: 0; VocabData: 0} (unbekannt)

This is the same issue as issue #3 - The script failed to access your burned items the first time around for whatever reason and so created an empty cache. The script has no error checking to check if the cache is empty so it just errors out silently when it tries to access an item. Also because the cache exists (despite being empty), it never tries to get your items again.

Anyway, I have a plan for a fix for this. In the mean time, to get the script up and running on your side, you can run the following commands in the console:

localStorage.removeItem("burnedRadicals"); localStorage.removeItem("burnedKanji"); localStorage.removeItem("burnedVocab");

This will delete your broken cache and when you reload the page, the script should fetch it all again - and hopefully do it right this time.

Oh and as for the German, I was trying to say that I had no idea that errors were translated in web browsers. It's obvious now I think about it, but it still surprised me. I often feel guilty as a British person that everyone seems to understand my language better than I understand theirs, it's a little embarrassing!

RayderBlitz commented 8 years ago

Oh perfect, this seems to fix the issue, thanks for that. I switched back to the "original" one now, but still have the bugfix version and just disabled it in case it's needed again.

You could e.g. say "Ich wusste nicht, dass in Browsern (die) Fehler übersetzt sind.", which would literally mean "I didn't know that in web browsers (the) errors are translated." Also, I'd say you have no reason to feel guilty. Being able to speak english is just a pretty damn good perk nowadays - not to say required, since it's not quite that yet - so most people have some kind of motivation to learn it, whether it's being able to communicate in pretty much any country or because they need it for programming (on that note, I believe that the errors are translated so users who might not understand the most basic english can tell the support/whoever what it says without butchering the pronounciation and consequently having to spell all that for example).

jj-tetraquark commented 8 years ago

Ah right, thanks :) This issues is now fixed in the master branch as of commit 7cca74a The script on greasyfork should update automatically soon.