vendor: 2,639 bytes, lines 1-78
1/*global jQuery */ 2/*! 3* FitVids 1.0 4* 5* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com 6* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 7* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 8* 9* Date: Thu Sept 01 18:00:00 2011 -0500 10*/ 11 12(function( $ ){ 13 14 $.fn.fitVids = function( options ) { 15 var settings = { 16 customSelector: null 17 } 18 19 var div = document.createElement('style'), 20 ref = document.getElementsByTagName('head')[0]; 21 22 div.innerHTML = ' \ 23 .fluid-width-video-wrapper { \ 24 width: 100%; \ 25 position: relative; \ 26 padding: 0; \ 27 } \ 28 \ 29 .fluid-width-video-wrapper iframe, \ 30 .fluid-width-video-wrapper object, \ 31 .fluid-width-video-wrapper embed { \ 32 position: absolute; \ 33 top: 0; \ 34 left: 0; \ 35 width: 100%; \ 36 height: 100%; \ 37 } \ 38 '; 39 40 ref.appendChild(div,ref); 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*='www.youtube.com']", 50 "iframe[src*='www.kickstarter.com']", 51 "object", 52 "embed" 53 ]; 54 55 if (settings.customSelector) { 56 selectors.push(settings.customSelector); 57 } 58 59 var $allVideos = $(this).find(selectors.join(',')).not('object[name*="player"]'); 60 61 62 $allVideos.each(function(){ 63 var $this = $(this); 64 if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 65 var height = ( this.tagName.toLowerCase() == 'object' || $this.attr('height') ) ? $this.attr('height') : $this.height(), 66 width = $this.attr('width') ? $this.attr('width') : $this.width(), 67 aspectRatio = height / width; 68 if(!$this.attr('id')){ 69 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 70 $this.attr('id', videoID); 71 } 72 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); 73 $this.removeAttr('height').removeAttr('width'); 74 }); 75 }); 76 77 } 78})( jQuery );
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.