vendor: 3,184 bytes, lines 1-90
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('div'), 20 ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; 21 22 div.className = 'fit-vids-style'; 23 div.innerHTML = '­<style> \ 24 .fluid-width-video-wrapper { \ 25 width: 100%; \ 26 position: relative; \ 27 padding: 0; \ 28 } \ 29 \ 30 .fluid-width-video-wrapper iframe, \ 31 .fluid-width-video-wrapper object, \ 32 .fluid-width-video-wrapper embed { \ 33 position: absolute; \ 34 top: 0; \ 35 left: 0; \ 36 width: 100%; \ 37 height: 100%; \ 38 } \ 39 </style>'; 40 41 ref.parentNode.insertBefore(div,ref); 42 43 if ( options ) { 44 $.extend( settings, options ); 45 } 46 47 return this.each(function(){ 48 var selectors = [ 49 "iframe[src^='http://player.vimeo.com']", 50 "iframe[src^='http://www.youtube.com']", 51 "iframe[src^='https://www.youtube.com']", 52 "iframe[src^='http://www.kickstarter.com']", 53 "iframe[src^='http://www.funnyordie.com']", 54 "iframe[src^='http://media.mtvnservices.com']", 55 "iframe[src^='http://trailers.apple.com']", 56 "iframe[src^='http://www.brightcove.com']", 57 "iframe[src^='http://blip.tv']", 58 "iframe[src^='http://break.com']", 59 "iframe[src^='http://www.traileraddict.com']", 60 "iframe[src^='http://d.yimg.com']", 61 "iframe[src^='http://movies.yahoo.com']", 62 "iframe[src^='http://www.dailymotion.com']", 63 "iframe[src^='http://s.mcstatic.com']", 64 "object", 65 "embed" 66 67 ]; 68 69 if (settings.customSelector) { 70 selectors.push(settings.customSelector); 71 } 72 73 var $allVideos = $(this).find(selectors.join(',')); 74 75 $allVideos.each(function(){ 76 var $this = $(this); 77 if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 78 var height = this.tagName.toLowerCase() == 'object' ? $this.attr('height') : $this.height(), 79 aspectRatio = height / $this.width(); 80 if(!$this.attr('id')){ 81 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 82 $this.attr('id', videoID); 83 } 84 $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); 85 $this.removeAttr('height').removeAttr('width'); 86 }); 87 }); 88 89 } 90})( 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.