Skip to content

Commit

Permalink
11.0.4: [Platform] Added a more reliable method of detecting the user…
Browse files Browse the repository at this point in the history
… agent in `Devblocks.getBrowserName()`.
  • Loading branch information
jstanden committed Feb 11, 2025
1 parent 4677500 commit e9899b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion features/cerberusweb.core/resources/js/cerberus.js
Original file line number Diff line number Diff line change
Expand Up @@ -5410,7 +5410,7 @@ var ajax = new cAjaxCalls();
}

// √: Firefox, Chrome, Opera, Edge
if ('function' == typeof navigator?.clipboard.writeText && -1 === navigator.userAgent.indexOf('Safari/')) {
if ('function' == typeof navigator?.clipboard.writeText && 'safari' !== Devblocks.getBrowserName()) {
// Otherwise we need to call our promise async manually
startInteraction().then(
function(result) {
Expand Down
18 changes: 18 additions & 0 deletions libs/devblocks/resources/js/devblocks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
function DevblocksClass() {
this.audio = null;

this.getBrowserName = function() {
if (navigator.userAgent.indexOf("Opera") !== -1 || navigator.userAgent.indexOf('OPR') !== -1) {
return 'opera';
} else if (navigator.userAgent.indexOf("Edg") !== -1) {
return 'edge';
} else if (navigator.userAgent.indexOf("Chrome") !== -1) {
return 'chrome';
} else if (navigator.userAgent.indexOf("Safari") !== -1) {
return 'safari';
} else if (navigator.userAgent.indexOf("Firefox") !== -1) {
return 'firefox';
} else if (navigator.userAgent.indexOf("MSIE") !== -1 || document.documentMode) {
return 'msie';
} else {
return '';
}
}

this.playAudioUrl = function(url) {
try {
if(null == this.audio)
Expand Down

0 comments on commit e9899b4

Please sign in to comment.