geethareddy commited on
Commit
2b4486f
·
verified ·
1 Parent(s): 57090aa

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +3 -7
templates/index.html CHANGED
@@ -71,7 +71,7 @@
71
  if ('webkitSpeechRecognition' in window) {
72
  recognition = new webkitSpeechRecognition();
73
  recognition.continuous = false;
74
- recognition.interimResults = true;
75
  recognition.lang = 'en-US';
76
  } else {
77
  alert("Speech Recognition API is not supported in this browser.");
@@ -86,11 +86,9 @@
86
  function startListeningForName() {
87
  document.getElementById('status').textContent = "Listening for your name...";
88
  recognition.start();
89
- let finalText = "";
90
  recognition.onresult = function(event) {
91
  let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
92
- finalText += transcript;
93
- document.getElementById('name').value = finalText;
94
  };
95
  recognition.onend = function() {
96
  speak("Please provide your email address", startListeningForEmail);
@@ -100,12 +98,10 @@
100
  function startListeningForEmail() {
101
  document.getElementById('status').textContent = "Listening for your email...";
102
  recognition.start();
103
- let finalText = "";
104
  recognition.onresult = function(event) {
105
  let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
106
  transcript = transcript.replace(/\bat\b/g, '@').replace(/\bdot\b/g, '.');
107
- finalText += transcript;
108
- document.getElementById('email').value = finalText;
109
  };
110
  recognition.onend = function() {
111
  speak("Registration complete. You can proceed with your order.");
 
71
  if ('webkitSpeechRecognition' in window) {
72
  recognition = new webkitSpeechRecognition();
73
  recognition.continuous = false;
74
+ recognition.interimResults = false;
75
  recognition.lang = 'en-US';
76
  } else {
77
  alert("Speech Recognition API is not supported in this browser.");
 
86
  function startListeningForName() {
87
  document.getElementById('status').textContent = "Listening for your name...";
88
  recognition.start();
 
89
  recognition.onresult = function(event) {
90
  let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
91
+ document.getElementById('name').value = transcript;
 
92
  };
93
  recognition.onend = function() {
94
  speak("Please provide your email address", startListeningForEmail);
 
98
  function startListeningForEmail() {
99
  document.getElementById('status').textContent = "Listening for your email...";
100
  recognition.start();
 
101
  recognition.onresult = function(event) {
102
  let transcript = event.results[0][0].transcript.replace(/\s+/g, "");
103
  transcript = transcript.replace(/\bat\b/g, '@').replace(/\bdot\b/g, '.');
104
+ document.getElementById('email').value = transcript;
 
105
  };
106
  recognition.onend = function() {
107
  speak("Registration complete. You can proceed with your order.");