lokesh341 commited on
Commit
a68e98f
·
verified ·
1 Parent(s): 670ebee

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +8 -8
templates/index.html CHANGED
@@ -93,9 +93,9 @@
93
  nameCaptured = "";
94
  recognition.start();
95
  recognition.onresult = function(event) {
96
- let transcript = event.results[event.results.length - 1][0].transcript.trim();
97
- nameCaptured += transcript + " ";
98
- document.getElementById('name').value = nameCaptured.trim();
99
  };
100
  recognition.onspeechend = function() {
101
  recognition.stop();
@@ -104,7 +104,7 @@
104
  }
105
 
106
  function confirmName() {
107
- speak("You said " + nameCaptured.trim().split('').join(' ') + ". Is it okay, or do you want to change it?", function() {
108
  recognition.start();
109
  recognition.onresult = function(event) {
110
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();
@@ -122,13 +122,13 @@
122
  emailCaptured = "";
123
  recognition.start();
124
  recognition.onresult = function(event) {
125
- let transcript = event.results[event.results.length - 1][0].transcript.trim();
126
- emailCaptured += transcript + " ";
127
- document.getElementById('email').value = emailCaptured.trim();
128
  };
129
  recognition.onspeechend = function() {
130
  recognition.stop();
131
- speak("You said " + emailCaptured.trim() + ". Is it correct?", function() {
132
  recognition.start();
133
  recognition.onresult = function(event) {
134
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();
 
93
  nameCaptured = "";
94
  recognition.start();
95
  recognition.onresult = function(event) {
96
+ let transcript = event.results[event.results.length - 1][0].transcript.trim().replace(/\s+/g, "");
97
+ nameCaptured += transcript;
98
+ document.getElementById('name').value = nameCaptured;
99
  };
100
  recognition.onspeechend = function() {
101
  recognition.stop();
 
104
  }
105
 
106
  function confirmName() {
107
+ speak("You said " + nameCaptured.split('').join(' ') + ". Is it okay, or do you want to change it?", function() {
108
  recognition.start();
109
  recognition.onresult = function(event) {
110
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();
 
122
  emailCaptured = "";
123
  recognition.start();
124
  recognition.onresult = function(event) {
125
+ let transcript = event.results[event.results.length - 1][0].transcript.trim().replace(/\s+/g, "");
126
+ emailCaptured += transcript;
127
+ document.getElementById('email').value = emailCaptured;
128
  };
129
  recognition.onspeechend = function() {
130
  recognition.stop();
131
+ speak("You said " + emailCaptured + ". Is it correct?", function() {
132
  recognition.start();
133
  recognition.onresult = function(event) {
134
  let confirmation = event.results[0][0].transcript.trim().toLowerCase();