derat / duoleavemealone

Moved to codeberg.org/derat/duoleavemealone
https://codeberg.org/derat/duoleavemealone
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Suggestion: show message & improvements requests #3

Closed alexseyk closed 4 years ago

alexseyk commented 4 years ago

Hi currently you show correct message at the bottom right corner 1) Please show it at the middle bottom This way is easier to focus reading correct response, since there is preferred correct answer and others that are accepted. 2) add option for user to set time to display the above message or proved pre-set display times 3) in the message add link to the corresponding sentence answer forum discussion, so it can be clicked with longer display time In audio exercises and some others correct answers with typos or accents are not shown :( I sometimes check the correct answer via forum when i am in doubt

Thanks ! Great extension. Very useful.

alexseyk commented 4 years ago

Also Lesson complete message blocks the lesson review button in the bottom left corner ;(

2) instead of instant auto-proceeding and showing a correct answer message for xx seconds, simply auto-proceed after xx seconds, so user can reflect on the answer and click forum link if needed

derat commented 4 years ago

I've pushed (but not yet published) changes for your first and second suggestions, but I'm not sure that the third one is possible: Duolingo doesn't seem to make it easy to get the underlying report and discuss/forum URLs. :-(

As far as I can see, the report and discuss functionality is implemented using event listeners on elements, and I'm having a hard time finding a way to activate them after we've moved on to the next question. The extension's message contains cloned copies of the original Duolingo UI, and cloneNode() doesn't preserve event listeners (https://stackoverflow.com/questions/15408394/). I've tried manually copying the onclick property to the cloned elements and making the cloned elements call the original element's click() method, but neither approach seems to work.

alexseyk commented 4 years ago

Cool! Thanks. as i wrote in my 2nd comment about 2nd suggestion, if you change the whole concept and instead of showing the message on the next page, just show a current page for some time, there will be time for user to compare his answer to correct one and click forum link if need.

It seemed to be the main concern / request on the forum

https://forum.duolingo.com/comment/36784718

They way i see it there are 2 somewhat conflicting applications of your extension: for timed practice and for normal practice

I understand that you developed it primary for timed practice & you want to minimize display time while for normal practice / lesson (where my interest is) I just want to save on mouse clicks

May be have 2 different behaviors then ?

derat commented 4 years ago

Thanks for the explanation, and sorry for not directly addressing your second comment in my reply. I actually wrote this extension before I was using timed practice -- I was just getting annoyed at needing to confirm every correct answer in the normal untimed skill tree.

Please let me know if I'm misunderstanding, but it sounds to me like the main concern is that you want to have time to review the allegedly-correct answer displayed by Duolingo so that you can identify errors and check the forum. Is that right?

If so, I'm not sure if automatically advancing after each correct answer is the right approach to use. It seems to me like users who want to review answers would also want to manually advance when they're satisfied that the answers are actually correct. Even if the extension were changed to let you e.g. see the correct answer for 5 seconds before clicking the "Continue" button to move on to the next question, it seems like sometimes that wouldn't be long enough to check the answer, while other times it might be too long and result in you needing to click the "Continue" button manually.

If I added a checkbox to the options page to control whether the extension automatically clicked the "Continue" button after a correct answer or not, would that satisfy your use case? Would the other behavior (automatically starting practice, skipping motivational messages, skipping through the post-lesson screens, etc.) still be useful to you if advancing after correct answers were disabled?

alexseyk commented 4 years ago

Hi Daniel No need to apologize, i've been told sometimes that i don't express my creative suggestions clearly. I always assume that developer knows his stuff and would catch-up with whatever changes i suggest.

Yes, you understand the issue properly.

You are right there is no "fit all solution" . Earlier lessons are just 1-2 word sentences, later are complex sentences. Naturally it takes different time to comprehend those, also some people read & type slow other faster. Hence the suggested option to customize display time. Which you kindly agreed to implement :)

Skipping the useless pages is the best part of you program!!! Option to turn on-off auto continue on a correct answer page is one solution.

Personally i wish for auto continue with a countdown or a pause button: Checkbox Options to display feedback message 1) on the next page ( the way things are now) 2) on the same page

Showing your feedback message on the same page as the allegedly-correct answer displayed by Duolingo is obviously redundant. But it is a good visual representation of the running scrip and reminder of page auto progress. To make it less redundant i suggest adding countdown and / or a pause button , if it is not too much bother.

Thanks Alex

alexseyk commented 4 years ago

in the message add link to the corresponding sentence answer forum discussion, so it can be clicked with longer display time

FYI: A fellow coder thinks this can be possible https://github.com/ToranSharma/Duo-Strength/issues/40#issuecomment-633230713

derat commented 4 years ago

Thanks for the link. After looking into this a bit, I think I see how it works. It also probably explains why opening a discussion page in Duolingo takes so long. :-/

The sessions data that gets fetched at the start of a lesson is from a URL like https://www.duolingo.com/2017-06-30/sessions (I don't know what the date signifies) and is a 500 KB JSON object structured like this:

{
  "challenges": [
    {
      "sentenceDiscussionId": "ad40bc11d2c22e2e23cdc0635b12e87e",
      "newWords": [],
      "sentenceId": "ad40bc11d2c22e2e23cdc0635b12e87e",
      "metadata": {
        "discussion_count": 511,

It looks like the browser later fetches a URL like https://www.duolingo.com/sentence/ad40bc11d2c22e2e23cdc0635b12e87e, which is a 750 KB JSON object containing the following:

{
  "avatar": null,
  "backend_latency_ms": 5557,
  "comment": {
    "id": 15800258,

There are additional learning_language, ui_language, and _ query parameters on the URL, but they don't seem to be required.

From there, it looks like you can get to the actual discussion page at https://forum.duolingo.com/comment/15800258.

derat commented 4 years ago

I think this is mostly working now, but it ended up being much more complicated than I'd hoped. As such, I haven't pushed a new version to the web store yet.

Would you mind giving it a try to see if it's working for you? I think that you should be able to download the latest code from https://github.com/derat/duoleavemealone/archive/master.zip, unpack it to a directory, and then load it by going to chrome://extensions/, enabling the Developer mode switch at the top right, and then clicking the Load unpacked button at the top left and browsing to the directory you created. You'll probably need to temporarily disable the packaged version of the extension in order to use the unpacked version.

I've seen the detection logic fail occasionally, and there's some more room for improvement (e.g. it'd be nice to have an option to open the discussion tab in the background, and a configurable hotkey for opening it). I'll probably open separate issues to track those at some point since this issue has covered a lot of ground. It'll probably take me a while to get to adding things like that since my development process for Chrome extensions is pretty painful compared to other code I could be writing. :-(

Oh, and just to mention it, I haven't looked into making the "report" link work, so it's just hidden right now.

alexseyk commented 4 years ago

Ok. It is somewhat difficult to troubleshoot since not all sentences have corresponding discussion pages.

Can you add "Solutions" link if / when it is available via Solution View extension ? Can you add "Lesson review" link to the after lesson display too ?

Opening new page / tab without changing focus - I think is part of chrome settings. Yes it will be nice too have for the discussion tab, and hot key too :)

derat commented 4 years ago

Sorry, I think that this extension is fragile enough as it is -- if/when Duolingo changes their UI, the whole thing is likely to stop working (or worse, start misbehaving). I'm not planning to try to integrate it with other Duolingo-related extensions.

alexseyk commented 4 years ago

FYI: links to "solutions" from https://github.com/blmage/duolingo-solution-viewer are shown now along with link to "discuss" Not sure if it is something you've done or blmage or due to changes in Duolingo. Anyway thanks! I hope it stays this way.

Screen Shot 2020-07-09 at 10 23 33
derat commented 4 years ago

Thanks for the update! It wasn't due to any changes on my side, though.

After a correct answer, duoleavemealone clones Duolingo's "correct" message and then makes a new copy of it in an overlay that remains visible after the "next" button is clicked. It's possible that other extensions might be adding their content to the message before it gets cloned, or might even be adding content directly to duoleavemealone's overlay. If the other extension uses simple <a href-style links, they should work. If it uses JS event handlers, then it'll only work in the latter case, as event handlers can't be cloned (which is why making the "discuss" link work was hard -- Duolingo uses an event handler there).

I don't know if Chrome makes any guarantees about the order in which different extensions' content scripts are executed. They might even all be executed simultaneously.