When reviewing a category, I want to change the title from ‘Russian’ (category) to the course name from which the current word comes from. I thought of using the unofficial API but it doesn’t work anymore.
GET http://www.memrise.com/api/course/get/?course_id=12350
For now, I have to enter the names manually (map id to name):
// ==UserScript==
// @name Memrise - Course Names
// @namespace http://tampermonkey.net/
// @match https://app.memrise.com/garden/review/russian/
// @match https://www.memrise.com/course/*/garden/*
// @match https://app.memrise.com/course/*
// ==/UserScript==
let map = {
173195: 'Top 10,000 Words Part 1',
337724: 'Top 10,000 Words Part 2',
872951: 'Duolingo Russian',
5765137: 'Russian Random Vocabulary'
};
$(document).ready(function() {
MEMRISE.garden._events.started.push(() => {
if(MEMRISE.garden.session.course !== undefined && map[course_id()] === undefined){
//Log name and id to add it to the map
console.warn(MEMRISE.garden.session.course_id + ': \'' + MEMRISE.garden.session.course.name + '\'');
}
})
MEMRISE.garden._events.activate.push(() => {
if(MEMRISE.garden.session.course === undefined){
//If .course is undefined, that means we are in a category
title(course_name());
}
})
})
function title(str){
MEMRISE.garden.$sessionTitle.text(str);
}
function course_id(){
return MEMRISE.garden.session_data.learnables_to_courses[MEMRISE.garden.box.learnable.learnable_id];
}
function course_name(){
return map[course_id()] || 'Russian';
}
I only found how to get the id of the course, but I didn’t find where the map from id to “course data” is.