Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +16 -11
templates/index.html
CHANGED
@@ -77,6 +77,7 @@
|
|
77 |
<script>
|
78 |
let recognition;
|
79 |
let currentName = ""; // Variable to store the name as it's being formed
|
|
|
80 |
let isNameCaptured = false;
|
81 |
let isEmailCaptured = false;
|
82 |
|
@@ -132,20 +133,24 @@
|
|
132 |
status.textContent = "Listening for your email...";
|
133 |
recognition.start();
|
134 |
recognition.onresult = function(event) {
|
135 |
-
|
136 |
|
137 |
-
//
|
138 |
-
|
139 |
-
|
140 |
-
// Clean any spaces around the email
|
141 |
-
const cleanedEmail = transcript.replace(/\s+/g, '');
|
142 |
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
};
|
150 |
}
|
151 |
|
|
|
77 |
<script>
|
78 |
let recognition;
|
79 |
let currentName = ""; // Variable to store the name as it's being formed
|
80 |
+
let currentEmail = ""; // Variable to store the email as it's being formed
|
81 |
let isNameCaptured = false;
|
82 |
let isEmailCaptured = false;
|
83 |
|
|
|
133 |
status.textContent = "Listening for your email...";
|
134 |
recognition.start();
|
135 |
recognition.onresult = function(event) {
|
136 |
+
const transcript = event.results[0][0].transcript.trim();
|
137 |
|
138 |
+
// Capture the individual letter spoken
|
139 |
+
currentEmail += transcript; // Append the current letter to the email
|
140 |
+
emailInput.value = currentEmail; // Display the updated email input
|
|
|
|
|
141 |
|
142 |
+
// Optionally, speak out the email as it's being typed
|
143 |
+
speak(transcript, null); // Say the captured letter
|
144 |
+
|
145 |
+
// If the user says "next", stop and finalize the registration
|
146 |
+
if (transcript.toLowerCase() === "next") {
|
147 |
+
recognition.stop(); // Stop the recognition for email
|
148 |
+
isEmailCaptured = true;
|
149 |
+
status.textContent = 'Registration complete.';
|
150 |
|
151 |
+
// After registration, refresh the page after 20 seconds
|
152 |
+
setTimeout(() => location.reload(), 20000); // Refresh after 20 seconds
|
153 |
+
}
|
154 |
};
|
155 |
}
|
156 |
|