Spaces:
Runtime error
Runtime error
Update templates/index.html
Browse files- templates/index.html +9 -5
templates/index.html
CHANGED
@@ -71,7 +71,7 @@
|
|
71 |
if ('webkitSpeechRecognition' in window) {
|
72 |
recognition = new webkitSpeechRecognition();
|
73 |
recognition.continuous = false;
|
74 |
-
recognition.interimResults =
|
75 |
recognition.lang = 'en-US';
|
76 |
} else {
|
77 |
alert("Speech Recognition API is not supported in this browser.");
|
@@ -86,9 +86,11 @@
|
|
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.
|
91 |
-
|
|
|
92 |
};
|
93 |
recognition.onend = function() {
|
94 |
speak("Please provide your email address", startListeningForEmail);
|
@@ -98,10 +100,12 @@
|
|
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.
|
103 |
transcript = transcript.replace(/\bat\b/g, '@').replace(/\bdot\b/g, '.');
|
104 |
-
|
|
|
105 |
};
|
106 |
recognition.onend = function() {
|
107 |
speak("Registration complete. You can proceed with your order.");
|
|
|
71 |
if ('webkitSpeechRecognition' in window) {
|
72 |
recognition = new webkitSpeechRecognition();
|
73 |
recognition.continuous = false;
|
74 |
+
recognition.interimResults = true;
|
75 |
recognition.lang = 'en-US';
|
76 |
} else {
|
77 |
alert("Speech Recognition API is not supported in this browser.");
|
|
|
86 |
function startListeningForName() {
|
87 |
document.getElementById('status').textContent = "Listening for your name...";
|
88 |
recognition.start();
|
89 |
+
let finalText = "";
|
90 |
recognition.onresult = function(event) {
|
91 |
+
let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
|
92 |
+
finalText += transcript;
|
93 |
+
document.getElementById('name').value = finalText;
|
94 |
};
|
95 |
recognition.onend = function() {
|
96 |
speak("Please provide your email address", startListeningForEmail);
|
|
|
100 |
function startListeningForEmail() {
|
101 |
document.getElementById('status').textContent = "Listening for your email...";
|
102 |
recognition.start();
|
103 |
+
let finalText = "";
|
104 |
recognition.onresult = function(event) {
|
105 |
+
let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
|
106 |
transcript = transcript.replace(/\bat\b/g, '@').replace(/\bdot\b/g, '.');
|
107 |
+
finalText += transcript;
|
108 |
+
document.getElementById('email').value = finalText;
|
109 |
};
|
110 |
recognition.onend = function() {
|
111 |
speak("Registration complete. You can proceed with your order.");
|