Last active
September 18, 2022 05:01
-
-
Save iamandrewluca/2b7b4d76df729c55e35f642a710f7f6b to your computer and use it in GitHub Desktop.
Will speak any select text from page #bookmarklet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: void ((async () => { | |
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */ | |
let interval = 500; | |
const intervalId = setInterval(() => { | |
interval += 500; | |
if (interval > 5000) { return; } | |
if (window.speechSynthesis.getVoices().length !== 0) { | |
clearInterval(intervalId); | |
const text = window.getSelection().toString(); | |
const utterance = new SpeechSynthesisUtterance(text); | |
speechSynthesis.speak(utterance); | |
} | |
}, interval); | |
})()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment