AnkiNoteTemplate/templates/Japanese sentences/Production/front.html

47 lines
1.3 KiB
HTML
Raw Normal View History

2021-11-27 14:58:45 +00:00
{{#MakeProductionCard}}
{{#SentKanji}}
2021-11-28 08:44:26 +00:00
<div class="wrap">
2021-11-27 14:58:45 +00:00
<header>{{#Tags}}<div class="tags">{{Tags}}</div>{{/Tags}}</header>
{{#Image}}<div class="images">{{Image}}</div>{{/Image}}
<div class="jpsentence production">{{edit:furigana:SentFurigana}}</div>
<div style="text-align: center;">{{VocabAudio}}{{SentAudio}}</div>
2021-11-28 08:44:26 +00:00
</div> <!-- /wrap -->
2021-11-27 14:58:45 +00:00
<script>
function threeDots() {
const sent = document.getElementsByClassName("production")[0];
if (sent) {
for (const hidden of sent.getElementsByTagName("b")) {
hidden.style.visibility = "visible";
hidden.innerText = "【" + hidden.innerText.replace(/[^ぁ-んァ-ン]/g, "") + "】";
}
}
}
/* Splits tags into separate divs */
function splitTagDiv() {
const header = document.querySelector("header");
if (!header) return;
const split = `{{MorphManFocus}} {{Tags}}`.split(' ');
header.innerHTML = "";
for (const tag of split) {
if (tag.length < 1)
continue;
const tag_elem = document.createElement("div");
tag_elem.className = "tags";
tag_elem.innerHTML = tag;
header.appendChild(tag_elem);
}
}
threeDots()
splitTagDiv()
</script>
{{/SentKanji}}
{{/MakeProductionCard}}