aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.idea/vcs.xml6
-rw-r--r--script.js11
2 files changed, 16 insertions, 1 deletions
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
+ </component>
+</project> \ No newline at end of file
diff --git a/script.js b/script.js
index 7116e29..c51e6c2 100644
--- a/script.js
+++ b/script.js
@@ -155,13 +155,22 @@ function generateObject() {
if (randomSelector === 1) {
current = whale;
+ speak(whaleDialog);
console.log(whaleDialog);
} else {
current = petuniaBowl;
+ speak(flowerPotDialog);
console.log(flowerPotDialog);
}
newObject = current.cloneNode(true);
current.parentNode.replaceChild(newObject, current);
newObject.classList.add("dropObject");
newObject.style.left = randomLeftOffset.toString() + "%";
-} \ No newline at end of file
+}
+
+function speak(message) {
+ const msg = new SpeechSynthesisUtterance(message);
+ const voices = window.speechSynthesis.getVoices();
+ msg.voice = voices[0];
+ window.speechSynthesis.speak(msg)
+}