Skip to content

Instantly share code, notes, and snippets.

@kelciour
Created December 24, 2018 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelciour/b7fed69972144d0c55861d85bf040f94 to your computer and use it in GitHub Desktop.
Save kelciour/b7fed69972144d0c55861d85bf040f94 to your computer and use it in GitHub Desktop.
<script>
if (typeof(py) == "object") { // AnkiDesktop
var audioRe = /\[sound\:([^\]]+)\]/;
var audioResults = audioRe.exec(document.body.innerHTML);
if (audioResults != null) {
var audioSrc = audioResults[1];
py.link("ankiplay" + audioSrc);
}
} else {
var elem = document.querySelector(".soundLink, .replaybutton"); // AnkiMobile & AnkiDroid
if (elem != null) {
elem.click();
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment