View hints One by One on iPhone

Hello!

There are multiple posts about seeing hints on your iPhone, but from what I’ve seen, they show all hints at once. I had chat GPT make a script so that it only shows hints one at a time. It worked for me, so I thought I’d put it here for others to find. On the computer version go to Browse>Card Types>Back template and paste it at the bottom.

<script>
    /* User Action: Reveal hints one by one */
    let currentHintIndex = 0;

    function revealNextHint() {
        const hints = document.querySelectorAll("a.hint");
        if (currentHintIndex < hints.length) {
            const hintLink = hints[currentHintIndex];
            const hint = hintLink.nextElementSibling;

            hintLink.style.display = "none"; // Hide the link
            hint.style.display = "block"; // Show the hint

            currentHintIndex++; // Move to the next hint
        }
    };

    /* Reset the hint index when the card is shown again */
    function resetHintIndex() {
        currentHintIndex = 0;
    }

    /* User action */
    var userJs1 = revealNextHint;

    /* Hotkey */
    if (!globalThis.revealNextHintHotkeyRegistered) {
        document.addEventListener("keydown", (event) => {
            if (event.code === "KeyH") {
                revealNextHint();
            }
        });
        globalThis.revealNextHintHotkeyRegistered = true;

        /* Reset hint index when showing a new card */
        document.addEventListener("DOMContentLoaded", resetHintIndex);
    }
</script>