Skip to content

Instantly share code, notes, and snippets.

@shussekaido
Created February 23, 2014 12:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shussekaido/9170498 to your computer and use it in GitHub Desktop.
Save shussekaido/9170498 to your computer and use it in GitHub Desktop.
Adds Kanji Stroke Order to the Review section of kanji.koohii.com. Tested in Chrome with Tampermonkey.
// ==UserScript==
// @name Kanji.koohii Stroke Order - Review section
// @namespace koohiireview
// @description Adds Kanjis Stroke Order to the Review section
// @include http://kanji.koohii.com/review*
// @include https://kanji.koohii.com/review*
// @version 1.0
// ==/UserScript==
var target = document.querySelector('#uiFcMain');
var stroke_container = ".k-sod";
var inject_container = document.createElement("div");
document.querySelector("#rd-side").appendChild(inject_container);
var observer = new MutationObserver(function(mutations) {
if (target.classList.contains("uiFcState-1")) {
GM_xmlhttpRequest({
method: "GET",
url: "http://www.ig.gmodules.com/gadgets/proxy/refresh=31556926&container=ig/http://tangorin.com/kanji/"+document.querySelector("#kanjibig>p>span").textContent,
onload: function(response) {
var responseHTML = new DOMParser().parseFromString(response.responseText, "text/html");
inject_container.innerHTML = "<br />" + responseHTML.documentElement.querySelector(stroke_container).innerHTML;
}
});
} else {
inject_container.innerHTML = "";
};
});
var config = { attributes: true };
observer.observe(target, config);
@shussekaido
Copy link
Author

Updated version that works in the Review and Study sections of kanji.koohii.com is here: https://gist.github.com/shussekaido/3541ab70e37983f0360d

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