lokesh341 commited on
Commit
20ea335
·
verified ·
1 Parent(s): 646a98b

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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
- let transcript = event.results[0][0].transcript.trim();
136
 
137
- // Replace "at" with "@" for email
138
- transcript = transcript.replace(/\bat\b/g, '@').trim();
139
-
140
- // Clean any spaces around the email
141
- const cleanedEmail = transcript.replace(/\s+/g, '');
142
 
143
- emailInput.value = cleanedEmail; // Set the email field with cleaned input
144
- status.textContent = 'Registration complete.';
 
 
 
 
 
 
145
 
146
- // After registration, refresh the page after 20 seconds
147
- setTimeout(() => location.reload(), 20000); // Refresh after 20 seconds
148
- isEmailCaptured = true; // Mark email as captured
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