I’m preparing a language deck which contains a hint button in the front card. It shows the first letter of the answer in case I don’t remember instantly.
So, I was wondering if there was any way to assign some shortcut keys for this button. (I’m also thinking how can I solve the problem of needing to click on somewhere on the flashcard first and then press the shortcut).
Can someone kindly help me? You can find the code of the buttons here:
Ah sorry, i should have made this clearer. You have to replace it in code, the text after // is a comment.
For Ctrl + h you would have to do write this:
<script>
document.addEventListener('keyup', function (event) {
if (event.key == "h" && event.ctrlKey){ // <- notice the values changing
document.querySelector("button").click()
}
})
</script>
I couldn’t replicate the problem on my computer (I’m running linux), even when using webkit (same web engine as safari).
It’s possible that macos is the reason, maybe a different app is capturing the keyboard shortcut or the implementation of the web renderer used to display the flashcard is slightly different on mac, but someone with an apple computer would have to check it.