// Uses the experimental jisho.org API to see if the kanji has any hits in
// JMDict
// Doc: https://jisho.org/forum/54fefc1f6e73340b1f160000-is-there-any-kind-of-search-api
// Example: https://jisho.org/api/v1/search/words?keyword=house
function setup() {
// If we're not reading an article, do nothing
if (!(mw.config.get( 'wgAction' ) === 'view'
&& mw.config.get( 'wgIsArticle' )
&& !location.search.split('oldid=')[1]
&& !mw.config.get("wgIsMainPage")
&& mw.config.get('wgNamespaceNumber') === 0)) {
return;
}
var target = document.querySelector("#firstHeading");
var observer = new MutationObserver(function(mutationsList) {
for (var mutation of mutationsList) {
if (mutation.target.id == "kanjiInfo") {
observer.disconnect();
$("#kanjiInfo").addClass("kanjiInfo-neutral");
getDefinition();
}
}
});
observer.observe(target, {childList: true, subtree: true});
}
function getDefinition() {
}
$(setup);