5
5
* Licensed under the MIT license
6
6
* (See http://www.opensource.org/licenses/mit-license)
7
7
*/
8
-
8
+
9
9
( function ( jQuery ) {
10
10
11
11
/**
12
12
* Sets or gets the fullscreen state.
13
- *
13
+ *
14
14
* @param {boolean= } state
15
15
* True to enable fullscreen mode, false to disable it. If not
16
16
* specified then the current fullscreen state is returned.
17
17
* @return {boolean|Element|jQuery|null }
18
18
* When querying the fullscreen state then the current fullscreen
19
19
* element (or true if browser doesn't support it) is returned
20
20
* when browser is currently in full screen mode. False is returned
21
- * if browser is not in full screen mode. Null is returned if
22
- * browser doesn't support fullscreen mode at all. When setting
23
- * the fullscreen state then the current jQuery selection is
21
+ * if browser is not in full screen mode. Null is returned if
22
+ * browser doesn't support fullscreen mode at all. When setting
23
+ * the fullscreen state then the current jQuery selection is
24
24
* returned for chaining.
25
25
* @this {jQuery}
26
26
*/
27
27
function fullScreen ( state )
28
28
{
29
29
var e , func , doc ;
30
-
30
+
31
31
// Do nothing when nothing was selected
32
32
if ( ! this . length ) return this ;
33
-
33
+
34
34
// We only use the first selected element because it doesn't make sense
35
35
// to fullscreen multiple elements.
36
36
e = ( /** @type {Element } */ this [ 0 ] ) ;
37
-
37
+
38
38
// Find the real element and the document (Depends on whether the
39
39
// document itself or a HTML element was selected)
40
40
if ( e . ownerDocument )
@@ -46,7 +46,7 @@ function fullScreen(state)
46
46
doc = e ;
47
47
e = doc . documentElement ;
48
48
}
49
-
49
+
50
50
// When no state was specified then return the current state.
51
51
if ( state == null )
52
52
{
@@ -59,11 +59,11 @@ function fullScreen(state)
59
59
{
60
60
return null ;
61
61
}
62
-
62
+
63
63
// Check fullscreen state
64
64
state = fullScreenState ( doc ) ;
65
65
if ( ! state ) return state ;
66
-
66
+
67
67
// Return current fullscreen element or "true" if browser doesn't
68
68
// support this
69
69
return ( /** @type {?Element } */ doc [ "fullscreenElement" ] )
@@ -73,7 +73,7 @@ function fullScreen(state)
73
73
|| ( /** @type {?Element } */ doc [ "mozFullScreenElement" ] )
74
74
|| state ;
75
75
}
76
-
76
+
77
77
// When state was specified then enter or exit fullscreen mode.
78
78
if ( state )
79
79
{
@@ -83,7 +83,7 @@ function fullScreen(state)
83
83
|| ( /** @type {?Function } */ e [ "webkitRequestFullScreen" ] )
84
84
|| ( /** @type {?Function } */ e [ "msRequestFullscreen" ] )
85
85
|| ( /** @type {?Function } */ e [ "mozRequestFullScreen" ] ) ;
86
- if ( func )
86
+ if ( func )
87
87
{
88
88
func . call ( e ) ;
89
89
}
@@ -114,14 +114,14 @@ function fullScreenState(doc) {
114
114
115
115
/**
116
116
* Toggles the fullscreen mode.
117
- *
117
+ *
118
118
* @return {!jQuery }
119
119
* The jQuery selection for chaining.
120
120
* @this {jQuery}
121
121
*/
122
122
function toggleFullScreen ( )
123
123
{
124
- return ( /** @type {!jQuery } */ fullScreen . call ( this ,
124
+ return ( /** @type {!jQuery } */ fullScreen . call ( this ,
125
125
! fullScreen . call ( this ) ) ) ;
126
126
}
127
127
@@ -155,7 +155,7 @@ function fullScreenErrorHandler(event)
155
155
function installFullScreenHandlers ( )
156
156
{
157
157
var e , change , error ;
158
-
158
+
159
159
// Determine event name
160
160
e = document ;
161
161
if ( e [ "webkitCancelFullScreen" ] )
@@ -173,7 +173,7 @@ function installFullScreenHandlers()
173
173
change = "mozfullscreenchange" ;
174
174
error = "mozfullscreenerror" ;
175
175
}
176
- else
176
+ else
177
177
{
178
178
change = "fullscreenchange" ;
179
179
error = "fullscreenerror" ;
0 commit comments