1/*global jQuery */ 2/*jshint browser:true */ 3/*! 4* FitVids 1.1 5* 6* Copyright 2013, 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*/ 11 12(function( $ ){ 13 14 "use strict"; 15 16 $.fn.fitVids = function( options ) { 17 var settings = { 18 customSelector: null, 19 ignore: true 20 }; 21 22 if(!document.getElementById('fit-vids-style')) { 23 // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js 24 var head = document.head || document.getElementsByTagName('head')[0]; 25 var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0; aspect-ratio: calc(1 / 0.53);}.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%;}'; 26 var div = document.createElement('div'); 27 div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>'; 28 head.appendChild(div.childNodes[1]); 29 } 30 31 if ( options ) { 32 $.extend( settings, options ); 33 } 34 35 return this.each(function(){ 36 var selectors = [ 37 "iframe[src*='player.vimeo.com']", 38 "iframe[src*='youtube.com']", 39 "iframe[src*='youtube-nocookie.com']", 40 "iframe[src*='dailymotion.com']", 41 "iframe[src*='vine.co']", 42 "iframe[src*='soundcloud.com']", 43 "iframe[src*='metacafe.com']", 44 "iframe[src*='kickstarter.com'][src*='video.html']", 45 "iframe[src*='tv.kakao.com']", 46 "iframe[src*='serviceapi.rmcnmv.naver.com']", 47 "object", 48 "embed" 49 ]; 50 51 if (settings.customSelector) { 52 selectors.push(settings.customSelector); 53 } 54 55 var ignoreList = '.fitvidsignore, .fr-video'; 56 57 if(settings.ignore) { 58 ignoreList = ignoreList + ', ' + settings.ignore; 59 } 60 61 var $allVideos = $(this).find(selectors.join(',')); 62 $allVideos = $allVideos.not("object object"); // SwfObj conflict patch 63 $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video. 64 $allVideos.each(function(){ 65 var $this = $(this); 66 $this.attr('allowfullscreen','true').attr('webkitallowfullscreen','true').attr('mozallowfullscreen','true'); 67 if($this.parents(ignoreList).length > 0) { 68 return; // Disable FitVids on this video. 69 } 70 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 71 if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width')))) 72 { 73 $this.attr('height', 9); 74 $this.attr('width', 16); 75 } 76 var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(), 77 width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(), 78 aspectRatio = height / width; 79 80 if(!$this.attr('id')){ 81 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 82 $this.attr('id', videoID); 83 } 84 85 var checkThumbVideo = ($this.parents('.element').attr('data-mode')=='thumb' && ($this.parents('.element').attr('data-playtype')=="true")) ? true : false, 86 pdheight = (checkThumbVideo) ? '' : aspectRatio * 100 + 6.3; 87 $this.wrap('<div class="fluid-width-video-wrapper"></div>'); 88 // $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-bottom', (Math.round(aspectRatio * 100 + 6.3)+0.2)+"%"); 89 $this.removeAttr('height').removeAttr('width'); 90 91 }); 92 }); 93 }; 94// Works with either jQuery or Zepto 95})( 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.