Quick course switcher for the new website
This script allows you to quickly switch between languages for those who do reverse trees or laddering (multiple "from" languages). It's only working on Chrome / Chromium atm.
I've adjusted the script made by Arekolek to work with the new website. The old version of the script has been integrated, which is important as some parts of the website haven't been ported over to the new system yet. Beware that the new script might contain some bugs.
Credits to Arekolek and Andrewmof for the old versions of the script:
I likely won't optimize / adjust the script short term, with the exception of fixing bugs. I'm not a programmer, thus the adjusted script is made by mashing potatoes on a keyboard, it does however work (/should work xD) which is the most important thing.
I know this is completely random, but why does it say you have " -9001 " lingots?
It's not working for the course and profile pages for me, but it'll still be faster than manual switching. Thanks !
Edit3: fixed a new bug that caused errors as a result of fixing the previous bug xD. Everything should work perfectly now - hopefully :P. Can you confirm it's all working perfectly now for you?
Edit2: Should be fixed!
Edit: did a semi-fix, preventing it from storing the "undefined" errors, but not fully fixing it. It might essentially fix it for everybody though.
I see, it says "undefined" for the 2nd menu of the original language, right?
That goes away when you switch back to that "from" language and then won't return.
I̶ ̶d̶o̶ ̶n̶o̶t̶ ̶k̶n̶o̶w̶ ̶h̶o̶w̶ ̶t̶o̶ ̶f̶i̶x̶ ̶i̶t̶ ̶a̶s̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶u̶n̶d̶e̶r̶s̶t̶a̶n̶d̶ ̶t̶h̶e̶ ̶c̶a̶u̶s̶e̶ ̶y̶e̶t̶.̶
Oh damn. Does it give any error in the console?
Is it the first time you install a course switching script? I noticed it failing sometimes for new users (who didn't have an old version of the script installed - it takes over old saves of the old script when available) but I thought I fixed it, apparently not :P.
Nope, I've been using the old version for quite some time.
It doesn't say "undefined" or anything, it just doesn't work. It shows the regular menu displaying the languages I'm learning fom English.
Thanks! This one's better than the other ones out right now - I don't have to refresh the page a few times for it to load correctly. :D
One thing you should probably fix is the flags - lots of people (including me) use the flags to quickly tell which language to click on. This seems to only be a problem on pages that use the new version of the site - the flags are correct on the Discussion page, for example.
EDIT: So I did a bit of playing around with inspect element and I think I know what's wrong here. I'm assuming you're getting the flags from this. If the user's course is in the top row (French, Spanish, German, Portuguese, Italian, English, Irish, Hungarian, Russian, Polish), the flag will display correctly. If it is in the next row, the flag will be shifted to the flag directly above it. For example, a Turkish flag will become the German ribbon, and a Japanese flag will become an Italian ribbon. If the flag is in the third row, it will be shifted to the flag two flags above it - Hindi becomes Romanian, Swedish becomes Japanese, etc. If the flag is in the fourth row, it will be shifted up three flags, and if it is in the fifth row, it will be shifted up four flags.
So it looks like a counting error of sorts that can probably be fixed pretty easily. :)
There's another script that works like the old one, on every major browser: https://github.com/zeta12ti/DuolingoCourseSwitcher
elvper, Thank you a thousand or 9000 times for this script! I gave you a lingot so you'll have -9000 in your store account. Muita obrigada!
Is everything working as you'd expect?
Do you like the increased size of the flags? (the main page on the new website only - not on the forum and words tabs)
I think I might add an option on top of the script later to adjust the sizing of the flags a bit (even bigger or smaller), same for the text.
I just switch the "from" language to Spanish, and is still not working. (in the home page, new site)
However the old script in the discussion (old site) page still works perfectly.
Edit: I am using Chrome
Yes, I tried again with all scripts disabled, including the styles. Same result.:
Uncaught TypeError: Cannot read property 'fromLanguage' of undefined at updateCourses (eval at E_c (:3:221), <anonymous>:121:50) at HTMLDivElement.mouseenter (eval at E_c (:3:221), <anonymous>:183:17) at HTMLDivElement.handle (eval at E_c (:3:221), <anonymous>:8:69) at HTMLDocument.dispatch (eval at E_c (:3:221), <anonymous>:7:28337) at HTMLDocument.v.handle (eval at E_c (:3:221), <anonymous>:7:25042) at HTMLDocument.t._wrapped (https://d35aaqx5ub95lt.cloudfront.net/js/vendor-dc221740.js:90:6903)
Yes, the undefined bug should automatically go away and not return after you've manually switched back to the bugged language. I thought I fixed it though, damn :P. Could potentially be caused by stored values from a previous version. For now I'm going to assume it's because of stored values from an older version as in the last few versions it doesn't do anymore what previously caused this bug to happen.
From the (2nd) picture it looks like it should. Anything wrong related to details you mention? The flags are bigger than in the older script (intentional). There should also be a blue hovering bar on the 2nd menu, which isn't visible in the picture? If missing it could potentially be because of a custom coloring script you use?
Wait! now it works!... weird, the only details are the flags
It isn't working for me either, I'm afraid (Firefox 53.0.3). When I'm on the homepage it's the same old menu it always was, and when I'm on the discussion page I get the undefined thing. I tried switching between the different courses as you suggested and now all of the base language menus are showing undefined, even the ones that weren't before. Could there be something that I'm doing wrong? I tried logging out and back in again, and restarting my browser... I can't see a version number when I install the script, but I just reinstalled it so it should be the most recent (1.0.9)
Sorry if I'm creating more work for you. I really do appreciate you taking the time to update this script - it's the one I've missed most with the new site, and the other update with all of the courses showing was just too much. So thank you for doing this. :-)