lokesh341 commited on
Commit
3e5bc1d
·
verified ·
1 Parent(s): 3cd493a

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +13 -5
templates/index.html CHANGED
@@ -1,4 +1,3 @@
1
- html_code = """
2
  <!DOCTYPE html>
3
  <html lang="en">
4
  <head>
@@ -11,7 +10,6 @@ html_code = """
11
 
12
  <body>
13
  <div class="container">
14
-
15
  <h1>Welcome to Biryani Hub 🍽 🍗</h1>
16
 
17
  <label for="name">Your Name</label>
@@ -39,6 +37,7 @@ html_code = """
39
  let nameCaptured = "";
40
  let emailCaptured = "";
41
  let mobileCaptured = "";
 
42
  if ('webkitSpeechRecognition' in window) {
43
  recognition = new webkitSpeechRecognition();
44
  recognition.continuous = false;
@@ -47,11 +46,13 @@ html_code = """
47
  } else {
48
  alert("Speech Recognition API is not supported in this browser.");
49
  }
 
50
  function speak(text, callback) {
51
  const speech = new SpeechSynthesisUtterance(text);
52
  speech.onend = callback;
53
  window.speechSynthesis.speak(speech);
54
  }
 
55
  function startListeningForName() {
56
  recognition.start();
57
  recognition.onresult = function(event) {
@@ -61,6 +62,7 @@ html_code = """
61
  setTimeout(confirmName, 500);
62
  };
63
  }
 
64
  function confirmName() {
65
  speak("You said " + nameCaptured + ". Is it okay, or do you want to change it?", function() {
66
  recognition.start();
@@ -75,6 +77,7 @@ html_code = """
75
  };
76
  });
77
  }
 
78
  function startListeningForEmail() {
79
  recognition.start();
80
  recognition.onresult = function(event) {
@@ -95,6 +98,7 @@ html_code = """
95
  });
96
  };
97
  }
 
98
  function startListeningForMobile() {
99
  recognition.start();
100
  recognition.onresult = function(event) {
@@ -117,6 +121,7 @@ html_code = """
117
  });
118
  };
119
  }
 
120
  function autoConfirm() {
121
  document.getElementById('confirmName').textContent = document.getElementById('name').value;
122
  document.getElementById('confirmEmail').textContent = document.getElementById('email').value;
@@ -124,10 +129,12 @@ html_code = """
124
  document.getElementById('confirmation').style.display = 'block';
125
  setTimeout(autoSubmit, 3000);
126
  }
 
127
  function autoSubmit() {
128
  var name = document.getElementById('name').value;
129
  var email = document.getElementById('email').value;
130
  var phone = document.getElementById('mobile').value;
 
131
  fetch('/submit', {
132
  method: 'POST',
133
  headers: { 'Content-Type': 'application/json' },
@@ -146,11 +153,12 @@ html_code = """
146
  }
147
  });
148
  }
 
149
  window.onload = function () {
150
- setTimeout(startListeningForName, 4000);
 
 
151
  };
152
  </script>
153
  </body>
154
  </html>
155
- """
156
-
 
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
 
10
 
11
  <body>
12
  <div class="container">
 
13
  <h1>Welcome to Biryani Hub 🍽 🍗</h1>
14
 
15
  <label for="name">Your Name</label>
 
37
  let nameCaptured = "";
38
  let emailCaptured = "";
39
  let mobileCaptured = "";
40
+
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
+
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
  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
  };
78
  });
79
  }
80
+
81
  function startListeningForEmail() {
82
  recognition.start();
83
  recognition.onresult = function(event) {
 
98
  });
99
  };
100
  }
101
+
102
  function startListeningForMobile() {
103
  recognition.start();
104
  recognition.onresult = function(event) {
 
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;
 
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' },
 
153
  }
154
  });
155
  }
156
+
157
  window.onload = function () {
158
+ speak("Welcome to Biryani Hub. Let's start your registration.", function () {
159
+ setTimeout(startListeningForName, 2000);
160
+ });
161
  };
162
  </script>
163
  </body>
164
  </html>