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/*jshint browser:true */ 14/*! 15* FitVids 1.1 16* 17* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 18* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 19* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 20* 21*/ 22 23;(function( $ ){ 24 25 'use strict'; 26 27 $.fn.fitVids = function( options ) { 28 var settings = { 29 customSelector: null, 30 ignore: null 31 }; 32 33 if(!document.getElementById('fit-vids-style')) { 34 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 35 var head = document.head || document.getElementsByTagName('head')[0]; 36 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%;}'; 37 var div = document.createElement("div"); 38 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 39 head.appendChild(div.childNodes[1]); 40 } 41 42 if ( options ) { 43 $.extend( settings, options ); 44 } 45 46 return this.each(function(){ 47 var selectors = [ 48 'iframe[src*="player.vimeo.com"]', 49 'iframe[src*="youtube.com"]', 50 'iframe[src*="youtube-nocookie.com"]', 51 'iframe[src*="kickstarter.com"][src*="video.html"]', 52 'object', 53 'embed' 54 ]; 55 56 if (settings.customSelector) { 57 selectors.push(settings.customSelector); 58 } 59 60 var ignoreList = '.fitvidsignore'; 61 62 if(settings.ignore) { 63 ignoreList = ignoreList + ', ' + settings.ignore; 64 } 65 66 var $allVideos = $(this).find(selectors.join(',')); 67 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 68 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 69 70 $allVideos.each(function(){ 71 var $this = $(this); 72 if($this.parents(ignoreList).length > 0) { 73 return; // Disable FitVids on this video. 74 } 75 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 76 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 77 { 78 $this.attr('height', 9); 79 $this.attr('width', 16); 80 } 81 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 82 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 83 aspectRatio = height / width; 84 if(!$this.attr('name')){ 85 var videoName = 'fitvid' + $.fn.fitVids._count; 86 $this.attr('name', videoName); 87 $.fn.fitVids._count++; 88 } 89 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%'); 90 $this.removeAttr('height').removeAttr('width'); 91 }); 92 }); 93 }; 94 95 // Internal counter for unique video names. 96 $.fn.fitVids._count = 0; 97 98// Works with either jQuery or Zepto 99})( window.jQuery || window.Zepto );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.