1
|
|
|
// TinyMCE recordrtc library functions for checking browser compatibility. |
2
|
|
|
// @package tinymce_recordrtc. |
3
|
|
|
// @author Jesus Federico (jesus [at] blindsidenetworks [dt] com). |
4
|
|
|
// @author Jacob Prud'homme (jacob [dt] prudhomme [at] blindsidenetworks [dt] com) |
5
|
|
|
// @copyright 2016 onwards, Blindside Networks Inc. |
6
|
|
|
// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. |
7
|
|
|
|
8
|
|
|
// ESLint directives. |
9
|
|
|
/* global tinyMCE, tinyMCEPopup */ |
10
|
|
|
/* exported countdownTicker, playerDOM */ |
11
|
|
|
/* eslint-disable camelcase, no-alert */ |
12
|
|
|
|
13
|
|
|
// Scrutinizer CI directives. |
14
|
|
|
/** global: navigator */ |
15
|
|
|
/** global: parent */ |
16
|
|
|
/** global: M */ |
17
|
|
|
/** global: Y */ |
18
|
|
|
/** global: recordrtc */ |
19
|
|
|
/** global: tinyMCEPopup */ |
20
|
|
|
|
21
|
|
|
M.tinymce_recordrtc = M.tinymce_recordrtc || {}; |
22
|
|
|
|
23
|
|
|
// Show alert and close plugin if browser does not support WebRTC at all. |
24
|
|
|
M.tinymce_recordrtc.check_has_gum = function() { |
25
|
|
|
if (!(navigator.mediaDevices && window.MediaRecorder)) { |
26
|
|
|
M.tinymce_recordrtc.show_alert('nowebrtc', function() { |
27
|
|
|
tinyMCEPopup.close(); |
28
|
|
|
}); |
29
|
|
|
} |
30
|
|
|
}; |
31
|
|
|
|
32
|
|
|
// Notify and redirect user if plugin is used from insecure location. |
33
|
|
|
M.tinymce_recordrtc.check_secure = function() { |
34
|
|
|
var isSecureOrigin = (window.location.protocol === 'https:') || |
35
|
|
|
(window.location.host.indexOf('localhost') !== -1); |
36
|
|
|
|
37
|
|
|
if (!isSecureOrigin && (window.bowser.chrome || window.bowser.opera)) { |
38
|
|
|
M.tinymce_recordrtc.show_alert('gumsecurity', function() { |
39
|
|
|
tinyMCEPopup.close(); |
40
|
|
|
}); |
41
|
|
|
} else if (!isSecureOrigin) { |
42
|
|
|
alertDanger.ancestor().ancestor().removeClass('hide'); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
}; |
45
|
|
|
|
46
|
|
|
// Display "consider switching browsers" message if not using: |
47
|
|
|
// - Firefox 29+; |
48
|
|
|
// - Chrome 49+; |
49
|
|
|
// - Opera 36+. |
50
|
|
|
M.tinymce_recordrtc.check_browser = function() { |
51
|
|
|
if (!((window.bowser.firefox && window.bowser.version >= 29) || |
52
|
|
|
(window.bowser.chrome && window.bowser.version >= 49) || |
53
|
|
|
(window.bowser.opera && window.bowser.version >= 36))) { |
54
|
|
|
alertWarning.ancestor().ancestor().removeClass('hide'); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
}; |
57
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.