Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +59 -60
templates/index.html
CHANGED
@@ -170,69 +170,68 @@
|
|
170 |
}
|
171 |
|
172 |
function showRegistrationForm() {
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
recognition.
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
|
|
|
|
|
|
|
|
|
|
222 |
alert(`Registration successful for ${name}`);
|
223 |
-
//
|
|
|
224 |
}
|
225 |
-
});
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
const msg = new SpeechSynthesisUtterance(message);
|
230 |
-
window.speechSynthesis.speak(msg);
|
231 |
-
msg.onend = callback;
|
232 |
-
}
|
233 |
-
|
234 |
-
// Start the process by showing the registration form
|
235 |
-
showRegistrationForm();
|
236 |
</script>
|
237 |
</body>
|
238 |
</html>
|
|
|
|
170 |
}
|
171 |
|
172 |
function showRegistrationForm() {
|
173 |
+
document.getElementById('registrationForm').style.display = 'block';
|
174 |
+
speak("Please say your name to begin registration.", startListeningForName);
|
175 |
+
}
|
176 |
+
|
177 |
+
let nameField = document.getElementById('name');
|
178 |
+
let emailField = document.getElementById('email');
|
179 |
+
let mobileField = document.getElementById('mobile');
|
180 |
+
let infoMessage = document.getElementById('infoMessage');
|
181 |
+
|
182 |
+
function startListeningForName() {
|
183 |
+
recognition.start();
|
184 |
+
recognition.onresult = function(event) {
|
185 |
+
const name = event.results[0][0].transcript.trim();
|
186 |
+
nameField.value = name;
|
187 |
+
recognition.stop();
|
188 |
+
infoMessage.textContent = "Listening for your email...";
|
189 |
+
setTimeout(startListeningForEmail, 500); // Wait a moment before listening for email
|
190 |
+
};
|
191 |
+
}
|
192 |
+
|
193 |
+
function startListeningForEmail() {
|
194 |
+
recognition.start();
|
195 |
+
recognition.onresult = function(event) {
|
196 |
+
const email = event.results[0][0].transcript.trim();
|
197 |
+
emailField.value = email;
|
198 |
+
recognition.stop();
|
199 |
+
infoMessage.textContent = "Listening for your mobile number...";
|
200 |
+
setTimeout(startListeningForMobile, 500); // Wait a moment before listening for mobile
|
201 |
+
};
|
202 |
+
}
|
203 |
+
|
204 |
+
function startListeningForMobile() {
|
205 |
+
recognition.start();
|
206 |
+
recognition.onresult = function(event) {
|
207 |
+
const mobile = event.results[0][0].transcript.trim();
|
208 |
+
mobileField.value = mobile;
|
209 |
+
recognition.stop();
|
210 |
+
infoMessage.textContent = "Almost done...";
|
211 |
+
showConfirmation();
|
212 |
+
};
|
213 |
+
}
|
214 |
+
|
215 |
+
function showConfirmation() {
|
216 |
+
document.getElementById('confirmName').textContent = nameField.value;
|
217 |
+
document.getElementById('confirmEmail').textContent = emailField.value;
|
218 |
+
document.getElementById('confirmPhone').textContent = mobileField.value;
|
219 |
+
document.getElementById('confirmation').style.display = 'block';
|
220 |
+
}
|
221 |
+
|
222 |
+
function autoSubmit() {
|
223 |
+
const name = nameField.value;
|
224 |
+
const email = emailField.value;
|
225 |
+
const phone = mobileField.value;
|
226 |
+
// You can submit this data to your backend or Salesforce here
|
227 |
alert(`Registration successful for ${name}`);
|
228 |
+
// For demo purposes, reload the page after 5 seconds
|
229 |
+
setTimeout(() => location.reload(), 5000);
|
230 |
}
|
|
|
231 |
|
232 |
+
// Start the process by asking for registration or login
|
233 |
+
window.onload = askLoginOrRegister;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
</script>
|
235 |
</body>
|
236 |
</html>
|
237 |
+
|