User:Opencooper/showKanji-dev.js: Difference between revisions

Content deleted Content added
reuse our regexes
add check for kanji when we're getting reading from wikidata
Line 213:
function parseKanaClaim(response) {
var kana;
if (response.claims.P1814)P1476 {&& response.claims.P1476 == wikidataKanji
} else if (response.claims.P1476 && response.claims.P1476[0].qualifiers
// name in kana
kana = response.claims.P1814[0].mainsnak.datavalue.value;
} else if (response.claims.P1476 && response.claims.P1476[0].qualifiers
&& response.claims.P1476[0].qualifiers.P1814) {
// title w/ name in kana
kana = response.claims.P1476[0].qualifiers.P1814[0].datavalue.value;
} else if (response.claims.P1705 && response.claims.P1705[0].qualifiers == wikidataKanji
&& response.claims.P1705[0].qualifiers
&& response.claims.P1705[0].qualifiers.P1814) {
// native label w/ name in kana
kana = response.claims.P1705[0].qualifiers.P1814[0].datavalue.value;
} else if (response.claims.P1814) {
// name in kana
kana = response.claims.P1814[0].mainsnak.datavalue.value;
} else {
getInterlanguage();