Subbu1304 commited on
Commit
1e7e8b3
·
verified ·
1 Parent(s): 0156dba

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +14 -25
templates/index.html CHANGED
@@ -114,19 +114,6 @@
114
  </div>
115
  </div>
116
 
117
- <div class="container" id="loginForm">
118
- <div class="form-container">
119
- <h2>Login</h2>
120
- <label for="loginEmail">Your Email</label>
121
- <input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
122
-
123
- <label for="loginMobile">Your Mobile Number</label>
124
- <input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
125
-
126
- <p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
127
- </div>
128
- </div>
129
-
130
  <div id="confirmation">
131
  <h2>Confirm Your Details:</h2>
132
  <p><strong>Name:</strong> <span id="confirmName"></span></p>
@@ -161,7 +148,7 @@
161
  if (response.includes("register")) {
162
  showRegistrationForm();
163
  } else if (response.includes("login")) {
164
- showLoginForm();
165
  } else {
166
  speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
167
  }
@@ -170,25 +157,27 @@
170
  }
171
 
172
  function showRegistrationForm() {
173
- document.getElementById('confirmation').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
  nameCaptured = event.results[0][0].transcript.trim();
186
- document.getElementById('name').value = nameCaptured;
187
  recognition.stop();
188
  setTimeout(confirmName, 500);
189
  };
190
  }
191
- function confirmName() {
 
192
  speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
193
  recognition.start();
194
  recognition.onresult = function(event) {
@@ -207,7 +196,7 @@
207
  recognition.start();
208
  recognition.onresult = function(event) {
209
  emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
210
- document.getElementById('email').value = emailCaptured;
211
  recognition.stop();
212
  speak("You said " + emailCaptured + ". Is it correct?", function() {
213
  recognition.start();
@@ -228,7 +217,7 @@
228
  recognition.start();
229
  recognition.onresult = function(event) {
230
  mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
231
- document.getElementById('mobile').value = mobileCaptured;
232
  recognition.stop();
233
  speak("You said " + mobileCaptured + ". Is it correct?", function() {
234
  recognition.start();
@@ -248,12 +237,12 @@
248
  }
249
 
250
  function autoConfirm() {
251
- document.getElementById('confirmName').textContent = document.getElementById('name').value;
252
- document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
253
- document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
254
  document.getElementById('confirmation').style.display = 'block';
255
- setTimeout(autoSubmit, 3000);
256
  }
 
257
  function autoSubmit() {
258
  var name = document.getElementById('name').value;
259
  var email = document.getElementById('email').value;
@@ -276,10 +265,10 @@
276
  }
277
  });
278
  }
 
279
  window.onload = function () {
280
  setTimeout(startListeningForName, 4000);
281
  };
282
  </script>
283
  </body>
284
  </html>
285
-
 
114
  </div>
115
  </div>
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  <div id="confirmation">
118
  <h2>Confirm Your Details:</h2>
119
  <p><strong>Name:</strong> <span id="confirmName"></span></p>
 
148
  if (response.includes("register")) {
149
  showRegistrationForm();
150
  } else if (response.includes("login")) {
151
+ // Implement login form if needed
152
  } else {
153
  speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
154
  }
 
157
  }
158
 
159
  function showRegistrationForm() {
160
+ document.getElementById('registrationForm').style.display = 'block';
161
  speak("Please say your name to begin registration.", startListeningForName);
162
  }
163
 
164
+ let nameCaptured, emailCaptured, mobileCaptured;
165
  let nameField = document.getElementById('name');
166
  let emailField = document.getElementById('email');
167
  let mobileField = document.getElementById('mobile');
168
  let infoMessage = document.getElementById('infoMessage');
169
 
170
+ function startListeningForName() {
171
  recognition.start();
172
  recognition.onresult = function(event) {
173
  nameCaptured = event.results[0][0].transcript.trim();
174
+ nameField.value = nameCaptured;
175
  recognition.stop();
176
  setTimeout(confirmName, 500);
177
  };
178
  }
179
+
180
+ function confirmName() {
181
  speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
182
  recognition.start();
183
  recognition.onresult = function(event) {
 
196
  recognition.start();
197
  recognition.onresult = function(event) {
198
  emailCaptured = event.results[0][0].transcript.trim().replace(/\bat\b/g, '@').replace(/\s+/g, '');
199
+ emailField.value = emailCaptured;
200
  recognition.stop();
201
  speak("You said " + emailCaptured + ". Is it correct?", function() {
202
  recognition.start();
 
217
  recognition.start();
218
  recognition.onresult = function(event) {
219
  mobileCaptured = event.results[0][0].transcript.trim().replace(/\s+/g, '');
220
+ mobileField.value = mobileCaptured;
221
  recognition.stop();
222
  speak("You said " + mobileCaptured + ". Is it correct?", function() {
223
  recognition.start();
 
237
  }
238
 
239
  function autoConfirm() {
240
+ document.getElementById('confirmName').textContent = nameField.value;
241
+ document.getElementById('confirmEmail').textContent = emailField.value;
242
+ document.getElementById('confirmPhone').textContent = mobileField.value;
243
  document.getElementById('confirmation').style.display = 'block';
 
244
  }
245
+
246
  function autoSubmit() {
247
  var name = document.getElementById('name').value;
248
  var email = document.getElementById('email').value;
 
265
  }
266
  });
267
  }
268
+
269
  window.onload = function () {
270
  setTimeout(startListeningForName, 4000);
271
  };
272
  </script>
273
  </body>
274
  </html>