Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +6 -6
templates/index.html
CHANGED
@@ -208,21 +208,21 @@
|
|
208 |
};
|
209 |
}
|
210 |
|
211 |
-
|
212 |
recognition.start();
|
213 |
recognition.onresult = function(event) {
|
214 |
-
let
|
215 |
-
document.getElementById('
|
216 |
recognition.stop();
|
217 |
-
speak("You said " +
|
218 |
recognition.start();
|
219 |
recognition.onresult = function(event) {
|
220 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
221 |
recognition.stop();
|
222 |
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
223 |
-
speak("
|
224 |
} else {
|
225 |
-
speak("Let's try again.
|
226 |
}
|
227 |
};
|
228 |
});
|
|
|
208 |
};
|
209 |
}
|
210 |
|
211 |
+
function startListeningForMobile() {
|
212 |
recognition.start();
|
213 |
recognition.onresult = function(event) {
|
214 |
+
let mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
|
215 |
+
document.getElementById('mobile').value = mobileCaptured;
|
216 |
recognition.stop();
|
217 |
+
speak("You said " + mobileCaptured + ". Is it correct?", function() {
|
218 |
recognition.start();
|
219 |
recognition.onresult = function(event) {
|
220 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
221 |
recognition.stop();
|
222 |
if (confirmation.includes("ok") || confirmation.includes("yes")) {
|
223 |
+
speak("All details are captured. Confirming your registration.");
|
224 |
} else {
|
225 |
+
speak("Let's try again. Tell me your mobile number.", startListeningForMobile);
|
226 |
}
|
227 |
};
|
228 |
});
|