jquery-screenfull-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/Gemfile.lock +46 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/Rakefile +1 -0
- data/jquery-screenfull-rails.gemspec +20 -0
- data/lib/jquery/screenfull/rails/version.rb +7 -0
- data/lib/jquery/screenfull/rails.rb +10 -0
- data/vendor/assets/javascripts/jquery.screenfull.js +26 -0
- data/vendor/assets/javascripts/screenfull.js +140 -0
- metadata +73 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jquery-screenfull-rails (0.0.1)
|
5
|
+
railties (>= 3.1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionpack (4.0.2)
|
11
|
+
activesupport (= 4.0.2)
|
12
|
+
builder (~> 3.1.0)
|
13
|
+
erubis (~> 2.7.0)
|
14
|
+
rack (~> 1.5.2)
|
15
|
+
rack-test (~> 0.6.2)
|
16
|
+
activesupport (4.0.2)
|
17
|
+
i18n (~> 0.6, >= 0.6.4)
|
18
|
+
minitest (~> 4.2)
|
19
|
+
multi_json (~> 1.3)
|
20
|
+
thread_safe (~> 0.1)
|
21
|
+
tzinfo (~> 0.3.37)
|
22
|
+
atomic (1.1.14)
|
23
|
+
builder (3.1.4)
|
24
|
+
erubis (2.7.0)
|
25
|
+
i18n (0.6.9)
|
26
|
+
minitest (4.7.5)
|
27
|
+
multi_json (1.8.4)
|
28
|
+
rack (1.5.2)
|
29
|
+
rack-test (0.6.2)
|
30
|
+
rack (>= 1.0)
|
31
|
+
railties (4.0.2)
|
32
|
+
actionpack (= 4.0.2)
|
33
|
+
activesupport (= 4.0.2)
|
34
|
+
rake (>= 0.8.7)
|
35
|
+
thor (>= 0.18.1, < 2.0)
|
36
|
+
rake (10.1.1)
|
37
|
+
thor (0.18.1)
|
38
|
+
thread_safe (0.1.3)
|
39
|
+
atomic
|
40
|
+
tzinfo (0.3.38)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
jquery-screenfull-rails!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Leonid Beder
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# jquery-screenfull-rails
|
2
|
+
|
3
|
+
Simple jQuery wrapper around the screenfull.js library for cross-browser usage of the JavaScript [Fullscreen API](https://developer.mozilla.org/en/DOM/Using_full-screen_mode), which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have too.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
In your Gemfile, add:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'jquery-screenfull-rails'
|
11
|
+
```
|
12
|
+
Add it to your JavaScript manifest file:
|
13
|
+
|
14
|
+
``` js
|
15
|
+
//= require jquery.screenfull
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
The plugin provides you with the following functionality:
|
21
|
+
|
22
|
+
### Fullscreen an element on click
|
23
|
+
|
24
|
+
```javascript
|
25
|
+
$('img').fullScreen();
|
26
|
+
```
|
27
|
+
|
28
|
+
### Detect if full screen is enabled on the browser
|
29
|
+
|
30
|
+
```javascript
|
31
|
+
var enabled = $.isFullScreenEnabled();
|
32
|
+
```
|
33
|
+
|
34
|
+
### Events
|
35
|
+
|
36
|
+
#### fullscreen:enter
|
37
|
+
Triggered when entering full screen.
|
38
|
+
|
39
|
+
#### fullscreen:exit
|
40
|
+
Triggered when exiting full screen.
|
41
|
+
|
42
|
+
#### Example:
|
43
|
+
```javascript
|
44
|
+
$('img').fullScreen().
|
45
|
+
on('fullscreen:enter', function() {
|
46
|
+
console.log('Entering full screen...');
|
47
|
+
}).
|
48
|
+
on('fullscreen:exit', function() {
|
49
|
+
console.log('Exiting full screen...');
|
50
|
+
});
|
51
|
+
```
|
52
|
+
|
53
|
+
## Credits and Contributors
|
54
|
+
|
55
|
+
This gem was inspired by the [screenfull.js](https://github.com/sindresorhus/screenfull.js) library.
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
The MIT License (MIT)
|
60
|
+
|
61
|
+
Copyright (c) 2014
|
62
|
+
|
63
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
64
|
+
this software and associated documentation files (the "Software"), to deal in
|
65
|
+
the Software without restriction, including without limitation the rights to
|
66
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
67
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
68
|
+
subject to the following conditions:
|
69
|
+
|
70
|
+
The above copyright notice and this permission notice shall be included in all
|
71
|
+
copies or substantial portions of the Software.
|
72
|
+
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
74
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
75
|
+
FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
76
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
77
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
78
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'jquery/screenfull/rails/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'jquery-screenfull-rails'
|
6
|
+
s.version = Jquery::Screenfull::Rails::VERSION
|
7
|
+
s.authors = ['Leonid Beder']
|
8
|
+
s.email = ['leonid.beder@gmail.com']
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.homepage = ''
|
11
|
+
s.summary = 'A jquery wrapper around the screenfull.js library'
|
12
|
+
s.description = 'A jquery wrapper around the screenfull.js library, with Rails integration'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split($/)
|
15
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
s.test_files = s.files.grep(%r{^(test|s|features)/})
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
|
19
|
+
s.add_dependency 'railties', '>= 3.1.0'
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
//= require screenfull
|
2
|
+
|
3
|
+
(function($) {
|
4
|
+
$.isFullScreenEnabled = function() {
|
5
|
+
return screenfull.enabled;
|
6
|
+
};
|
7
|
+
|
8
|
+
$.extend($.fn, {
|
9
|
+
fullScreen: function() {
|
10
|
+
return this.each(function() {
|
11
|
+
$(this).on('click', function() {
|
12
|
+
if ($.isFullScreenEnabled()) {
|
13
|
+
screenfull.toggle(this);
|
14
|
+
}
|
15
|
+
}).on(screenfull.raw.fullscreenchange, function() {
|
16
|
+
var $el = $(this);
|
17
|
+
if (screenfull.isFullscreen) {
|
18
|
+
$el.trigger('fullscreen:enter');
|
19
|
+
} else {
|
20
|
+
$el.trigger('fullscreen:exit');
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
24
|
+
},
|
25
|
+
});
|
26
|
+
})(jQuery);
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/*!
|
2
|
+
* screenfull
|
3
|
+
* v1.1.1 - 2013-11-20
|
4
|
+
* https://github.com/sindresorhus/screenfull.js
|
5
|
+
* (c) Sindre Sorhus; MIT License
|
6
|
+
*/
|
7
|
+
/*global Element */
|
8
|
+
(function (window, document) {
|
9
|
+
'use strict';
|
10
|
+
var keyboardAllowed = typeof Element !== 'undefined' && 'ALLOW_KEYBOARD_INPUT' in Element, // IE6 throws without typeof check
|
11
|
+
|
12
|
+
fn = (function () {
|
13
|
+
var val, valLength;
|
14
|
+
var fnMap = [
|
15
|
+
[
|
16
|
+
'requestFullscreen',
|
17
|
+
'exitFullscreen',
|
18
|
+
'fullscreenElement',
|
19
|
+
'fullscreenEnabled',
|
20
|
+
'fullscreenchange',
|
21
|
+
'fullscreenerror'
|
22
|
+
],
|
23
|
+
// new WebKit
|
24
|
+
[
|
25
|
+
'webkitRequestFullscreen',
|
26
|
+
'webkitExitFullscreen',
|
27
|
+
'webkitFullscreenElement',
|
28
|
+
'webkitFullscreenEnabled',
|
29
|
+
'webkitfullscreenchange',
|
30
|
+
'webkitfullscreenerror'
|
31
|
+
],
|
32
|
+
// old WebKit (Safari 5.1)
|
33
|
+
[
|
34
|
+
'webkitRequestFullScreen',
|
35
|
+
'webkitCancelFullScreen',
|
36
|
+
'webkitCurrentFullScreenElement',
|
37
|
+
'webkitCancelFullScreen',
|
38
|
+
'webkitfullscreenchange',
|
39
|
+
'webkitfullscreenerror'
|
40
|
+
],
|
41
|
+
[
|
42
|
+
'mozRequestFullScreen',
|
43
|
+
'mozCancelFullScreen',
|
44
|
+
'mozFullScreenElement',
|
45
|
+
'mozFullScreenEnabled',
|
46
|
+
'mozfullscreenchange',
|
47
|
+
'mozfullscreenerror'
|
48
|
+
],
|
49
|
+
[
|
50
|
+
'msRequestFullscreen',
|
51
|
+
'msExitFullscreen',
|
52
|
+
'msFullscreenElement',
|
53
|
+
'msFullscreenEnabled',
|
54
|
+
'MSFullscreenChange',
|
55
|
+
'MSFullscreenError'
|
56
|
+
]
|
57
|
+
];
|
58
|
+
var i = 0;
|
59
|
+
var l = fnMap.length;
|
60
|
+
var ret = {};
|
61
|
+
|
62
|
+
for (; i < l; i++) {
|
63
|
+
val = fnMap[i];
|
64
|
+
if (val && val[1] in document) {
|
65
|
+
for (i = 0, valLength = val.length; i < valLength; i++) {
|
66
|
+
ret[fnMap[0][i]] = val[i];
|
67
|
+
}
|
68
|
+
return ret;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
return false;
|
72
|
+
})(),
|
73
|
+
|
74
|
+
screenfull = {
|
75
|
+
request: function (elem) {
|
76
|
+
var request = fn.requestFullscreen;
|
77
|
+
|
78
|
+
elem = elem || document.documentElement;
|
79
|
+
|
80
|
+
// Work around Safari 5.1 bug: reports support for
|
81
|
+
// keyboard in fullscreen even though it doesn't.
|
82
|
+
// Browser sniffing, since the alternative with
|
83
|
+
// setTimeout is even worse.
|
84
|
+
if (/5\.1[\.\d]* Safari/.test(navigator.userAgent)) {
|
85
|
+
elem[request]();
|
86
|
+
} else {
|
87
|
+
elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
|
88
|
+
}
|
89
|
+
},
|
90
|
+
exit: function () {
|
91
|
+
document[fn.exitFullscreen]();
|
92
|
+
},
|
93
|
+
toggle: function (elem) {
|
94
|
+
if (this.isFullscreen) {
|
95
|
+
this.exit();
|
96
|
+
} else {
|
97
|
+
this.request(elem);
|
98
|
+
}
|
99
|
+
},
|
100
|
+
onchange: function () {},
|
101
|
+
onerror: function () {},
|
102
|
+
raw: fn
|
103
|
+
};
|
104
|
+
|
105
|
+
if (!fn) {
|
106
|
+
window.screenfull = false;
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
|
110
|
+
Object.defineProperties(screenfull, {
|
111
|
+
isFullscreen: {
|
112
|
+
get: function () {
|
113
|
+
return !!document[fn.fullscreenElement];
|
114
|
+
}
|
115
|
+
},
|
116
|
+
element: {
|
117
|
+
enumerable: true,
|
118
|
+
get: function () {
|
119
|
+
return document[fn.fullscreenElement];
|
120
|
+
}
|
121
|
+
},
|
122
|
+
enabled: {
|
123
|
+
enumerable: true,
|
124
|
+
get: function () {
|
125
|
+
// Coerce to boolean in case of old WebKit
|
126
|
+
return !!document[fn.fullscreenEnabled];
|
127
|
+
}
|
128
|
+
}
|
129
|
+
});
|
130
|
+
|
131
|
+
document.addEventListener(fn.fullscreenchange, function (e) {
|
132
|
+
screenfull.onchange.call(screenfull, e);
|
133
|
+
});
|
134
|
+
|
135
|
+
document.addEventListener(fn.fullscreenerror, function (e) {
|
136
|
+
screenfull.onerror.call(screenfull, e);
|
137
|
+
});
|
138
|
+
|
139
|
+
window.screenfull = screenfull;
|
140
|
+
})(window, document);
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-screenfull-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Leonid Beder
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.0
|
30
|
+
description: A jquery wrapper around the screenfull.js library, with Rails integration
|
31
|
+
email:
|
32
|
+
- leonid.beder@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- jquery-screenfull-rails.gemspec
|
43
|
+
- lib/jquery/screenfull/rails.rb
|
44
|
+
- lib/jquery/screenfull/rails/version.rb
|
45
|
+
- vendor/assets/javascripts/jquery.screenfull.js
|
46
|
+
- vendor/assets/javascripts/screenfull.js
|
47
|
+
homepage: ''
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.25
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: A jquery wrapper around the screenfull.js library
|
72
|
+
test_files: []
|
73
|
+
has_rdoc:
|