1. Forum
  2. >
  3. Topic: Duolingo
  4. >
  5. Userscript: Review Lessons in…

https://www.duolingo.com/profile/HodofHod

Userscript: Review Lessons in Duolingo

Last September, at the Duolingo Hackathon (http://blog.duolingo.com/post/62723181502/duolingos-inaugural-hackathon), a feature that would allow us to review lessons was demoed.

Well, the (entirely awesome) Duolingo team is really busy, and they haven't gotten to this yet, and I'm rather impatient (sorry), so as a late New Years gift I present...

The Duolingo Lesson Review (userscript)

Basically, it saves every problem so that you can come back to it later; either during or after the lesson. It highlights in red the problems you missed, and you can click on each individual cell to go back and review that lesson. There are also arrows for navigating forward and back.

Cells, highlighted green and red, with arrows

At the end of the lesson, there's a "Review" button that takes you back to the last problem: Successful Lesson end view Failed Lesson end view

And there's a "Resume" button when reviewing lessons, which takes you back to the current problem or to the end. Review buttons

The script is available on my GitHub page (https://github.com/HodofHod/Userscripts).
There are also instructions on how to install it there.

Notes and Warnings

  • This has not been developed by Duolingo staff. It may not behave properly, and there will be bugs. It might do all kinds of nasty things, like mess up your perfect streak, ruin your speed record, or eat your goldfish.
  • UPDATE: With the exception of reporting, all features should be available on reviewed lessons, including commenting, voting, audio, hints, verb conjugations etc.
  • UPDATE: Discussions are now loaded on demand instead of preloading.
  • If you know Javascript and jQuery, and you read the code, just know that I am sorry. So sorry.
<h1>So give it a shot, and let me know what you think! I hope you find it useful!</h1> <h1>Update: You can now pause timed sessions to review, discuss, or report!!</h1>
January 8, 2014

83 Comments


https://www.duolingo.com/profile/Usagiboy7

Nooooo!! Not my gooooold fish!

January 8, 2014

https://www.duolingo.com/profile/HodofHod

In my defense, he was delicious.

January 8, 2014

https://www.duolingo.com/profile/Usagiboy7

( ゚ロ゚)

ヽ((◎д◎ ))/

January 8, 2014

https://www.duolingo.com/profile/Jack.Elliot

I told you to keep away from that lovely hungry cat

January 8, 2014

https://www.duolingo.com/profile/DeanG6

You can have my goldfish. It's the streak that I'm most attached to. Is my streak really at risk when I use a user script like yours or were you kidding? Thanks for coding this.

February 27, 2015

https://www.duolingo.com/profile/Eey91

It is prefectly safe, it is not related with streak. I've been using them for a long time now and I have not had any problem.

February 27, 2015

https://www.duolingo.com/profile/HodofHod

As @Eey91 says, It shouldn't affect your streak at all. You can always confirm this from the Duolingo homepage, which shows you your daily activity.

March 1, 2015

https://www.duolingo.com/profile/DuoSwan

is there a typo? Is this the page of the great and terrible script ---> https://github.com/HodofHod/Userscripts ?

Update. Well, it is great. Fast enough and very useful. Thank you.

January 8, 2014

https://www.duolingo.com/profile/HodofHod

Good catch! Here have a lingot, and be sure to let me know if you have any more feedback!

January 8, 2014

https://www.duolingo.com/profile/DuoSwan

The effect of the script is that I'm using timed practice most of the time now :) It helps to feel more confident and not to miss anything important in a rush. Though I've noticed it doesn't work while practicing words from Vocabulary section (may be useful for revising verbs, for example). Can anything be done about it?

January 12, 2014

https://www.duolingo.com/profile/HodofHod

Whoops, can't believe I missed that! Should be fixed now; have a lingot! I'm thrilled to hear it's helping you learn with Duolingo! :D

January 12, 2014

https://www.duolingo.com/profile/DuoSwan

Thanks! It works perfectly :)

January 12, 2014

https://www.duolingo.com/profile/BettyJJ

Excellent extension! Duolingo should hire you. :)

January 9, 2014

https://www.duolingo.com/profile/HodofHod

Thank you! :D I'll tell them you said so ;)

January 9, 2014

https://www.duolingo.com/profile/Dessamator

Excellent extension, works as advertised, at least in Firefox, and in Google chrome too (just made a mistake when I downloaded it).

Edit: I can read java code, though I haven't jumped into javascript in ages. It doesn't seem as bad as you claim it to be. Either that or I am extremely rusty.

January 8, 2014

https://www.duolingo.com/profile/oskalingo

Despite the similarity in names and some syntactical conventions, Java and JavaScript are actually not terribly alike as programming languages.

January 9, 2014

https://www.duolingo.com/profile/Dessamator

Luckily for software developers, being fluent in one programming language, and being able to think logically can help you learn many languages with moderate difficulty. So, hopefully I can re-learn it once I get off my lazy bum.

Anyway, scripting languages are really simpler than 'real programming languages' in my opinion. Probably much simpler than learning a different romance language, if one is known already.

January 9, 2014

https://www.duolingo.com/profile/PatriciaJH

Somehow this makes me suspect you've never tried to do much with Bash scripting... and maybe not Perl, either....

IME, the real difference between languages, scripted, interpreted, or compiled, is how much thought has gone into its usability from a programmer's standpoint -- for instance, Python -- and how easy it is to test the individual expressions or small chunks of code as you work, which is often more a function of your programming environment, and how you've set things up for yourself.

January 24, 2014

https://www.duolingo.com/profile/Dessamator

I have created simple bash scripts, a long time ago. I didn't really find anything challenging about it, but then again, they were simple. You are quite right that I've never used Perl or python, though I've used a bit of PHP, and Javascript. The scripting language I've used quite a lot though, is definitely Lua Programming Language, in a Direct Connect Hubsoft called Ptokax. I loved the simplicity of it and developed and modded a couple of scripts.

Well, I can't say much about scripting languages though, I was mostly taught using C++, and Visual Basic. Java I learnt just a bit in my final undergraduate year.

January 24, 2014

https://www.duolingo.com/profile/856pm

I've wasted my spare time on:

  • HTML

  • Javascript

  • CSS

  • C

  • Objective-C

  • Python

  • Ruby

  • Pascal

  • x86 Assembly

  • Bash scripting

and probably some others...

February 5, 2014

https://www.duolingo.com/profile/4of92000

@856pm: Boy, you have a LOT of spare time.

April 9, 2014

https://www.duolingo.com/profile/HodofHod

Thanks! I'm very self-conscious about my code, because it's all self-taught, and I haven't yet picked up on the coding standards, etc.. I'm getting it slowly but surely, though.

Thanks for the feedback, have a lingot! Let me know if there's any features you want to see, or something that needs fixing!

January 8, 2014

https://www.duolingo.com/profile/Dessamator

It seems, I hit the reply chain limit, so I'll respond here. I like the new changes, they are quite intuitive and easy to understand.

Regarding "beautiful" code, I remembered a quote I shared in a previous discussion that is perfect for this occasion:

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live” (Martin Golding, n.d.).

January 10, 2014

https://www.duolingo.com/profile/PatriciaJH

How about, as if the person maintaining it will be yourself, when you have entirely forgotten what the hell you did that for, and also any of the logic of the code; and you will be trying to fix it under insane conditions, and the survival of A) your company or B) your client's company and C) in either case your job, will depend on getting it fixed yesterday.

This is IME quite as motivating, and also likely to be true.

January 24, 2014

https://www.duolingo.com/profile/Dessamator

That's quite good, I was taught java ( at a university), and I don't believe I could even begin to think of how to design a user script. Web-based development (Javascript ) was kind of a last semester subject, where we mostly copy pasted some code and changed a couple of things. I can hardly remember how it worked.

So, you know more than I in terms of web-based development, most likely.

Don't worry too much about coding standards, there aren't many grammar nazis in the IT world, everybody dislikes seeing messy code, but IT people are generally more oriented towards functionality rather than beautiful code. Or at least that's my view, my code tends to be a complete mess, I randomly create variables with odd names, change them, and never comment things properly.

Anyway, I think it would be nice to :

  • Keep track of the current lesson, maybe a border or something;
  • Put a border or sign on the last lesson, so we know how to get back to it; and
  • Perhaps some sort of counter or wrong / total answers;

That said, I think it is quite a nice attempt, even if duolingo implements it officially, I believe you should still try to make another one. :)

January 8, 2014

https://www.duolingo.com/profile/HodofHod

Thanks, I appreciate that a lot!
As to your suggestions;

  • On my TODO list (in the code, even).
  • Hmm, there's already a "Resume" button, but I can do this too. Any idea what that might look like?
  • Good idea! I think I'll put that to the right of the progress bar. I have to think where to put it on the final page, though.
January 8, 2014

https://www.duolingo.com/profile/Dessamator
  1. Yes, I saw it no.1 there, just reinforcing that it is a good idea;
  2. Simply a golden border around the lesson the user is currently looking at; and maybe another border on the last lesson; and
  3. Glad to see you're adding that;

You're welcome!

January 8, 2014

https://www.duolingo.com/profile/HodofHod
  • So, last update added navigational arrows and a styling for the selected lesson that makes it look like it's depressed.
  • I'm not sure how to style the current lesson, since it's sometimes colored and sometimes blank, and making it look unpressed hasn't worked so well yet. Borders also look pretty off.
    I think maybe I'll just stick a ->> arrow next to the ->. That plus the "Resume" button ought to be enough, I hope.
  • Still working on this.
January 9, 2014

https://www.duolingo.com/profile/pablobaytart

Also works under debian's/gnome's firefox. Your code cannot be too weird

January 9, 2014

https://www.duolingo.com/profile/HodofHod

That's why the code is weird! I had to make it cross-browser which means hijacking a lot of Duo's site js. I want to talk to whomever it is that wrote that. :D

January 9, 2014

https://www.duolingo.com/profile/Dessamator

Well, you have a list of staff members, I think the software engineer is probably the culprit. Although it is likely that it was a team effort, so it'll take more time to find whodunit.

January 9, 2014

https://www.duolingo.com/profile/HodofHod

I didn't mean that they did it badly! :D Once it's unminified, it's not terribly hard to read. But it is a rather large web app, so there are some parts I'm still not clear on that I'd like to be.

January 9, 2014

https://www.duolingo.com/profile/Dessamator

I see, I doubt he/she/they will say anything. I'm not sure if it is a rule in the company or a personal preference. But staff members don't mingle too much with users, they will generally answer a short question, or request more information/provide information, but not much beyond that.

In a way, it prevents them from saying something that they may have to take back, or perhaps, prevents them from getting involved in many controversial and lengthy discussions around here.

Anyway, software development is an adventure, if they told you, it would not be as fun to unravel the puzzle. :)

January 9, 2014

https://www.duolingo.com/profile/SilvioKee

this is just awesomely brilliant!! Thank you so much!!!

January 9, 2014

https://www.duolingo.com/profile/HodofHod

Thank you! I appreciate it!

January 9, 2014

https://www.duolingo.com/profile/dnovinc

Thank you for sharing this :) It works great.

January 10, 2014

https://www.duolingo.com/profile/856pm
  1. Are you updating the design soon to reflect the new design? (which isn't a big deal)

  2. I got it working on Safari on OS X: JavaScript Blocker, an extension, also includes a greasemonkey engine.

February 5, 2014

https://www.duolingo.com/profile/HodofHod

I updated it so that it works properly on the new design a while ago. Are you saying I should change the UI? I think it still matches pretty well. (Or do you have the new one, and you're experiencing bugs?)

Either way, if your browser doesn't auto update your scripts (like Firefox with GreaseMonkey), you may want to check out my latest script, Duolingo - All Scripts. It automatically loads the latest versions of all my scripts, plus any new scripts I might add later. If you only want some of the scripts/mods, you can enable or disable individual features in Duolingo's Settings page.

February 5, 2014

https://www.duolingo.com/profile/856pm

I know, that is the version I use. :-)

February 5, 2014

https://www.duolingo.com/profile/HodofHod

I think you probably use Duolingo Mods, which I posted about last week (https://www.duolingo.com/comment/1607651$comment_id=1617620).

Duolingo All Scripts takes it another step by just loading the latest version of Duolingo Mods. That way, I can update Duolingo Mods to add more mods, or new scripts, and you don't have to update anything at all. It seems a bit convoluted, but it works very well for me, and I hope it makes it more convenient for anyone to use.

Btw, I didn't document the enable/disable settings before. Did you happen to notice them?

February 5, 2014

https://www.duolingo.com/profile/Usagiboy7

@HodofHod

I saw "Duolingo Mods" and my first thought was "Wait, there's a script for mods?? What have I completely missed here!!" lol

February 5, 2014

https://www.duolingo.com/profile/HodofHod

I could, you know, if you just nudge nudge, wink wink. ;)

February 5, 2014

https://www.duolingo.com/profile/856pm

Duolingo Modifications :-)

February 5, 2014

https://www.duolingo.com/profile/Usagiboy7

HodOfHod, you should make a guide for how to make DL Userscripts and stick it on the Duolingo Wikia. (This from someone who knows nothing about what a userscript is, how it works, etc. I'm still at that stage where I thoroughly believe that you can and are doing real magic. ;)

February 5, 2014

https://www.duolingo.com/profile/Usagiboy7

@HodofHod

lolz. I'm content at the moment with what I've got on screen. And if anyone else wants a mod screen, they'll have to work really hard, be on all day, and cross their fingers when Staff starts inviting more people. It'll be tough competition though, there are just so many awesome and helpful Duolingoers to pick from. :D

Edit @856pm, yeah it just took my brain a moment to click into gear. ;)

February 5, 2014

https://www.duolingo.com/profile/HodofHod

Oh, I don't actually want to be a mod, I've done that sort of thing before, and it requires a lot more time than I currently have for it. :D Not to mention I'm not on Duolingo nearly enough in the first place.

February 5, 2014

https://www.duolingo.com/profile/HodofHod

Shucks, I forgot to reply to your guide suggestion.

  • I didn't even know there was a Duolingo Wikia!
  • I'd probably be terrible at writing a guide :( On the bright side, there are probably a million userscript guides out there that can be adapted for Duolingo.
  • A userscript is basically a little Javascript program that runs after (or during the time when) the website loads. It can make changes to the website's HTML, as well as the website's own Javascript programs. So any userscript has to be closely tailored to an individual site, and a specific purpose. Any major changes in the site (like Duolingo's redesign) will break the script, necessitating adjustments and occasionally entire rewrites. (Thankfully, the redesign only required me to make minor updates.)

I hope that makes some sense, otherwise, you can just fall back on the "magic" thing. Sounds cooler, too. :D

February 9, 2014

https://www.duolingo.com/profile/856pm

Nope.

February 5, 2014

https://www.duolingo.com/profile/856pm

I don't see the enable/disable settings. Is that only for the new design?

February 5, 2014

https://www.duolingo.com/profile/HodofHod

Probably. Do you not have the redesign yet?

February 5, 2014

https://www.duolingo.com/profile/856pm

Nope, still on the old design.

February 5, 2014

https://www.duolingo.com/profile/jayeidge

I just now discovered your script and it is so awesome. Thanks a million for that.

October 3, 2014

https://www.duolingo.com/profile/HodofHod

My pleasure, I'm glad you like it :D

October 3, 2014

https://www.duolingo.com/profile/markkore

Great job on the original and nice update HodofHod! I upvoted your thread and gave you top billing credits in the timed practice flow discussion page.

January 4, 2015

https://www.duolingo.com/profile/HodofHod

Thanks! I'll have a look!

January 7, 2015

https://www.duolingo.com/profile/the.worst.horse

Really nice work, actually. So, as we used to say when code was still punched on rectangular cards, "dude this is freakin' awesome".

January 10, 2014

https://www.duolingo.com/profile/HodofHod

:D Back in the days when bugs were real, and weren't the programmer's (seg)fault. ;-)

January 10, 2014

https://www.duolingo.com/profile/dnovinc

Little glitch: Yesterday when I finished "Lesson practice" the continue button became unresponsive. Thankfully word strength was updated.

January 12, 2014

https://www.duolingo.com/profile/HodofHod

Hmm. I haven't been able to duplicate this. Does it happen every time for you? Did you review the problems before trying to continue?

January 12, 2014

https://www.duolingo.com/profile/BettyJJ

I think I have found how to replicate this. You see, DL displays at least two screens after you finish a lessen: first, you have finished blabla; second, you strengthened these words blabla. If you click "review" button before DL finishes displaying these screens, the "continue" button will become unresponsive. I hope that helps.

January 13, 2014

https://www.duolingo.com/profile/HodofHod

Ok, I've pushed an update that, I hope, fixes this. Let me know if you still see problems! :)

January 14, 2014

https://www.duolingo.com/profile/HodofHod

Yep, I'm seeing it now, thanks for figuring that out! Now I'm trying to figure out how to fix it without changing the UX too much. The simplest would simply be to disable the Review button until everything is loaded, but I'd like to find a better solution. Here, you both deserve a lingot!

January 13, 2014

https://www.duolingo.com/profile/Dessamator

Yes, I don't think the review button is really necessary, since we can always use the back and forth arrows to navigate the previous questions.

January 13, 2014

https://www.duolingo.com/profile/HodofHod

After a successful lesson; Duolingo removes the header with the arrows, cells and hearts. I could (in theory) also show the header on the end view, but I don't think that would solve this particular problem.

January 13, 2014

https://www.duolingo.com/profile/dnovinc

It only happened once. Yes, I reviewed the problems before trying to continue. Also I was reviewing them before I was finished with all 20 sentences. I am using firefox 26.0

January 12, 2014

https://www.duolingo.com/profile/MaorB1

WOW! How have I missed that? Awesome work my friend!!

February 2, 2014

https://www.duolingo.com/profile/HodofHod

Ein bayah, I'm glad you like it! :D

February 2, 2014

https://www.duolingo.com/profile/856pm

Just two requests:

  • Add the review button to the successful end view.

  • Get rid of the (css?) gloss to fit the new design.

February 5, 2014

https://www.duolingo.com/profile/HodofHod

Sorry for the delay:

  • If the review button isn't showing on a successful end view, that's a big bug, it should.

  • I'm not exactly sure what you're referring to :(. The gloss on what?

February 9, 2014

https://www.duolingo.com/profile/856pm

That was when I was still on the old design. There were a few bugs with the old design+new version, but now we're all on the new design, so that's fixed.

February 9, 2014

https://www.duolingo.com/profile/dima

Great job!

March 16, 2014

https://www.duolingo.com/profile/dnovinc

Hi HodofHod,

I have couple of ideas regarding your userscript. Btw it think it's great. It helps a lot.

Could something like this be done?

Could the progress bar show the number of comments in the discussion ?

That way when you're finished with practice you don't have to go through all of the exercises in order to check those with comments.

Also since it doesn't look very appealing I was thinking it could be switched on/off.


Another idea is to have clickable arrows on each side of the sentence discussion in order to view only sentence discussions when the user is finished. Instead of clicking several times to view the discussion this could reduce it to only one click.

I think it would work even better if we could go forward and back by pressing right and left on our keyboard.

May 15, 2014

https://www.duolingo.com/profile/Eey91

A little bit late right? I just knew about your script. It's really nice when people develop things like this for everyone since not everyone knows these programming languages, but I'm sure everyone can take advantage of them. Thanks.

October 3, 2014

https://www.duolingo.com/profile/HodofHod

Never too late! :D

I'm really glad to hear that you like it!

October 3, 2014

https://www.duolingo.com/profile/Eey91

Hello.

After the last update which included the removal of the hearth system, the exercises layout was changed a little bit as well.

Even though the script stills works fine, I wonder if it could be possible to tweak it a little bit to fit the new update since it has some graphical bugs. Here are two pictures, one with the script activated and how the interface looks when I disable it. Since I know nothing about programming I guess this is the only way I can help.

January 1, 2015

https://www.duolingo.com/profile/HodofHod

Thanks so much for letting me know! I'm not sure exactly when I'll have time for this, nor am I sure exactly how to update the script to suit the new interface, since it doesn't have a set number of lessons nor a position indicator like the old one. I'm thinking maybe something like "← current lesson / total lessons →" centered above the strength bar.

If you have any input/ideas, let me know :)

January 7, 2015

https://www.duolingo.com/profile/Eey91

The script still works as it should, even though the bar is different it keeps track of every individual exercise including those sentences in which you don't answer correctly, you can go back in the same order of exercises (I just tested it). The only difference is that the new bar does not move but that's not an issue.

My suggestion is only about the layout itself, changing the positioning of the arrows since one gets covered by the bar itself and the lesson icon doesn't match its correct position, I don't know if that would be difficult to change, either way it is not something crucial, my intention was to let you know so if you have time you could check it, it would be nice to have your script up to date =).

January 7, 2015

https://www.duolingo.com/profile/HodofHod

Sorry for the delay. I've now fixed this and uploaded the new version. Please give it a try and let me know if it works for you!

January 12, 2015

https://www.duolingo.com/profile/Eey91

Thank you very much, I didn't do anything and it updated automatically and looks great now!

January 13, 2015

https://www.duolingo.com/profile/Katzenperson

Hello! I was recently updated to the new DuoLingo website.

Unfortunately DuoLingo has taken away the Review button that used to be present at the end of lessons.

Because this has happened, I was wondering if you would consider revising your old script to work again in the new site, so that we could get this function back.

I really miss this capability, and would be so grateful if you could make this happen.

Cheers!

May 3, 2017

https://www.duolingo.com/profile/JoelFeodiy

This is a great hack, but when the Duolingo people do it officially, I think it would be improved by giving actual links to the lessons which help with the issue causing the error. This could be done by creating an association between words and the lessons they appear in, so that when you choose an incorrect word, Duolingo can take the correct word, lookup which lessons that word appeared in, and then shoot those links back at the user. This will eliminate the need for users to track down those lessons themselves and thereby make it easier to correct issues and misunderstandings. (I just want to add this here, in the hope that such a feature is not overlooked by the duolingo people. Apart from that, this hack is very useful. Thank-you!)

February 9, 2014

https://www.duolingo.com/profile/IrishPerson2

Damnaigh!! You can pause timed practice?? How??

December 20, 2015

https://www.duolingo.com/profile/FieryCat

So I've had a look at Duos code, and it looks like they've made a huge change to how they compile and shrink it. A lot of the objects in the code no longer have meaningful and easily accessible names (like duo.TimedSessionView.timer_view) but instead nonsensical names that aren't easily accessible the way the older ones were.

I'm going to have to keep looking, and see if I can figure out a way to work around this.

From: https://www.duolingo.com/comment/1738577$comment_id=9634716

December 21, 2015
Learn a language in just 5 minutes a day. For free.