-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathutils.js
46 lines (38 loc) · 1.31 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
///////////////////////////////////////////////////////////////////////////////
// Cyber Mega Phone 2K
// Copyright (C) 2017 Digium, Inc.
//
// This program is free software, distributed under the terms of the
// MIT License. See the LICENSE file at the top of the source tree.
///////////////////////////////////////////////////////////////////////////////
function FullScreen(obj) {
this._obj = obj;
}
FullScreen.prototype.can = function () {
return !!(document.fullscreenEnabled || document.mozFullScreenEnabled ||
document.msFullscreenEnabled || document.webkitSupportsFullscreen ||
document.webkitFullscreenEnabled);
};
FullScreen.prototype.is = function() {
return !!(document.fullScreen || document.webkitIsFullScreen ||
document.mozFullScreen || document.msFullscreenElement ||
document.fullscreenElement);
};
FullScreen.prototype.setData = function(state) {
this._obj.setAttribute('data-fullscreen', !!state);
};
FullScreen.prototype.exit = function() {
if (!this.is()) {
return;
}
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
this.setData(false);
};