Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +18 -2
templates/index.html
CHANGED
@@ -82,7 +82,7 @@
|
|
82 |
<!-- Welcome Page -->
|
83 |
<div class="container" id="welcomePage">
|
84 |
<h1>Welcome to Biriyani Hub 🍽</h1>
|
85 |
-
<h2>🔊 Please say '
|
86 |
</div>
|
87 |
|
88 |
<!-- Registration Form -->
|
@@ -160,6 +160,22 @@
|
|
160 |
document.getElementById('loginForm').style.display = 'block';
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
function captureLoginDetails() {
|
164 |
speak("Please say your email for login.", function () {
|
165 |
recognition.start();
|
@@ -253,7 +269,7 @@
|
|
253 |
}
|
254 |
|
255 |
window.onload = function () {
|
256 |
-
|
257 |
};
|
258 |
</script>
|
259 |
</body>
|
|
|
82 |
<!-- Welcome Page -->
|
83 |
<div class="container" id="welcomePage">
|
84 |
<h1>Welcome to Biriyani Hub 🍽</h1>
|
85 |
+
<h2>🔊 Please say 'Hi Biryani Hub' to start.</h2>
|
86 |
</div>
|
87 |
|
88 |
<!-- Registration Form -->
|
|
|
160 |
document.getElementById('loginForm').style.display = 'block';
|
161 |
}
|
162 |
|
163 |
+
// Ask user to say "Hi Biryani Hub"
|
164 |
+
function listenForGreeting() {
|
165 |
+
speak("Please say 'Hi Biryani Hub' to continue.", function () {
|
166 |
+
recognition.start();
|
167 |
+
recognition.onresult = function (event) {
|
168 |
+
let response = event.results[0][0].transcript.trim().toLowerCase();
|
169 |
+
recognition.stop();
|
170 |
+
if (response.includes("hi biryani hub")) {
|
171 |
+
askLoginOrRegister();
|
172 |
+
} else {
|
173 |
+
speak("I didn't hear 'Hi Biryani Hub'. Please say it to proceed.", listenForGreeting);
|
174 |
+
}
|
175 |
+
};
|
176 |
+
});
|
177 |
+
}
|
178 |
+
|
179 |
function captureLoginDetails() {
|
180 |
speak("Please say your email for login.", function () {
|
181 |
recognition.start();
|
|
|
269 |
}
|
270 |
|
271 |
window.onload = function () {
|
272 |
+
listenForGreeting(); // Start listening for "Hi Biryani Hub"
|
273 |
};
|
274 |
</script>
|
275 |
</body>
|