Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Swaps memrise.com course question display font with KanjiStrokeOrders in "Kanji" courses. You must have font installed on your PC. Get it here: http://www.nihilist.org.uk/KanjiStrokeOrders_v4.001.zip
// ==UserScript==
// @name Memrise Kanji Stroke Order
// @description Swaps display font with KanjiStrokeOrders in "Kanji" courses. You must have font installed on your PC. Get it here: http://www.nihilist.org.uk/KanjiStrokeOrders_v4.001.zip
// @match https://www.memrise.com/course/*/garden/*
// @match https://www.memrise.com/garden/water/*
// @match https://www.memrise.com/garden/review/*
// @version 0.1.4
// @grant none
// @namespace https://gist.github.com/AntonioRigo/946277922b7cea14b66e4ef7e566b924
// @updateURL https://gist.github.com/AntonioRigo/946277922b7cea14b66e4ef7e566b924/raw/0cc22845157cb184bb4191b2400dc0f8fa27e4f4/memrise-kanji-stroke-order.user.js
// @downloadURL https://gist.github.com/AntonioRigo/946277922b7cea14b66e4ef7e566b924/raw/0cc22845157cb184bb4191b2400dc0f8fa27e4f4/memrise-kanji-stroke-order.user.js
// ==/UserScript==
var onLoad = function($) {
function wait(){
if (MEMRISE.garden.session){
if (MEMRISE.garden.session.category.name === 'Kanji') {
addGlobalStyle('.primary .primary-value { font-family: KanjiStrokeOrders !important; font-size: 1.5em; font-weight: normal !important; }');
addGlobalStyle('@import url(//fonts.googleapis.com/earlyaccess/notosansjapanese.css);');
addGlobalStyle('.garden-box .shiny-box .val, .qquestion, .secondary .primary-value { font-family: "Noto Sans Japanese", sans-serif !important; font-weight: 200; top: -2px; position: relative; }');
}
} else {
setTimeout(wait,100);
}
}
wait();
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
};
var injectWithJQ = function(f) {
var script = document.createElement('script');
script.textContent = '$(' + f.toString() + '($));';
document.body.appendChild(script);
};
injectWithJQ(onLoad);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.