| // ==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); |
Updated version that works in the Review and Study sections of kanji.koohii.com is here: https://gist.github.com/shussekaido/3541ab70e37983f0360d