Option to Have Auto Advance on by Default

Hi all,

Thanks for all your work on the app. Ever since Auto Advance was built into the desktop app I’ve been using it every day and find it an invaluable addition to Anki.

It would be nice, however, if there was some kind of toggle to have Auto Advance on by default. It’s not a huge deal, but it’s a little tedious having to turn Auto Advance every time you open a deck, or come back to Anki after using a different application. Alternatively, having Anki remember your last selection might be a good option.

I did find a similar post by @RiceInRicin from a few months ago (“(AnkiMobile) Option to have Auto Advance Enabled by default”), however, their post was about AnkiMobile rather than the desktop app, so I thought I would add my voice in support of adding this feature to the desktop app.

Thanks again!

1 Like

[Adding link for reference: (AnkiMobile) Option to have Auto Advance Enabled by default]

5 Likes

Would also like to see this. It’s the only thing stopping me from replacing the Speed Focus addon with the official auto advance feature. Needing to enable auto advance every time is quite an annoyance.

1 Like

I was thinking the same, if it is not planned to be officially incorporated I think I will develop an add-on. For now I have only developed a function to auto stop Auto Advance. (because I want to auto-stop when review is interrupted by my add-on)

This can be done using a card template.

A script that runs the function after a specified time has elapsed.

Summary
<script>
	function createTimer(delay) {
		setTimeout(function() {
		nameFunction();
		}, delay);
	}

	createTimer(20000);

</script>

A script showing the answer.

Summary
<script>
  try {
    // AnkiDroid
    showAnswer();
  } catch {
    // Desktop
    pycmd("ans");
  }
</script>

A function for responding to a card.

Summary
<script>

  function rateAnswer(rating) {

    pycmd('ease ' + rating);
  }
</script>

An alternative taken from here
https://ankiweb.net/shared/info/510199145

Summary
<script>
 //determine platform
 platform = '';
 if (!document.documentElement.classList.contains("mobile")) {
	 platform = 'desk';
 } else if (document.documentElement.classList.contains("android")) {
	 //var jsApiContract = { version: "0.0.3", developer: "eltaurus@inbox.lt" };
	 //var api = new AnkiDroidJS(jsApiContract);
	 platform = 'android';
}
</script>

<script>




function answerAgain() {

		if (platform === 'desk') {
			pycmd('ease1');
		} else if (platform === 'android') {
			buttonAnswerEase1();
		}
}
function answerHard() {

		if (platform === 'desk') {
			pycmd('ease2');
		} else if (platform === 'android') {
			buttonAnswerEase2();
		}
}

function answerGood() {

		if (platform === 'desk') {
			pycmd('ease3');
		} else if (platform === 'android') {
			buttonAnswerEase3();
		}
}

function answerEasy() {

		if (platform === 'desk') {
			pycmd('ease4');
		} else if (platform === 'android') {
			buttonAnswerEase4();
		}
}
1 Like

I have not tested this solution.

To summarize all of the above

Front

<script>
	function createTimer(delay) {
		setTimeout(function() {
		try {
			// AnkiDroid
			showAnswer();
		} catch {
			// Desktop
			pycmd("ans");
		}

		}, delay);
	}

	createTimer(20000); // 20 seconds

</script>

Back

<script>
	function createTimer(delay) {
		setTimeout(function() {
		try {
			// AnkiDroid
			buttonAnswerEase1();
		} catch {
			// Desktop
			pycmd('ease1');
		}

		}, delay);
	}

	createTimer(20000); // 20 seconds

</script>

Substitute your value instead of 20000 (20 seconds).

Again:
buttonAnswerEase1();
pycmd(‘ease1’);

Hard:
buttonAnswerEase2();
pycmd(‘ease2’);

Good:
buttonAnswerEase3();
pycmd(‘ease3’);
Easy:
buttonAnswerEase4();
pycmd(‘ease4’);

1 Like

If your cards have auto-playing audio, then the javascript auto-advance will cut off currently playing audio when the timer finishes.

You’d need to turn off audio auto-play in the deck options and instead implement audio auto-play in javascript so that the auto-advance javascript would have access to the audio playing state and be able to wait for audio playing to end before advancing.

The code in this post could be a helpful starting point: Is it possible to load audio dynamically with JavaScript? - #10 by srghma

3 Likes

I didn’t plan on going that far.
Will not be friends with {{FrontSide}}.

<script>
;(async function() {
	// AnkiMobile && AnkiDroid / Anki 2.1
	const elements = Array.from(document.querySelectorAll(".soundLink, .replacebutton"))
	const wait = t => new Promise(s => setTimeout(s, t))
	let index = 0
	for (let index = 0; index < elements.length; index++) {
	
		const element = elements[index]
		element.click()
		await wait(2500)
	} 
	
		await wait(10000)
		try {
			// AnkiDroid
			showAnswer()
		} catch {
			// Desktop
			pycmd("ans")
		}
})();
</script>