Created
February 23, 2014 12:03
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated version that works in the Review and Study sections of kanji.koohii.com is here: https://gist.github.com/shussekaido/3541ab70e37983f0360d