TheDabblingDuck / ankimote

Ankimote is an addon that adds remote control functionality to Anki flashcards
MIT License
25 stars 4 forks source link

Custom Command for Reveal Next Button (IO-one-by-one) #46

Closed VelmontBlack closed 1 year ago

VelmontBlack commented 1 year ago

Is it possible to add a custom command for the Reveal Next button on Anking's IO-one-by-one cards?

Here's the link to the Note type: https://github.com/AnKing-Memberships/AnKing-Note-Types/releases/tag/IO-one_by_one-3ff1197

This is what I could find about the button on the card template: button id="button-reveal-next" class="button-general">Reveal Next. /button>

I don't know much about coding but is it possible?

chliver commented 1 year ago

Hi @VelmontBlack, I had this issue a few days ago and recently resolved it for the cloze deletion one-by-one cards. In the Ankimote add-on's configuration page, you can change one of your five custom command slots to run JavaScript. I added the following text to my configuration page as my first slot:

"cmd1": "mw.web.eval( \"document.getElementById('button-reveal-next').onclick();\" )", "cmd1-label": "Reveal",

This lets you use the reveal next button on the cloze deletion one-by-one cards. I pulled the card's code using the AnkiWebView Inspector add-on to find the code and test its JavaScript command, as recommended by the instructions given by @TheDabblingDuck on the add-on's configuration page.

Hope this helps you find a way to add a reveal button for your image occlusion one-by-one cards!

VelmontBlack commented 1 year ago

hey thanks for replying! It took me a while, but I found it!

"cmd2": "mw.web.eval( \"toggleNext()\" )", "cmd2-label": "Reveal IO One-by-One",

this one finally did the trick! Can't believe it was this simple tho😆