Skip to content

Commit

Permalink
Update fitvids to latest master.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoereth committed Sep 7, 2015
1 parent 47c23c5 commit fece819
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions js/jquery.fitvids.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*global jQuery */
/*jshint browser:true */
/*!
* FitVids 1.1
* FitVids master-2015-08
*
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
*
*/

(function( $ ){
;(function( $ ){

"use strict";
'use strict';

$.fn.fitVids = function( options ) {
var settings = {
Expand All @@ -23,7 +22,7 @@
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
var head = document.head || document.getElementsByTagName('head')[0];
var css = '.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%;}';
var div = document.createElement('div');
var div = document.createElement("div");
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
head.appendChild(div.childNodes[1]);
}
Expand All @@ -34,12 +33,12 @@

return this.each(function(){
var selectors = [
"iframe[src*='player.vimeo.com']",
"iframe[src*='youtube.com']",
"iframe[src*='youtube-nocookie.com']",
"iframe[src*='kickstarter.com'][src*='video.html']",
"object",
"embed"
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];

if (settings.customSelector) {
Expand All @@ -53,10 +52,10 @@
}

var $allVideos = $(this).find(selectors.join(','));
$allVideos = $allVideos.not("object object"); // SwfObj conflict patch
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.

$allVideos.each(function(){
$allVideos.each(function(count){
var $this = $(this);
if($this.parents(ignoreList).length > 0) {
return; // Disable FitVids on this video.
Expand All @@ -71,10 +70,10 @@
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
aspectRatio = height / width;
if(!$this.attr('id')){
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
var videoID = 'fitvid' + count;
$this.attr('id', videoID);
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
$this.removeAttr('height').removeAttr('width');
});
});
Expand Down
2 changes: 1 addition & 1 deletion php/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function enqueue() {
'jquery.fitvids',
FVP_URL . "js/jquery.fitvids$min.js",
array( 'jquery' ),
'1.1',
'master-2015-08',
false
);

Expand Down

0 comments on commit fece819

Please sign in to comment.