Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +12 -23
templates/index.html
CHANGED
@@ -76,7 +76,6 @@
|
|
76 |
|
77 |
<script>
|
78 |
let recognition;
|
79 |
-
let isListening = false;
|
80 |
let isNameCaptured = false;
|
81 |
let isEmailCaptured = false;
|
82 |
|
@@ -117,28 +116,18 @@
|
|
117 |
recognition.onresult = function(event) {
|
118 |
let transcript = event.results[0][0].transcript.trim();
|
119 |
|
120 |
-
//
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
setTimeout(() => location.reload(), 20000); // Refresh after 20 seconds
|
133 |
-
isEmailCaptured = true; // Mark email as captured
|
134 |
-
} else if (!isNameCaptured) {
|
135 |
-
// If name is not yet captured, capture name first
|
136 |
-
nameInput.value = transcript;
|
137 |
-
status.textContent = 'Listening for your email...'; // Prompt for email
|
138 |
-
recognition.stop(); // Stop listening for name
|
139 |
-
isNameCaptured = true; // Mark name as captured
|
140 |
-
recognition.start(); // Start listening for email
|
141 |
-
}
|
142 |
};
|
143 |
}
|
144 |
|
|
|
76 |
|
77 |
<script>
|
78 |
let recognition;
|
|
|
79 |
let isNameCaptured = false;
|
80 |
let isEmailCaptured = false;
|
81 |
|
|
|
116 |
recognition.onresult = function(event) {
|
117 |
let transcript = event.results[0][0].transcript.trim();
|
118 |
|
119 |
+
// Replace "at" with "@" for email
|
120 |
+
transcript = transcript.replace(/\bat\b/g, '@').trim();
|
121 |
+
|
122 |
+
// Clean any spaces around the email
|
123 |
+
const cleanedEmail = transcript.replace(/\s+/g, '');
|
124 |
+
|
125 |
+
emailInput.value = cleanedEmail; // Set the email field with cleaned input
|
126 |
+
status.textContent = 'Registration complete.';
|
127 |
+
|
128 |
+
// After registration, refresh the page after 20 seconds
|
129 |
+
setTimeout(() => location.reload(), 20000); // Refresh after 20 seconds
|
130 |
+
isEmailCaptured = true; // Mark email as captured
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
};
|
132 |
}
|
133 |
|