Update front.html

This commit is contained in:
Feripe-a 2022-01-02 16:32:46 +00:00 committed by GitHub
parent e6e5c91067
commit d0e8287f03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,27 +1,47 @@
{{#MakeProductionCard}}
{{#SentKanji}}
<header>{{#Tags}}<div class="tags">{{Tags}}</div>{{/Tags}}</header>
{{#Image}}<div class="images" >{{Image}}</div>{{/Image}}
<div class="jpsentence production">{{furigana:SentFurigana}}</div>
<div style="text-align: center;">{{VocabAudio}}{{SentAudio}}</div>
<script>
document.addEventListener('DOMContentLoaded', threeDots(), false);
<div class="wrap">
function threeDots() {
const sent = document.getElementsByClassName("production")[0];
if (sent) {
const hidden = sent.getElementsByTagName("b");
for (i = 0; i < hidden.length; i++) {
if (hidden[i]) {
hidden[i].style.visibility = "visible";
//hidden[i].innerText = "【{{kana:VocabFurigana}}】";
hidden[i].innerText = "【"+hidden[i].innerText.replace(/[^ぁ-んァ-ン]/g, "")+"】";
}
}
}
}
<header>{{#Tags}}<div class="tags">{{Tags}}</div>{{/Tags}}</header>
{{#Image}}<div class="images">{{Image}}</div>{{/Image}}
<div class="sent-center">
<div class="jpsentence production">{{edit:furigana:SentFurigana}}</div>
<div>{{VocabAudio}}{{SentAudio}}</div>
</div>
</div> <!-- /wrap -->
<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}}
{{/MakeProductionCard}}