1 2 3;(function( $ ){ 4 5 'use strict'; 6 7 $.fn.fitVids = function( options ) { 8 var settings = { 9 customSelector: null, 10 ignore: null 11 }; 12 13 if(!document.getElementById('fit-vids-style')) { 14 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 15 var head = document.head || document.getElementsByTagName('head')[0]; 16 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%;}'; 17 var div = document.createElement("div"); 18 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 19 head.appendChild(div.childNodes[1]); 20 } 21 22 if ( options ) { 23 $.extend( settings, options ); 24 } 25 26 return this.each(function(){ 27 var selectors = [ 28 'iframe[src*="player.vimeo.com"]', 29 'iframe[src*="youtube.com"]', 30 'iframe[src*="youtube-nocookie.com"]', 31 'iframe[src*="kickstarter.com"][src*="video.html"]', 32 'object', 33 'embed' 34 ]; 35 36 if (settings.customSelector) { 37 selectors.push(settings.customSelector); 38 } 39 40 var ignoreList = '.fitvidsignore'; 41 42 if(settings.ignore) { 43 ignoreList = ignoreList + ', ' + settings.ignore; 44 } 45 46 var $allVideos = $(this).find(selectors.join(',')); 47 $allVideos = $allVideos.not('object object'); // SwfObj conflict patch 48 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 49 50 $allVideos.each(function(count){ 51 var $this = $(this); 52 if($this.parents(ignoreList).length > 0) { 53 return; // Disable FitVids on this video. 54 } 55 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 56 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 57 { 58 $this.attr('height', 9); 59 $this.attr('width', 16); 60 } 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' + count; 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 );
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.