Closed MagTun closed 3 years ago
@MagTun You might be interested to see some tidying up I did:
7f6f760 Refactor difficultWords logic d967b81 Remove scraping and clear 5228823 Style popup
I look quickly at your last edit... the extension looks really nice now!
Just a two comments:
scrapping
function (and just now I retried inside document.addEventListener('DOMContentLoaded')
, since scrapping
is in fact not needed) but I get this error Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules
. My understanding of js "async function/await" is not good enough to solve this buggy workflow. I look quickly at your last edit... the extension looks really nice now!
Thanks for adding the checkboxes and button! That made it easy for me to layer on some styles that felt more like Memrise.
- it's possible to scrap difficult words even on non pro account (I don't have one and I can get my "difficult words")
Is this a question or comment? Not sure, but I was unable to export difficult words on my non-pro account.
- I don't know if you saw my comment about the alert "Only works on app.memrise.com/course*" but it would be nice to know right away that the extension doesn't work on the website instead of having to wait to press on the export button. I try to moved the alert inside the
scrapping
function (and just now I retried insidedocument.addEventListener('DOMContentLoaded')
, sincescrapping
is in fact not needed) but I get this errorUncaught SyntaxError: await is only valid in async functions and the top level bodies of modules
. My understanding of js "async function/await" is not good enough to solve this buggy workflow.- Also it would be better if this alert wasn't an alert but a message inside the message div (maybe with the checkboxes deactivated)
Honestly, I'm not really concerned about this and probably won't change it. Why would someone activate the extension on a non-Memrise website? If they do, at least they get a nice error message. It's an edge case, and any alternative would require some additional design thinking since there is no precedent for displaying an error or warning before the user clicks Export. Not worth it.
await
just has to be within an async
function. If it's at the module root, sometimes you have to wrap it in an IIFE like so:
(async function() {
await doSomethingAsync()
})()
Thanks for explaining the async function. I was able to add this feature thanks to your help (I just add the async function
in the run function
and move the alert part in the document.addEventListener('DOMContentLoaded')
). I have talked about this feature because I tried several time to launch the extension on a level page (not on the main course) and I couldn't understand why the app didn't work. It's a stupid mistake, but with this async function, there is an easy fix. I can do a PR if you want.
Concerning the "difficult words", it is not a question but an affirmation. I am able to get the "difficult words" from my non-pro account and from my friend's non pro-account. That may sound strange but did you make sure that you had difficult words in the course you tested (I ask because I made this error more than a couple of time). If yes, did you look into the json, maybe they are coded in a different way than the one I found for my course. Otherwise Memrise could have different kind of free account (ex: based on the year we joined in). But if you see a number next to "difficult words" in your course (even if you can't access them on the regular memrise website- I also can't) they should be stored somewhere.
I have talked about this feature because I tried several time to launch the extension on a level page (not on the main course) and I couldn't understand why the app didn't work. It's a stupid mistake, but with this async function, there is an easy fix. I can do a PR if you want.
That's reasonable. You're probably I'm still not entirely sure what it should look like to have a warning before hitting Export. You are welcome to submit a PR but I'll be honest that I'm skeptical and not super invested in changing it given that it is an edge case.
Concerning the "difficult words", it is not a question but an affirmation. I am able to get the "difficult words" from my non-pro account and from my friend's non pro-account. That may sound strange but did you make sure that you had difficult words in the course you tested (I ask because I made this error more than a couple of time). If yes, did you look into the json, maybe they are coded in a different way than the one I found for my course. Otherwise Memrise could have different kind of free account (ex: based on the year we joined in). But if you see a number next to "difficult words" in your course (even if you can't access them on the regular memrise website- I also can't) they should be stored somewhere.
I see! I don't have a course with difficult words. Do you know how I can get one?
For the warning, cf the new PR. For the difficult words: if you don't have difficult words in a course, just keep making intentional mistakes on a word and at some point memrise will flag it as "difficult". I don't know any other way of doing it.
Thanks for removing cheerio, that's really great to be able to manually install your extension!
For the difficult words: if you don't have difficult words in a course, just keep making intentional mistakes on a word and at some point memrise will flag it as "difficult". I don't know any other way of doing it.
Ah, you can click the lightning icon to mark a word as difficult! That's pretty cool that the extension can get difficult words without a pro account.
Awesome, thank you!