51 lines
1.5 KiB
HTML
Raw Normal View History

2024-05-16 01:36:03 +08:00
<div class="hide-style">
2024-09-16 12:12:09 +08:00
<div id="audio">{{audio_for_word}}</div>
<div id="audio_sentence">{{audio_for_example_sentence}}</div>
2024-05-16 01:36:03 +08:00
</div>
2024-05-16 23:16:24 +08:00
<div class="centerdiv" onclick='playAudio("audio")'>
<div class="ruby-div" id="word">{{ word }}</div>
2024-09-16 12:12:09 +08:00
<div id="rubyword" class="ruby-div">{{ rubytextHtml }}</div>
2024-05-15 15:57:45 +08:00
</div>
<script>
2024-09-16 12:12:09 +08:00
if (document.getElementById('rubyword').innerHTML.trim().length > 0) {
2024-05-16 23:16:24 +08:00
document.getElementById('word').classList.add("hide-style");
2024-05-16 14:14:44 +08:00
}
else {
2024-05-16 23:16:24 +08:00
document.getElementById('rubyword').classList.add("hide-style");
2024-05-15 15:57:45 +08:00
}
</script>
2024-05-25 01:37:53 +08:00
<div id="example_sentence" class="example-div" onclick='playAudio("audio_sentence")'>
2024-05-15 15:57:45 +08:00
{{example_sentence}}
</div>
<div id="image" class="centerdiv">
2024-09-16 12:12:09 +08:00
{{screenshot}}
2024-05-15 15:57:45 +08:00
</div>
<script>
2024-05-16 01:36:03 +08:00
function playAudio(audioId) {
2024-06-02 22:45:40 +08:00
var audioDiv = document.getElementById(audioId);
var audio = audioDiv.getElementsByTagName('*');
2024-05-16 01:36:03 +08:00
if (audio.length > 0) {
audio[0].click();
}
}
2024-05-15 15:57:45 +08:00
function checkhide(eid) {
2024-06-02 22:45:40 +08:00
var emptyDiv = document.getElementById(eid);
2024-05-15 15:57:45 +08:00
if (emptyDiv && emptyDiv.innerText.trim() === "") {
emptyDiv.classList.add("hide-style");
}
}
function checkhide2(eid) {
2024-06-02 22:45:40 +08:00
var emptyDiv = document.getElementById(eid);
2024-05-15 15:57:45 +08:00
if (emptyDiv && emptyDiv.children.length == 0) {
emptyDiv.classList.add("hide-style");
}
}
checkhide("example_sentence")
checkhide2("image")
checkhide("remarks")
2024-06-02 22:45:40 +08:00
</script>