Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

voice navigator - minor changes

DanielŻuławski7949da5c5fa2
diff --git a/src/Web/Grand.Web/Views/Shared/VoiceNavigator/VoiceNavigator.cshtml b/src/Web/Grand.Web/Views/Shared/VoiceNavigator/VoiceNavigator.cshtml
index ddd4fc033..dbbfcf653 100644
--- a/src/Web/Grand.Web/Views/Shared/VoiceNavigator/VoiceNavigator.cshtml
+++ b/src/Web/Grand.Web/Views/Shared/VoiceNavigator/VoiceNavigator.cshtml
@@ -112,23 +112,22 @@
if (voicenavigator.recording) {
const current = event.resultIndex;
const transcript = event.results[current][0].transcript;
- const concatTranscript = transcript.toLowerCase();
+ if (event.results[0].isFinal) {
+ const concatTranscript = transcript.replace(/[`~!#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '').toLowerCase();
+ const transcriptArray = concatTranscript.split(' ');
+ voicenavigator.transcript = transcript;
- var transcriptArray = concatTranscript.split(' ');
+ for (const [key, element] of Object.entries(voicenavigator.commands)) {
+ const found = element.triggers.some(r => transcriptArray.includes(r));
- voicenavigator.transcript = transcript;
-
- for (const [key, element] of Object.entries(voicenavigator.commands)) {
- const found = element.triggers.some(r => transcriptArray.includes(r));
-
- if (found) {
- voicenavigator.variant = "success"
- setTimeout(function () {
- window.location.replace(element.url);
- }, 300);
- break
- } else {
- voicenavigator.variant = "info"
+ if (found) {
+ voicenavigator.stopRecording();
+ voicenavigator.variant = "success";
+ setTimeout(function () {
+ window.location.href = element.url;
+ }, 300)
+ break
+ }
}
}
}