Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +1 -8
templates/index.html
CHANGED
@@ -90,10 +90,7 @@
|
|
90 |
}
|
91 |
|
92 |
function startListeningForName() {
|
93 |
-
const status = document.getElementById('status');
|
94 |
-
status.textContent = "Listening for your name...";
|
95 |
recognition.start();
|
96 |
-
|
97 |
recognition.onresult = function(event) {
|
98 |
nameCaptured = event.results[0][0].transcript.trim();
|
99 |
document.getElementById('name').value = nameCaptured;
|
@@ -108,7 +105,7 @@
|
|
108 |
recognition.onresult = function(event) {
|
109 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
110 |
recognition.stop();
|
111 |
-
if (confirmation
|
112 |
setTimeout(() => speak("Great! Now, tell me your email.", startListeningForEmail), 500);
|
113 |
} else {
|
114 |
setTimeout(() => speak("Let's try again. Tell me your name.", startListeningForName), 500);
|
@@ -118,15 +115,11 @@
|
|
118 |
}
|
119 |
|
120 |
function startListeningForEmail() {
|
121 |
-
const status = document.getElementById('status');
|
122 |
-
status.textContent = "Listening for your email...";
|
123 |
recognition.start();
|
124 |
-
|
125 |
recognition.onresult = function(event) {
|
126 |
emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
127 |
document.getElementById('email').value = emailCaptured;
|
128 |
recognition.stop();
|
129 |
-
status.textContent = 'Registration complete.';
|
130 |
speak("Your registration is complete. Thank you for registering.");
|
131 |
setTimeout(() => location.reload(), 20000);
|
132 |
};
|
|
|
90 |
}
|
91 |
|
92 |
function startListeningForName() {
|
|
|
|
|
93 |
recognition.start();
|
|
|
94 |
recognition.onresult = function(event) {
|
95 |
nameCaptured = event.results[0][0].transcript.trim();
|
96 |
document.getElementById('name').value = nameCaptured;
|
|
|
105 |
recognition.onresult = function(event) {
|
106 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
107 |
recognition.stop();
|
108 |
+
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
109 |
setTimeout(() => speak("Great! Now, tell me your email.", startListeningForEmail), 500);
|
110 |
} else {
|
111 |
setTimeout(() => speak("Let's try again. Tell me your name.", startListeningForName), 500);
|
|
|
115 |
}
|
116 |
|
117 |
function startListeningForEmail() {
|
|
|
|
|
118 |
recognition.start();
|
|
|
119 |
recognition.onresult = function(event) {
|
120 |
emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
|
121 |
document.getElementById('email').value = emailCaptured;
|
122 |
recognition.stop();
|
|
|
123 |
speak("Your registration is complete. Thank you for registering.");
|
124 |
setTimeout(() => location.reload(), 20000);
|
125 |
};
|