[Userscript] Replace commas with semicolons

Hello everyone,

As you may know, Memrise somewhat recently made it so that multiple answers need to be separated by semicolons instead of commas.

This userscript goes through a course and, in each primary answer, changes any commas to semicolons.

Userscript
Github page (There’s currently there’s not much there)

To active the script, go to the the page where you can edit a course’s levels. Next to the “Add level” button, there should be a new button that says “Replace commas with semicolons”. Click that button and then wait several seconds for the scripts to begin.

Please note that the script replaces commas in all of the columns. This means that if you have a column that has explanatory text or example sentences or something else that has commas that you don’t want to be changed to semicolons, you may want to not run this script.

I haven’t done extensive testing with this script, so you may want to test this script on a small or not terribly important course before running it on a large course.

If the script times out, try refreshing the page and running the script again.

This script is only course course creators or course contributors. If you’d like to use this script on a course that you’re not the creator of or a contributor to, you’ll need to contact the course’s owner or ask Memrise to add you as a contributor.

4 Likes

So I tried this userscript for my course with 4 colums and 1600 words and found a few bugs.
First of all, the userscript crashes after having analysed ~1000 words, which means I still have to manually go trough the other 600. The userscript also only replaces one comma per row, which means that if you have rows with four comma’s in it, you have to run the userscript four times to replace all the comma’s.

Apart from that, many thanks for acutally writing this userscript and thanks for saving so much of my time!

Thanks for the feedback :slight_smile:

When you say “crashes”, do you mean that it just stops working, or do you get a pop up with an error message or something? Is there anything in your error console, if you know how to check that? If I can figure out what’s causing the issue, I’d probably be happy to fix it :slight_smile:

Thanks for the note about the script only replacing one comma per row; that would probably be a good thing to fix.

Anyway, glad the script was helpful :slight_smile:

I just realized what the issue might be.

Try manually expanding all of your levels (and wait for them to load) before running the script and see if that makes it so that the other ~600 items are fixed, too.

I tried running the script twice, the first time I got a bazillion error pop-upmessages and after I clicked them all away the script stopped and about 80 items were coloured red. The second time the script did about 980 items correct and then gave the message it was done and stopped working after that. It does open all levels at the beginning of the script, including the ones it did not change. Later I’ll try manually opening all levels and then running the script.

Yep, expanding all levels fixed it.
Have you already updated the script so it replaces all comma’s?
Thanks!

Great! :slight_smile:

I haven’t fixed the comma issue yet. I haven’t been able to figure out the issue just from looking at the code, so I’ll have to do some testing.

And you’re welcome :slight_smile:

You’re welcome :slight_smile: Let me know how it works.

So the way I read this, and given how it seems to be working for me now, the script only replaces one comma per column per pass. So if a column is A,B,C,D you have to run it three times to get all of them? Just want to make sure I’m not doing something wrong. THanks!

Possibly. That wasn’t my intention, so if that’s the case, it’s a bug, but from @Xander5E-XLgaming_in’s report, that may be how the scripts currently works. You may want to just run the script, reload the page, expand all of the levels, and do a Ctrl + F to see if there are any commas remaining.

Hello everyone,

I’ve updated the script. It should now start when the levels are loaded, instead of just after 10 seconds. I also redid some of the code.

I just tested, and it looks like, indeed, some of the commas are not being replaced when there are rows that have commas in multiple columns, so you may need to run the script more than once in order to replace all of the commas. (Tagging @wisco)

@neoncube

This seems to be the case.

Thanks for confirming. Did running it multiple times work?

@neoncube
Running it multiple times seems to work but the order in which it replaces the commas is a little bit random(4-2-3-1-5). But it works!

1 Like

Ya, it’s kind of strange :\ Well, anyway, I’m glad it worked :slight_smile:

Hey guys, a couple of updates :slight_smile:

If there are multiple columns in a row that have commas, they should all be updated in one pass now.

Also, commas that are in parentheses are no longer replaced, as I think this is better. So, for example, if you have the definition “Spring (U.S.), Autumn (U.K., former British colonies)”, then the script now updates this to be “Spring (U.S.); Autumn (U.K., former British colonies)” (The comma between “U.K.” and “former British colonies” isn’t changed).

On some courses, the script should also run faster now and be less taxing on Memrise’s servers :slight_smile:

I also realized that the script doesn’t update columns that are marked as attributes, which I think is good, so I’ve left it that way.

If you’re interested in updating the script, I think you should be able to do so through your userscript plugin, or you could try downloading the script again.

2 Likes

I’ve updated this script to try to make it compatible with the change from http:// to https://

However, I think that userscripts are currently broken on my browser, so I haven’t been able to test this change. If anyone can confirm that it works, that would be great, or if you can confirm that it doesn’t work, that would be good to know, too :slight_smile:

I’ve changed the name of the file so that it should be easier to install using Greasemonkey/Tampermonkey/etc. If you’d like to update your installation, just follow the link to the script that’s in the original post.

This script should now work in Firefox using Greasemonkey as well as in Chromium-based browsers using Tampermonkey.

This has been updated to fix an issue where the script wasn’t working anymore.

1 Like