Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +4 -42
templates/index.html
CHANGED
@@ -10,6 +10,7 @@
|
|
10 |
|
11 |
<body>
|
12 |
<div class="container">
|
|
|
13 |
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
14 |
|
15 |
<label for="name">Your Name</label>
|
@@ -37,7 +38,6 @@
|
|
37 |
let nameCaptured = "";
|
38 |
let emailCaptured = "";
|
39 |
let mobileCaptured = "";
|
40 |
-
|
41 |
if ('webkitSpeechRecognition' in window) {
|
42 |
recognition = new webkitSpeechRecognition();
|
43 |
recognition.continuous = false;
|
@@ -46,13 +46,11 @@
|
|
46 |
} else {
|
47 |
alert("Speech Recognition API is not supported in this browser.");
|
48 |
}
|
49 |
-
|
50 |
function speak(text, callback) {
|
51 |
const speech = new SpeechSynthesisUtterance(text);
|
52 |
speech.onend = callback;
|
53 |
window.speechSynthesis.speak(speech);
|
54 |
}
|
55 |
-
|
56 |
function startListeningForName() {
|
57 |
recognition.start();
|
58 |
recognition.onresult = function(event) {
|
@@ -62,7 +60,6 @@
|
|
62 |
setTimeout(confirmName, 500);
|
63 |
};
|
64 |
}
|
65 |
-
|
66 |
function confirmName() {
|
67 |
speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
|
68 |
recognition.start();
|
@@ -77,7 +74,6 @@
|
|
77 |
};
|
78 |
});
|
79 |
}
|
80 |
-
|
81 |
function startListeningForEmail() {
|
82 |
recognition.start();
|
83 |
recognition.onresult = function(event) {
|
@@ -98,7 +94,6 @@
|
|
98 |
});
|
99 |
};
|
100 |
}
|
101 |
-
|
102 |
function startListeningForMobile() {
|
103 |
recognition.start();
|
104 |
recognition.onresult = function(event) {
|
@@ -121,44 +116,11 @@
|
|
121 |
});
|
122 |
};
|
123 |
}
|
124 |
-
|
125 |
-
function autoConfirm() {
|
126 |
-
document.getElementById('confirmName').textContent = document.getElementById('name').value;
|
127 |
-
document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
|
128 |
-
document.getElementById('confirmPhone').textContent = document.getElementById('mobile').value;
|
129 |
-
document.getElementById('confirmation').style.display = 'block';
|
130 |
-
setTimeout(autoSubmit, 3000);
|
131 |
-
}
|
132 |
-
|
133 |
-
function autoSubmit() {
|
134 |
-
var name = document.getElementById('name').value;
|
135 |
-
var email = document.getElementById('email').value;
|
136 |
-
var phone = document.getElementById('mobile').value;
|
137 |
-
|
138 |
-
fetch('/submit', {
|
139 |
-
method: 'POST',
|
140 |
-
headers: { 'Content-Type': 'application/json' },
|
141 |
-
body: JSON.stringify({ name: name, email: email, phone: phone })
|
142 |
-
})
|
143 |
-
.then(response => response.json())
|
144 |
-
.then(data => {
|
145 |
-
if (data.success) {
|
146 |
-
document.getElementById('status').textContent = 'Your details were submitted successfully!';
|
147 |
-
document.getElementById('confirmation').style.display = 'none';
|
148 |
-
speak("Your registration is complete. Thank you for registering.");
|
149 |
-
setTimeout(() => location.reload(), 5000);
|
150 |
-
} else {
|
151 |
-
document.getElementById('status').textContent = 'There was an error submitting your details.';
|
152 |
-
speak("There was an error submitting your details. Please try again.");
|
153 |
-
}
|
154 |
-
});
|
155 |
-
}
|
156 |
-
|
157 |
window.onload = function () {
|
158 |
-
speak("Welcome to Biryani Hub.
|
159 |
-
setTimeout(startListeningForName,
|
160 |
});
|
161 |
};
|
162 |
</script>
|
163 |
</body>
|
164 |
-
</html>
|
|
|
10 |
|
11 |
<body>
|
12 |
<div class="container">
|
13 |
+
<img src="https://yourimageurl.com/logo.png" alt="Logo" class="image-logo">
|
14 |
<h1>Welcome to Biryani Hub 🍽 🍗</h1>
|
15 |
|
16 |
<label for="name">Your Name</label>
|
|
|
38 |
let nameCaptured = "";
|
39 |
let emailCaptured = "";
|
40 |
let mobileCaptured = "";
|
|
|
41 |
if ('webkitSpeechRecognition' in window) {
|
42 |
recognition = new webkitSpeechRecognition();
|
43 |
recognition.continuous = false;
|
|
|
46 |
} else {
|
47 |
alert("Speech Recognition API is not supported in this browser.");
|
48 |
}
|
|
|
49 |
function speak(text, callback) {
|
50 |
const speech = new SpeechSynthesisUtterance(text);
|
51 |
speech.onend = callback;
|
52 |
window.speechSynthesis.speak(speech);
|
53 |
}
|
|
|
54 |
function startListeningForName() {
|
55 |
recognition.start();
|
56 |
recognition.onresult = function(event) {
|
|
|
60 |
setTimeout(confirmName, 500);
|
61 |
};
|
62 |
}
|
|
|
63 |
function confirmName() {
|
64 |
speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
|
65 |
recognition.start();
|
|
|
74 |
};
|
75 |
});
|
76 |
}
|
|
|
77 |
function startListeningForEmail() {
|
78 |
recognition.start();
|
79 |
recognition.onresult = function(event) {
|
|
|
94 |
});
|
95 |
};
|
96 |
}
|
|
|
97 |
function startListeningForMobile() {
|
98 |
recognition.start();
|
99 |
recognition.onresult = function(event) {
|
|
|
116 |
});
|
117 |
};
|
118 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
window.onload = function () {
|
120 |
+
speak("Welcome to Biryani Hub. Please tell me your name to start the registration.", function() {
|
121 |
+
setTimeout(startListeningForName, 1000);
|
122 |
});
|
123 |
};
|
124 |
</script>
|
125 |
</body>
|
126 |
+
</html>
|