fitvids-rails 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/fitvids-rails.gemspec +19 -0
- data/lib/fitvids-rails.rb +7 -0
- data/lib/fitvids-rails/engine.rb +8 -0
- data/lib/fitvids-rails/version.rb +5 -0
- data/vendor/assets/javascripts/fitvids.js +81 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5c2cbd49f1d40fcecc675a31f0d93e50274e510d
|
4
|
+
data.tar.gz: 2ca1e2ff2ea826c338d179991a2723d1c4073eea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9ab3358a3116b17766ef0a11086a94079680e71294f30c703c0d21c57054ce8aa15e49a325f1cfc8870b6ae6b79329b18ff8f34a572eca56def9884d95635b1b
|
7
|
+
data.tar.gz: f51d0a74c95e9bb28ef072166184fdb065fe920eab0586fe52691fd9a937d4263cc80b1c116a058682346bd90433b46be75e70b24b40b59a596585618b08d786
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Caleb Thompson
|
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,8 @@
|
|
1
|
+
# fitvids-rails
|
2
|
+
|
3
|
+
Rails 3.1 asset pipeline wrapper around [FitVids.js](http://fitvidsjs.com)
|
4
|
+
|
5
|
+
## License
|
6
|
+
|
7
|
+
fitvids-rails is released under the same licence as FitVids.js,
|
8
|
+
[WTFPL](https://github.com/davatron5000/FitVids.js/blob/master/jquery.fitvids.js#L3-L11)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'fitvids-rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'fitvids-rails'
|
8
|
+
gem.version = Fitvids::Rails::VERSION
|
9
|
+
gem.authors = ['Caleb Thompson']
|
10
|
+
gem.email = ['cjaysson@gmail.com']
|
11
|
+
gem.summary = 'Rails wrapper for fitvids.js'
|
12
|
+
gem.description = 'Rails wrapper for fitvids, a lightweight, easy-to-use jQuery plugin for fluid width video embeds.'
|
13
|
+
gem.homepage = 'http://fitvidsjs.com'
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.require_path = 'lib'
|
17
|
+
|
18
|
+
gem.add_dependency 'railties', '>= 3.2.0'
|
19
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*global jQuery */
|
2
|
+
/*jshint multistr:true browser:true */
|
3
|
+
/*!
|
4
|
+
* FitVids 1.0
|
5
|
+
*
|
6
|
+
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
7
|
+
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
8
|
+
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
9
|
+
*
|
10
|
+
* Date: Thu Sept 01 18:00:00 2011 -0500
|
11
|
+
*/
|
12
|
+
|
13
|
+
(function( $ ){
|
14
|
+
|
15
|
+
"use strict";
|
16
|
+
|
17
|
+
$.fn.fitVids = function( options ) {
|
18
|
+
var settings = {
|
19
|
+
customSelector: null
|
20
|
+
};
|
21
|
+
|
22
|
+
var div = document.createElement('div'),
|
23
|
+
ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
|
24
|
+
|
25
|
+
div.className = 'fit-vids-style';
|
26
|
+
div.innerHTML = '­<style> \
|
27
|
+
.fluid-width-video-wrapper { \
|
28
|
+
width: 100%; \
|
29
|
+
position: relative; \
|
30
|
+
padding: 0; \
|
31
|
+
} \
|
32
|
+
\
|
33
|
+
.fluid-width-video-wrapper iframe, \
|
34
|
+
.fluid-width-video-wrapper object, \
|
35
|
+
.fluid-width-video-wrapper embed { \
|
36
|
+
position: absolute; \
|
37
|
+
top: 0; \
|
38
|
+
left: 0; \
|
39
|
+
width: 100%; \
|
40
|
+
height: 100%; \
|
41
|
+
} \
|
42
|
+
</style>';
|
43
|
+
|
44
|
+
ref.parentNode.insertBefore(div,ref);
|
45
|
+
|
46
|
+
if ( options ) {
|
47
|
+
$.extend( settings, options );
|
48
|
+
}
|
49
|
+
|
50
|
+
return this.each(function(){
|
51
|
+
var selectors = [
|
52
|
+
"iframe[src*='player.vimeo.com']",
|
53
|
+
"iframe[src*='www.youtube.com']",
|
54
|
+
"iframe[src*='www.youtube-nocookie.com']",
|
55
|
+
"iframe[src*='www.kickstarter.com']",
|
56
|
+
"object",
|
57
|
+
"embed"
|
58
|
+
];
|
59
|
+
|
60
|
+
if (settings.customSelector) {
|
61
|
+
selectors.push(settings.customSelector);
|
62
|
+
}
|
63
|
+
|
64
|
+
var $allVideos = $(this).find(selectors.join(','));
|
65
|
+
|
66
|
+
$allVideos.each(function(){
|
67
|
+
var $this = $(this);
|
68
|
+
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
69
|
+
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
70
|
+
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
71
|
+
aspectRatio = height / width;
|
72
|
+
if(!$this.attr('id')){
|
73
|
+
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
|
74
|
+
$this.attr('id', videoID);
|
75
|
+
}
|
76
|
+
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
|
77
|
+
$this.removeAttr('height').removeAttr('width');
|
78
|
+
});
|
79
|
+
});
|
80
|
+
};
|
81
|
+
})( jQuery );
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fitvids-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Caleb Thompson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
description: Rails wrapper for fitvids, a lightweight, easy-to-use jQuery plugin for
|
28
|
+
fluid width video embeds.
|
29
|
+
email:
|
30
|
+
- cjaysson@gmail.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- .gitignore
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- fitvids-rails.gemspec
|
41
|
+
- lib/fitvids-rails.rb
|
42
|
+
- lib/fitvids-rails/engine.rb
|
43
|
+
- lib/fitvids-rails/version.rb
|
44
|
+
- vendor/assets/javascripts/fitvids.js
|
45
|
+
homepage: http://fitvidsjs.com
|
46
|
+
licenses: []
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.0.0
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: Rails wrapper for fitvids.js
|
68
|
+
test_files: []
|