Hello everyone, have a nice day!
I have some js codes to get the audio tag and play it, however, it works only on the first card, and the next cards always play the same audio from the first card.
I searched and knew that Anki desktop will keep a single web view and thus my js codes only run the first time. How can I force my js codes to rerun each time for a new card?
My code likes:
Hi abdo, thanks for your reply.
I forget to mention that my deck is created by other people, and there remains a long js code in the same tag after my code pasted before.
Today I tried to delete the long js code, and my audio play js can be executed once every card.
I don’t know why my js is not executed when there exists other js codes. Is there a workaround I can keep both of the two js?
I just want to make sure, do you hearing that the audio automatically plays in a loop for Card 3 type?
and there is a console.log('------- d1.0'); in my js, does it print once for each card?
You remind me that maybe I should upgrade my Anki desktop version, and currently it is:
Hmm, the audio plays in a loop but the text is only printed once. It’s caused by something in the existing code apparently but it’s hard to debug since it’s minified/obfuscated.
Hi @abdo, I find a workaround: using <script defer> ....</script> to enclose my js, and then these js codes will be executed every card.
Thanks again and have a nice day!