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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
speech recognition - browser support
DanielŻuławskic6c191d64b21
diff --git a/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml b/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtmlindex 70c56a6fc..bce5c73c3 100644--- a/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml+++ b/src/Web/Grand.Web/Views/Shared/Components/SearchBox/Default.cshtml@@ -138,6 +138,40 @@stopRecording() {this.recognition.stop();},+ allowCheck() {+ var isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&+ navigator.userAgent &&+ navigator.userAgent.indexOf('CriOS') == -1 &&+ navigator.userAgent.indexOf('FxiOS') == -1;+ if (!isSafari) {+ navigator.permissions.query(+ { name: 'microphone' }+ ).then(function (permissionStatus) {++ if (permissionStatus.state == "denied") {+ voicenavigator.allowed = false;+ } else {+ voicenavigator.allowed = true;+ }++ permissionStatus.onchange = function () {+ if (this.state == "denied") {+ voicenavigator.allowed = false;+ } else {+ voicenavigator.allowed = true;+ }+ }+ });+ } else {+ if (navigator.mediaDevices != undefined) {+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {+ voicenavigator.allowed = true;+ }).catch(function (err) {+ voicenavigator.allowed = false;+ })+ }+ }+ },autocompleteVue() {var delayTimer;function getCategories(item) {@@ -199,25 +233,7 @@}},created() {- navigator.permissions.query(- { name: 'microphone' }- ).then(function (permissionStatus) {-- if (permissionStatus.state == "denied") {- searchbox.allowed = false;- } else {- searchbox.allowed = true;- }-- permissionStatus.onchange = function () {- if (this.state == "denied") {- searchbox.allowed = false;- } else {- searchbox.allowed = true;- }- }-- });+ this.allowCheck();},watch: {text: function () {diff --git a/src/Web/Grand.Web/Views/Shared/Components/VoiceNavigation/Default.cshtml b/src/Web/Grand.Web/Views/Shared/Components/VoiceNavigation/Default.cshtmlindex 60d27eae9..8973c993b 100644--- a/src/Web/Grand.Web/Views/Shared/Components/VoiceNavigation/Default.cshtml+++ b/src/Web/Grand.Web/Views/Shared/Components/VoiceNavigation/Default.cshtml@@ -92,24 +92,38 @@this.recognition.stop();},allowCheck() {- navigator.permissions.query(- { name: 'microphone' }- ).then(function (permissionStatus) {+ var isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&+ navigator.userAgent &&+ navigator.userAgent.indexOf('CriOS') == -1 &&+ navigator.userAgent.indexOf('FxiOS') == -1;+ if (!isSafari) {+ navigator.permissions.query(+ { name: 'microphone' }+ ).then(function (permissionStatus) {- if (permissionStatus.state == "denied") {- voicenavigator.allowed = false;- } else {- voicenavigator.allowed = true;- }-- permissionStatus.onchange = function () {- if (this.state == "denied") {+ if (permissionStatus.state == "denied") {voicenavigator.allowed = false;} else {voicenavigator.allowed = true;}++ permissionStatus.onchange = function () {+ if (this.state == "denied") {+ voicenavigator.allowed = false;+ } else {+ voicenavigator.allowed = true;+ }+ }+ });+ } else {+ if (navigator.mediaDevices != undefined) {+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {+ voicenavigator.allowed = true;+ }).catch(function (err) {+ voicenavigator.allowed = false;+ })}- });+ }}},created() {diff --git a/src/Web/Grand.Web/wwwroot/theme/css/common/common.css b/src/Web/Grand.Web/wwwroot/theme/css/common/common.cssindex 09e98892c..e63f02307 100644--- a/src/Web/Grand.Web/wwwroot/theme/css/common/common.css+++ b/src/Web/Grand.Web/wwwroot/theme/css/common/common.css@@ -720,6 +720,9 @@ input:checked ~ .color-container .color::before {animation: boxShadow 2s infinite;}.voice-alert {+ -webkit-user-select: none;+ -moz-user-select: none;+ user-select: none;pointer-events: none;z-index: 1034;}diff --git a/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css b/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.cssindex b1277d8d6..9b5d2bf6d 100644--- a/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css+++ b/src/Web/Grand.Web/wwwroot/theme/css/common/common.rtl.css@@ -806,6 +806,9 @@ input:checked ~ .color-container .color::before {animation: boxShadow 2s infinite;}.voice-alert {+ -webkit-user-select: none;+ -moz-user-select: none;+ user-select: none;pointer-events: none;z-index: 1034;}