Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing same example sentence over again #21

Closed
daminpark opened this issue Sep 27, 2024 · 8 comments
Closed

Showing same example sentence over again #21

daminpark opened this issue Sep 27, 2024 · 8 comments

Comments

@daminpark
Copy link

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.

@jacbz
Copy link
Owner

jacbz commented Sep 28, 2024

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>`;
  ...
}

@daminpark
Copy link
Author

daminpark commented Sep 28, 2024 via email

@jacbz
Copy link
Owner

jacbz commented Sep 28, 2024

Sure, instead of document.querySelector('.play-sentence').click(); you can do:

setTimeout(() => {
  document.querySelector('.play-sentence').click();
}, 3000);

@jacbz
Copy link
Owner

jacbz commented Sep 28, 2024

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!

@jacbz jacbz closed this as completed Sep 28, 2024
@daminpark
Copy link
Author

daminpark commented Oct 12, 2024 via email

@jacbz
Copy link
Owner

jacbz commented Oct 12, 2024

Can you provide an example?

@daminpark
Copy link
Author

daminpark commented Oct 12, 2024 via email

@jacbz
Copy link
Owner

jacbz commented Oct 12, 2024

Thanks for the report. I've been working to improve the sentence system. The new version, which may take some months to complete, will feature 100.000+ improved sentences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants