Browse code

Created repository.

DoubleBastionAdmin authored on 26/01/2022 20:32:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,57 @@
1
+/**
2
+ *  Copyright (C) 2021  Double Bastion LLC
3
+ *
4
+ *  This file is part of Roundpin, which is licensed under the
5
+ *  GNU Affero General Public License Version 3.0. The license terms
6
+ *  are detailed in the "LICENSE.txt" file located in the root directory.
7
+ *
8
+ *  The file content from below is identical with that of the
9
+ *  original file "utils.js". The copyright notice for the
10
+ *  original content follows.
11
+ */
12
+///////////////////////////////////////////////////////////////////////////////
13
+//  Cyber Mega Phone 2K
14
+//  Copyright (C) 2017 Digium, Inc.
15
+//
16
+//  This program is free software, distributed under the terms of the
17
+//  MIT License. See the LICENSE file at the top of the source tree.
18
+///////////////////////////////////////////////////////////////////////////////
19
+
20
+function FullScreen(obj) {
21
+	this._obj = obj;
22
+}
23
+
24
+FullScreen.prototype.can = function () {
25
+	return !!(document.fullscreenEnabled || document.mozFullScreenEnabled ||
26
+			document.msFullscreenEnabled || document.webkitSupportsFullscreen ||
27
+			document.webkitFullscreenEnabled);
28
+};
29
+
30
+FullScreen.prototype.is = function() {
31
+	return !!(document.fullScreen || document.webkitIsFullScreen ||
32
+			document.mozFullScreen || document.msFullscreenElement ||
33
+			document.fullscreenElement);
34
+};
35
+
36
+FullScreen.prototype.setData = function(state) {
37
+	this._obj.setAttribute('data-fullscreen', !!state);
38
+};
39
+
40
+FullScreen.prototype.exit = function() {
41
+	if (!this.is()) {
42
+		return;
43
+	}
44
+
45
+	if (document.exitFullscreen) {
46
+		document.exitFullscreen();
47
+	} else if (document.mozCancelFullScreen) {
48
+		document.mozCancelFullScreen();
49
+	} else if (document.webkitCancelFullScreen) {
50
+		document.webkitCancelFullScreen();
51
+	} else if (document.msExitFullscreen) {
52
+		document.msExitFullscreen();
53
+	}
54
+
55
+	this.setData(false);
56
+};
57
+