diff --git a/templates/Japanese sentences/Recognition/front.html b/templates/Japanese sentences/Recognition/front.html index da298e7..1028c6e 100644 --- a/templates/Japanese sentences/Recognition/front.html +++ b/templates/Japanese sentences/Recognition/front.html @@ -30,7 +30,7 @@ Wed Feb 7 08:30:09 PM UTC 2024 {{/Image}} -
+
{{VocabKanji}}
{{VocabPitchNum}}
{{kana:VocabFurigana}}
@@ -82,16 +82,16 @@ Wed Feb 7 08:30:09 PM UTC 2024 function odaka(pitch_num) { // word is odaka if number of moras is equal to pitch accent position - const moras = document.getElementById("kanaword_hidden").innerText - .replace(/[((<].*[>))]/, "") // remove (お), (する), <する>, <な>, etc + const moras = document + .getElementById("kanaword_hidden") + .innerText.replace(/[((<].*[>))]/, "") // remove (お), (する), <する>, <な>, etc .replace(/[ャュョゃゅょ]/g, "") // small っ is one mora; ゃゅょ are parts of single mora .trim(); // first determine if な is part of pronunciation or な-adjective (e.g. 女) - const vocab_kanji = document.getElementById("vocab_kanji_hidden") - .innerText - .trim(); - const n_moras = (/な$/.test(vocab_kanji)) ? moras.replace(/な$/, "").length : moras.length; - return (n_moras == pitch_num); + const vocab_kanji = document.getElementById("vocab_kanji_hidden").innerText.trim(); + // な-adjectives don't change pitch + const n_moras = /な$/.test(vocab_kanji) ? moras.replace(/な$/, "").length : moras.length; + return n_moras == pitch_num; } /* Splits tags into separate divs */ @@ -99,7 +99,7 @@ Wed Feb 7 08:30:09 PM UTC 2024 const header = document.querySelector("header"); if (!header) return; const split = `{{Focus}} {{Tags}}`.split(" "); - const dont_show = ['imageonfront', 'tolearn', 'marked',]; + const dont_show = ["imageonfront", "tolearn", "marked"]; header.innerHTML = ""; @@ -114,28 +114,31 @@ Wed Feb 7 08:30:09 PM UTC 2024 function formatNewRuby(kanji, readings) { if (readings.length > 1) { - return `${formatNewRuby(kanji, readings.slice(0, -1))}${readings.slice(-1)}` + return `${formatNewRuby(kanji, readings.slice(0, -1))}${readings.slice(-1)}`; } else { - return `${kanji}${readings.join('')}` + return `${kanji}${readings.join("")}`; } } function reformatMultiFurigana() { const separators = /[\s;,.、・。]+/iu; const max_inline = 2; - document.querySelectorAll("ruby:not(ruby ruby)").forEach(ruby => { + document.querySelectorAll("ruby:not(ruby ruby)").forEach((ruby) => { try { const kanji = (ruby.querySelector("rb") || ruby.firstChild).textContent.trim(); - const readings = ruby.querySelector("rt").textContent - .split(separators) - .map(str => str.trim()) - .filter(str => str.length); + const readings = ruby + .querySelector("rt") + .textContent.split(separators) + .map((str) => str.trim()) + .filter((str) => str.length); if (readings.length > 1) { ruby.innerHTML = formatNewRuby(kanji, readings.slice(0, max_inline)); } if (readings.length > max_inline) { - const sequence = readings.map(reading => `${reading}`).join(''); + const sequence = readings + .map((reading) => `${reading}`) + .join(""); const wrapper = document.createElement("span"); wrapper.classList.add("tooltip"); wrapper.innerHTML += `${sequence}`; @@ -145,7 +148,7 @@ Wed Feb 7 08:30:09 PM UTC 2024 } catch (error) { console.error(error); } - }) + }); } function isMobile() {