Content deleted Content added
Opencooper (talk | contribs) tweak |
Opencooper (talk | contribs) update Wiktionary parsing |
||
Line 4:
// TODO: Reject if any base/reading has too low/high of a ratio.
// TODO: <rb> is not actually in the whatcg standard...
// License: CC0
Line 378 ⟶ 379:
var html = response.parse.text["*"];
var parsed = $($.parseHTML(html));
var headword = parsed.find(".headword:lang(ja) ruby").first();
headword.children("rp").remove();
if (headword.text() != wikidataKanji) { return; }
▲ // Wiktionary tags its readings with the "form-of" class
▲ var kana = headword.siblings(".Jpan.form-of:lang(ja)").first().text();
if (kana) {▼
▲ if (kana) {
displayKana(kana);
$("#kanjiInfo").addClass("kanjiInfo-wiktionary");
// Extra stuff just for fun
var definition = headword.parent().parent().siblings("ol").children("li").first().text();
$("#kanjiInfo").prop("title", definition);
}
|