diff options
Diffstat (limited to 'anki-card-template/card.js')
-rw-r--r-- | anki-card-template/card.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/anki-card-template/card.js b/anki-card-template/card.js index 193e7fe..a98e2fe 100644 --- a/anki-card-template/card.js +++ b/anki-card-template/card.js @@ -419,14 +419,17 @@ function run() { document.getElementById("sentence-translation").classList.add("visible"); } - // replace ugly anki play icon with material design icon - for (var el of document.querySelectorAll("#audio .replay-button")) { - el.innerHTML = document.getElementById("play-icon").outerHTML; - el.children[0].classList.remove("display-none"); - } var audio = document.getElementById("audio"); - if (audio.innerText.trim() == "noaudio") audio.classList.add("display-none"); + if (audio != null && audio.innerHTML == "noaudio") { + audio.classList.add("display-none"); + } else { + // replace ugly anki play icon with material design icon + for (var el of document.querySelectorAll("#audio .replay-button")) { + el.innerHTML = document.getElementById("play-icon").outerHTML; + el.children[0].classList.remove("display-none"); + } + } layout(); } |