fitvidsjs_rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Mjk4OGIwMmM3Zjg1ODNlOWEzNmJiZGIzYmIzYzQ3MmIzMTdkZmZjOQ==
5
+ data.tar.gz: !binary |-
6
+ M2Y0NGIyZGI3NmM5NzU5YzBkYTE2MWQ5ZTNjYzc0NTRjODUzMDViZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ Njg0NzRkZDYwNjA1OWI1ODk1MDIwZjEyNmRhOTRjYzlkZWE2YWMwYTFkZGFh
10
+ ZWI4ZjVkMDk4NGJmZjRlY2VlMDJkNTAyYjZiMjA4MjE3OThkOWI1MDMwZWUy
11
+ MTZkNTc3MTViZTM0Mzg2ZjI5MWI3Zjk5MWRjYjdmNDBhNTRkYTM=
12
+ data.tar.gz: !binary |-
13
+ YjA2NDFiMWM5ZjBhMjE3Yjc5NWQxYzA2MGEwZDQwYzBmNDUwNDIyYTQ4OWNi
14
+ MTU4NWY1NTVkMjcxMDI4MzM5MDIzZDA2YTQxYWFjNDQ1OTE2NmI0ZTRhZDBj
15
+ MWJkZWNiZmE5ODNkYzZlMzBiOTNmZWViZjFjODg4MmNkYjNjMjU=
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fitvidsjs_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Guy Israeli
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,47 @@
1
+ # FitvidsjsRails
2
+
3
+ wrapper for fitvids.js - fitting a video responsively
4
+
5
+ see source @ https://github.com/davatron5000/FitVids.js
6
+
7
+ see background - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
8
+
9
+ Requires jQuery 1.7+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'fitvidsjs_rails'
15
+
16
+ add to manifest application.js
17
+
18
+ //= require fitvids.js
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install fitvidsjs_rails
27
+
28
+ ## Usage
29
+
30
+ <script src="path/to/jquery.min.js"></script>
31
+ <script src="path/to/jquery.fitvids.js"></script>
32
+ <script>
33
+ $(document).ready(function(){
34
+ // Target your .container, .wrapper, .post, etc.
35
+ $("#thing-with-videos").fitVids();
36
+ });
37
+ </script>
38
+
39
+ see https://github.com/davatron5000/FitVids.js for more info
40
+
41
+ ## Contributing
42
+
43
+ 1. Fork it
44
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
45
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
46
+ 4. Push to the branch (`git push origin my-new-feature`)
47
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,74 @@
1
+ /*global jQuery */
2
+ /*jshint multistr:true browser:true */
3
+ /*!
4
+ * FitVids 1.0
5
+ *
6
+ * Copyright 2013, 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
+ if(!document.getElementById('fit-vids-style')) {
23
+
24
+ var div = document.createElement('div'),
25
+ ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0],
26
+ cssStyles = '&shy;<style>.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}</style>';
27
+
28
+ div.className = 'fit-vids-style';
29
+ div.id = 'fit-vids-style';
30
+ div.style.display = 'none';
31
+ div.innerHTML = cssStyles;
32
+
33
+ ref.parentNode.insertBefore(div,ref);
34
+
35
+ }
36
+
37
+ if ( options ) {
38
+ $.extend( settings, options );
39
+ }
40
+
41
+ return this.each(function(){
42
+ var selectors = [
43
+ "iframe[src*='player.vimeo.com']",
44
+ "iframe[src*='youtube.com']",
45
+ "iframe[src*='youtube-nocookie.com']",
46
+ "iframe[src*='kickstarter.com'][src*='video.html']",
47
+ "object",
48
+ "embed"
49
+ ];
50
+
51
+ if (settings.customSelector) {
52
+ selectors.push(settings.customSelector);
53
+ }
54
+
55
+ var $allVideos = $(this).find(selectors.join(','));
56
+ $allVideos = $allVideos.not("object object"); // SwfObj conflict patch
57
+
58
+ $allVideos.each(function(){
59
+ var $this = $(this);
60
+ if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
61
+ var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
62
+ width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
63
+ aspectRatio = height / width;
64
+ if(!$this.attr('id')){
65
+ var videoID = 'fitvid' + Math.floor(Math.random()*999999);
66
+ $this.attr('id', videoID);
67
+ }
68
+ $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
69
+ $this.removeAttr('height').removeAttr('width');
70
+ });
71
+ });
72
+ };
73
+ // Works with either jQuery or Zepto
74
+ })( window.jQuery || window.Zepto );
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'fitvidsjs_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "fitvidsjs_rails"
8
+ spec.version = FitvidsjsRails::VERSION
9
+ spec.authors = ["Guy Israeli"]
10
+ spec.description = %q{Wrapper for FitVids.js - Embedding a video resposively}
11
+ spec.summary = %q{asset pipeline wrapper for Fitvids.js - Rails 3.1+}
12
+ spec.homepage = ""
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.3"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_dependency "railties", ">=3.1"
23
+
24
+ end
@@ -0,0 +1,3 @@
1
+ module FitvidsjsRails
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "fitvidsjs_rails/version"
2
+
3
+ module FitvidsjsRails
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fitvidsjs_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Guy Israeli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description: Wrapper for FitVids.js - Embedding a video resposively
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - .gitignore
62
+ - Gemfile
63
+ - LICENSE.txt
64
+ - README.md
65
+ - Rakefile
66
+ - app/assets/javascripts/fitvids.js
67
+ - fitvidsjs_rails.gemspec
68
+ - lib/fitvidsjs_rails.rb
69
+ - lib/fitvidsjs_rails/version.rb
70
+ homepage: ''
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.1.3
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: asset pipeline wrapper for Fitvids.js - Rails 3.1+
94
+ test_files: []