Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +28 -5
templates/index.html
CHANGED
@@ -98,6 +98,7 @@
|
|
98 |
<body>
|
99 |
<h1 class="header-title">Welcome to Biryani Hub 🍽</h1>
|
100 |
|
|
|
101 |
<div class="container" id="registrationForm">
|
102 |
<div class="form-container">
|
103 |
<h2>Register</h2>
|
@@ -114,6 +115,21 @@
|
|
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>
|
@@ -140,7 +156,7 @@
|
|
140 |
}
|
141 |
|
142 |
function askLoginOrRegister() {
|
143 |
-
speak("
|
144 |
recognition.start();
|
145 |
recognition.onresult = function(event) {
|
146 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
@@ -148,7 +164,7 @@
|
|
148 |
if (response.includes("register")) {
|
149 |
showRegistrationForm();
|
150 |
} else if (response.includes("login")) {
|
151 |
-
|
152 |
} else {
|
153 |
speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
|
154 |
}
|
@@ -158,14 +174,20 @@
|
|
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();
|
@@ -178,7 +200,7 @@
|
|
178 |
}
|
179 |
|
180 |
function confirmName() {
|
181 |
-
speak("You said " + nameCaptured + ". Is it okay
|
182 |
recognition.start();
|
183 |
recognition.onresult = function(event) {
|
184 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
@@ -267,8 +289,9 @@
|
|
267 |
}
|
268 |
|
269 |
window.onload = function () {
|
270 |
-
|
271 |
};
|
272 |
</script>
|
273 |
</body>
|
274 |
</html>
|
|
|
|
98 |
<body>
|
99 |
<h1 class="header-title">Welcome to Biryani Hub 🍽</h1>
|
100 |
|
101 |
+
<!-- Registration Form -->
|
102 |
<div class="container" id="registrationForm">
|
103 |
<div class="form-container">
|
104 |
<h2>Register</h2>
|
|
|
115 |
</div>
|
116 |
</div>
|
117 |
|
118 |
+
<!-- Login Form -->
|
119 |
+
<div class="container" id="loginForm">
|
120 |
+
<div class="form-container">
|
121 |
+
<h2>Login</h2>
|
122 |
+
<label for="loginEmail">Your Email</label>
|
123 |
+
<input type="text" id="loginEmail" placeholder="Your email will appear here..." readonly>
|
124 |
+
|
125 |
+
<label for="loginMobile">Your Mobile Number</label>
|
126 |
+
<input type="text" id="loginMobile" placeholder="Your mobile number will appear here..." readonly>
|
127 |
+
|
128 |
+
<p class="info" id="infoMessageLogin">Listening 🗣🎙️...</p>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
|
132 |
+
<!-- Confirmation Section -->
|
133 |
<div id="confirmation">
|
134 |
<h2>Confirm Your Details:</h2>
|
135 |
<p><strong>Name:</strong> <span id="confirmName"></span></p>
|
|
|
156 |
}
|
157 |
|
158 |
function askLoginOrRegister() {
|
159 |
+
speak("Say 'Register' to sign up or 'Login' to sign in.", function() {
|
160 |
recognition.start();
|
161 |
recognition.onresult = function(event) {
|
162 |
let response = event.results[0][0].transcript.trim().toLowerCase();
|
|
|
164 |
if (response.includes("register")) {
|
165 |
showRegistrationForm();
|
166 |
} else if (response.includes("login")) {
|
167 |
+
showLoginForm();
|
168 |
} else {
|
169 |
speak("I didn't understand. Please say 'Register' to sign up or 'Login' to sign in.", askLoginOrRegister);
|
170 |
}
|
|
|
174 |
|
175 |
function showRegistrationForm() {
|
176 |
document.getElementById('registrationForm').style.display = 'block';
|
177 |
+
document.getElementById('loginForm').style.display = 'none';
|
178 |
speak("Please say your name to begin registration.", startListeningForName);
|
179 |
}
|
180 |
|
181 |
+
function showLoginForm() {
|
182 |
+
document.getElementById('loginForm').style.display = 'block';
|
183 |
+
document.getElementById('registrationForm').style.display = 'none';
|
184 |
+
speak("Please say your email and mobile number to login.", startListeningForLogin);
|
185 |
+
}
|
186 |
+
|
187 |
let nameCaptured, emailCaptured, mobileCaptured;
|
188 |
let nameField = document.getElementById('name');
|
189 |
let emailField = document.getElementById('email');
|
190 |
let mobileField = document.getElementById('mobile');
|
|
|
191 |
|
192 |
function startListeningForName() {
|
193 |
recognition.start();
|
|
|
200 |
}
|
201 |
|
202 |
function confirmName() {
|
203 |
+
speak("You said " + nameCaptured + ". Is it okay?", function() {
|
204 |
recognition.start();
|
205 |
recognition.onresult = function(event) {
|
206 |
let confirmation = event.results[0][0].transcript.trim().toLowerCase();
|
|
|
289 |
}
|
290 |
|
291 |
window.onload = function () {
|
292 |
+
askLoginOrRegister();
|
293 |
};
|
294 |
</script>
|
295 |
</body>
|
296 |
</html>
|
297 |
+
|