Skip to content

Instantly share code, notes, and snippets.

@salif
Last active February 11, 2024 16:59
Show Gist options
  • Save salif/87d3dd91da85613b3c8e19d228b4c41c to your computer and use it in GitHub Desktop.
Save salif/87d3dd91da85613b3c8e19d228b4c41c to your computer and use it in GitHub Desktop.
Memrise - Sort courses by length / amount of words

Memrise - Sort courses by length / amount of words

  • Go to app.memrise.com/community/courses
  • Open Developer tools and go to the Console tab
  • Copy the code from script.js from this gist, then paste it into the console and hit enter
  • Done!
const asc = false
function g(x) {
const d = x.querySelector('.stats > :nth-child(2)').childNodes[2].nodeValue.trim()
const l = d.indexOf('h')
const m = d.indexOf('m')
if (l > -1) {
return [x, d, parseInt(d.substring(0, l)) * 60]
} else if (m > -1) {
return [x, d, parseInt(d.substring(0, m))]
} else {
return [x, d, 0]
}
}
const b = document.querySelector('div[data-role="infinite-scrolling-content"]')
const a = Array.from(b.children).map(e=>g(e))
a.sort(function(f, s) {
return asc ? f[2] - s[2] : s[2] - f[2]
})
a.forEach(e=>{
b.insertBefore(e[0], null)
})
@salif
Copy link
Author

salif commented Aug 20, 2022

For full experience you may need to load all courses before pasting the code (by scrolling to the end of the courses page)

@salif
Copy link
Author

salif commented Aug 20, 2022

For ascending sort change asc = false to asc = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment