Last active
October 31, 2024 01:27
-
-
Save ampcpmgp/a765d7137c4b140f5885c58e0f0b9a4b to your computer and use it in GitHub Desktop.
定期的に指定メッセージを発言するブックマークレット
This file contains hidden or 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
start() | |
function start() { | |
const message = window.prompt("発言してほしいメッセージを入力してください") | |
const intervalMinutes = window.prompt("何分に1回発言してほしいか入力してください", "60") - 0 | |
const intervalMilliseconds = intervalMinutes * 60 * 1 | |
document.title = "🌸定期発言中!" | |
speak(message) | |
setInterval(() => { | |
speak(message) | |
}, intervalMinutes * 60 * 1000) | |
} | |
function speak(message) { | |
const synth = window.speechSynthesis; | |
const utterThis = new SpeechSynthesisUtterance(message); | |
synth.speak(utterThis); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment