Spaces:
Runtime error
Runtime error
Update templates/index.html
Browse files- templates/index.html +10 -6
templates/index.html
CHANGED
@@ -86,9 +86,11 @@
|
|
86 |
function startListeningForName() {
|
87 |
document.getElementById('status').textContent = "Listening for your name...";
|
88 |
recognition.start();
|
89 |
-
recognition.
|
90 |
-
let transcript =
|
91 |
document.getElementById('name').value = transcript;
|
|
|
|
|
92 |
speak("Please provide your email address", startListeningForEmail);
|
93 |
};
|
94 |
}
|
@@ -96,10 +98,12 @@
|
|
96 |
function startListeningForEmail() {
|
97 |
document.getElementById('status').textContent = "Listening for your email...";
|
98 |
recognition.start();
|
99 |
-
recognition.
|
100 |
-
let transcript =
|
101 |
-
transcript = transcript.replace(/\bat\b/g, '@').replace(/\bdot\b/g, '.');
|
102 |
document.getElementById('email').value = transcript;
|
|
|
|
|
103 |
speak("Registration complete. You can proceed with your order.");
|
104 |
};
|
105 |
}
|
@@ -114,4 +118,4 @@
|
|
114 |
setTimeout(startProcess, 2000);
|
115 |
};
|
116 |
</script>
|
117 |
-
</html>
|
|
|
86 |
function startListeningForName() {
|
87 |
document.getElementById('status').textContent = "Listening for your name...";
|
88 |
recognition.start();
|
89 |
+
recognition.onresult = function(event) {
|
90 |
+
let transcript = event.results[0][0].transcript.trim();
|
91 |
document.getElementById('name').value = transcript;
|
92 |
+
};
|
93 |
+
recognition.onend = function() {
|
94 |
speak("Please provide your email address", startListeningForEmail);
|
95 |
};
|
96 |
}
|
|
|
98 |
function startListeningForEmail() {
|
99 |
document.getElementById('status').textContent = "Listening for your email...";
|
100 |
recognition.start();
|
101 |
+
recognition.onresult = function(event) {
|
102 |
+
let transcript = event.results[0][0].transcript.trim();
|
103 |
+
transcript = transcript.replace(/\bat\b|\bat the rate\b/g, '@').replace(/\bdot\b/g, '.');
|
104 |
document.getElementById('email').value = transcript;
|
105 |
+
};
|
106 |
+
recognition.onend = function() {
|
107 |
speak("Registration complete. You can proceed with your order.");
|
108 |
};
|
109 |
}
|
|
|
118 |
setTimeout(startProcess, 2000);
|
119 |
};
|
120 |
</script>
|
121 |
+
</html>
|