Closed daminpark closed 1 week ago
Which device are you using? Does it occur on both desktop and mobile? Randomization of the example sentences is a bit tricky, since front and back sides have to be synced, which is achieved with a neat little script called anki-persistence.
To auto-play sentences, add this line at the end of the initAudioButtons
function:
async function initAudioButtons(within = document) {
...
document.querySelector('.play-sentence').click();
}
To disable spoilers, adjust the refreshExampleSentences
function, removing the spoiler
class:
function refreshExampleSentences() {
...
sentencesInner.innerHTML = frenchFirst
? `<div class="fr">${fr}</div><span class="de">${de}</span>`
: `<div class="de">${de}</div><span class="fr">${fr}</span>`;
...
}
Ah thanks so much! That fixed everything. I actually customised the Front card of the deck which is why I think it started messing up with regards to the randomisation. I've reverted it back and it's working perfectly. One tiny niggle is that the sentence plays immediately, i.e. not waiting for the audio of the word to finish. Is there an easy fix to that? Or even just a 3 second delay would work I think.
Am 28.09.2024 um 15:20 schrieb Jacob Zhang @.***>:
Which device are you using? Does it occur on both desktop and mobile? Randomization of the example sentences is a bit tricky, since front and back sides have to be synced, which is achieved with a neat little script called anki-persistence https://github.com/SimonLammer/anki-persistence.
To auto-play sentences, add this line at the end of the initAudioButtons function:
async function initAudioButtons(within = document) { ... document.querySelector('.play-sentence').click(); } To disable spoilers, adjust the refreshExampleSentences function, removing the spoiler class:
function refreshExampleSentences() { ... sentencesInner.innerHTML = frenchFirst ?
<div class="fr">${fr}</div><span class="de">${de}</span>
:<div class="de">${de}</div><span class="fr">${fr}</span>
; ... } — Reply to this email directly, view it on GitHub https://github.com/jacbz/anki_french/issues/21#issuecomment-2380607126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUECJ3OAILKSBBLHUW5OG7DZY2GGDAVCNFSM6AAAAABO6QGCAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBQGYYDOMJSGY. You are receiving this because you authored the thread.
Sure, instead of document.querySelector('.play-sentence').click();
you can do:
setTimeout(() => {
document.querySelector('.play-sentence').click();
}, 3000);
I've just released an update that adds easily accessible configuration options. Now you can simply set autoPlaySentence
to true
and hideSpoilers
to false
at the top.
Let me know if you have more customization suggestions!
Hi, really loving your deck, thank you so much. One problem I've been having, and I don't think it's always been the case, but recently all the example sentences have been the same and not randomized. Do you know why this might be?
I was also wondering if there was a way to auto-play the sentences in French and unhide the translation of the example sentence. I tried looking at the code but I was pretty confused.