lokesh341 commited on
Commit
8863e3e
·
verified ·
1 Parent(s): 32a8151

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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
- // If name is captured, we now capture email
121
- if (isNameCaptured && !isEmailCaptured) {
122
- // Correct email input format by replacing 'at' with '@'
123
- transcript = transcript.replace(/\bat\b/g, '@').trim(); // Replace "at" with "@"
124
-
125
- // Remove any spaces around the email input
126
- const cleanedEmail = transcript.replace(/\s+/g, ''); // Remove any additional spaces
127
-
128
- emailInput.value = cleanedEmail; // Set the email field with cleaned input
129
- status.textContent = 'Registration complete.';
130
-
131
- // After registration, refresh the page after 20 seconds
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