Skip to content

Commit 108a857

Browse files
authored
Merge pull request #37 from williamdes/master
Some updates for version 1.1.6
2 parents 9438016 + 105ad2d commit 108a857

12 files changed

+57
-98
lines changed

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/demo
2+
/externs
3+
/bower.json
4+
/.npmignore
5+
/.gitignore

.travis.yml

-1
This file was deleted.

LICENSE.txt LICENSE

File renamed without changes.

README.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
jQuery Fullscreen Plugin
22
========================
33

4+
[![npm version](https://badge.fury.io/js/jquery-fullscreen-plugin.svg)](https://badge.fury.io/js/jquery-fullscreen-plugin)
5+
6+
[![CDNJS](https://img.shields.io/cdnjs/v/jquery-fullscreen-plugin.svg)](https://cdnjs.com/libraries/jquery-fullscreen-plugin)
7+
48

59
Description
610
-----------
@@ -15,13 +19,13 @@ Usage
1519
-----
1620

1721
### Entering Fullscreen mode
18-
22+
1923
You can either switch the whole page or a single HTML element to fullscreen
2024
mode:
21-
25+
```js
2226
$(document).fullScreen(true);
2327
$("#myVideo").fullScreen(true);
24-
28+
```
2529
This only works when the code was triggered by a user interaction (For
2630
example a onclick event on a button). Browsers don't allow entering
2731
fullscreen mode without user interaction.
@@ -32,10 +36,10 @@ fullscreen mode without user interaction.
3236
Fullscreen mode is always exited via the document but this plugin allows
3337
it also via any HTML element. The owner document of the selected HTML
3438
element is used then:
35-
39+
```js
3640
$(document).fullScreen(false);
3741
$("#myVideo").fullScreen(false);
38-
42+
```
3943

4044
### Querying Fullscreen mode
4145

@@ -45,41 +49,41 @@ browser doesn't support this) when fullscreen mode is active, `false` if not
4549
active or `null` when the browser does not support fullscreen mode at all.
4650
So you can use this method also to display a fullscreen button only when the
4751
browser supports fullscreen mode:
48-
52+
```js
4953
$("#fullscreenButton").toggle($(document).fullScreen() != null))
50-
54+
```
5155

5256
### Toggling Fullscreen mode
5357

5458
The plugin provides another method for simple fullscreen mode toggling:
55-
59+
```js
5660
$(document).toggleFullScreen();
57-
61+
```
5862

5963
### Notifications
6064

6165
The plugin triggers a `fullscreenchange` event on the document when the
6266
fullscreen mode has been changed. If the browser rejected a fullscreen
6367
state change then the plugin triggers a `fullscreenerror` event on the
6468
document. Example:
65-
69+
```js
6670
$(document).bind("fullscreenchange", function() {
6771
console.log("Fullscreen " + ($(document).fullScreen() ? "on" : "off"));
6872
});
6973

7074
$(document).bind("fullscreenerror", function() {
7175
alert("Browser rejected fullscreen change");
7276
});
73-
77+
```
7478

7579
### Fullscreen iframe
7680

7781
Entering fullscreen mode from within an iframe is not allowed by default but
7882
it can be enabled with a few attributes on the iframe:
79-
83+
```html
8084
<iframe src="iframe.html" webkitAllowFullScreen mozAllowFullScreen allowFullScreen>
8185
</iframe>
82-
86+
```
8387
### Known issues
8488

8589
* In IE 11 an empty page is displayed when entering fullscreen from within an

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "jquery-fullscreen-plugin",
33
"homepage": "https://github.com/kayahr/jquery-fullscreen-plugin",
44
"main": "jquery.fullscreen.js",
5-
"version": "1.1.4"
5+
"version": "1.1.5"
66
}

build.xml

-54
This file was deleted.

demo/iframe.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<title>Test iframe</title>
6-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
6+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
77
<script src="../jquery.fullscreen-min.js"></script>
88
</head>
99
<body style="background:white">

demo/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<title>jQuery Fullscreen Plugin demo</title>
6-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
6+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
77
<script src="../jquery.fullscreen-min.js"></script>
88
<script>
99

jquery.fullscreen-min.js

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.fullscreen.js

+29-22
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@
55
* Licensed under the MIT license
66
* (See http://www.opensource.org/licenses/mit-license)
77
*/
8-
8+
99
(function(jQuery) {
1010

1111
/**
1212
* Sets or gets the fullscreen state.
13-
*
13+
*
1414
* @param {boolean=} state
1515
* True to enable fullscreen mode, false to disable it. If not
1616
* specified then the current fullscreen state is returned.
1717
* @return {boolean|Element|jQuery|null}
1818
* When querying the fullscreen state then the current fullscreen
1919
* element (or true if browser doesn't support it) is returned
2020
* 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
2424
* returned for chaining.
2525
* @this {jQuery}
2626
*/
2727
function fullScreen(state)
2828
{
2929
var e, func, doc;
30-
30+
3131
// Do nothing when nothing was selected
3232
if (!this.length) return this;
33-
33+
3434
// We only use the first selected element because it doesn't make sense
3535
// to fullscreen multiple elements.
3636
e = (/** @type {Element} */ this[0]);
37-
37+
3838
// Find the real element and the document (Depends on whether the
3939
// document itself or a HTML element was selected)
4040
if (e.ownerDocument)
@@ -46,7 +46,7 @@ function fullScreen(state)
4646
doc = e;
4747
e = doc.documentElement;
4848
}
49-
49+
5050
// When no state was specified then return the current state.
5151
if (state == null)
5252
{
@@ -59,14 +59,11 @@ function fullScreen(state)
5959
{
6060
return null;
6161
}
62-
62+
6363
// Check fullscreen state
64-
state = !!doc["fullscreenElement"]
65-
|| !!doc["msFullscreenElement"]
66-
|| !!doc["webkitIsFullScreen"]
67-
|| !!doc["mozFullScreen"];
64+
state = fullScreenState(doc);
6865
if (!state) return state;
69-
66+
7067
// Return current fullscreen element or "true" if browser doesn't
7168
// support this
7269
return (/** @type {?Element} */ doc["fullscreenElement"])
@@ -76,7 +73,7 @@ function fullScreen(state)
7673
|| (/** @type {?Element} */ doc["mozFullScreenElement"])
7774
|| state;
7875
}
79-
76+
8077
// When state was specified then enter or exit fullscreen mode.
8178
if (state)
8279
{
@@ -86,7 +83,7 @@ function fullScreen(state)
8683
|| (/** @type {?Function} */ e["webkitRequestFullScreen"])
8784
|| (/** @type {?Function} */ e["msRequestFullscreen"])
8885
|| (/** @type {?Function} */ e["mozRequestFullScreen"]);
89-
if (func)
86+
if (func)
9087
{
9188
func.call(e);
9289
}
@@ -100,21 +97,31 @@ function fullScreen(state)
10097
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"])
10198
|| (/** @type {?Function} */ doc["msExitFullscreen"])
10299
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]);
103-
if (func) func.call(doc);
100+
if (func && fullScreenState(doc)) func.call(doc);
104101
return this;
105102
}
106103
}
107104

105+
/**
106+
* Check fullscreen state
107+
*
108+
* @param {Document} doc The content document
109+
* @return {Boolean}
110+
*/
111+
function fullScreenState(doc) {
112+
return !!(doc["fullscreenElement"] || doc["msFullscreenElement"] || doc["webkitIsFullScreen"] || doc["mozFullScreen"]);
113+
}
114+
108115
/**
109116
* Toggles the fullscreen mode.
110-
*
117+
*
111118
* @return {!jQuery}
112119
* The jQuery selection for chaining.
113120
* @this {jQuery}
114121
*/
115122
function toggleFullScreen()
116123
{
117-
return (/** @type {!jQuery} */ fullScreen.call(this,
124+
return (/** @type {!jQuery} */ fullScreen.call(this,
118125
!fullScreen.call(this)));
119126
}
120127

@@ -148,7 +155,7 @@ function fullScreenErrorHandler(event)
148155
function installFullScreenHandlers()
149156
{
150157
var e, change, error;
151-
158+
152159
// Determine event name
153160
e = document;
154161
if (e["webkitCancelFullScreen"])
@@ -166,7 +173,7 @@ function installFullScreenHandlers()
166173
change = "mozfullscreenchange";
167174
error = "mozfullscreenerror";
168175
}
169-
else
176+
else
170177
{
171178
change = "fullscreenchange";
172179
error = "fullscreenerror";

lib/compiler.jar

-5.19 MB
Binary file not shown.

fullscreen.jquery.json package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "fullscreen",
2+
"name": "jquery-fullscreen-plugin",
33
"title": "jQuery Fullscreen Plugin",
44
"description": "This jQuery plugin provides a simple to use mechanism to control the new fullscreen mode of modern browsers. Currently only newer Webkit-based browsers (Like Chrome) and Firefox provide this new fullscreen feature.",
55
"keywords": [
66
"fullscreen"
77
],
8-
"version": "1.1.4",
8+
"version": "1.1.5",
99
"author": {
1010
"name": "Klaus Reimer",
1111
"email": "[email protected]"

0 commit comments

Comments
 (0)