1/*jshint browser:true */ 2/*! 3* FitVids 1.1 4* Copyright 2013, Chris Coyier - https://css-tricks.com + Dave Rupert - http://daverupert.com 5* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/ 6* Released under the WTFPL license - http://sam.zoy.org/wtfpl/ 7* 8*/ 9$ = jQuery; 10!(function(t) { 11 "use strict"; 12 (t.fn.fitVids = function(e) { 13 var i = { customSelector: null, ignore: null }; 14 if (!document.getElementById("fit-vids-style")) { 15 var r = document.head || document.getElementsByTagName("head")[0], 16 a = 17 ".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%;}", 18 d = document.createElement("div"); 19 20 (d.innerHTML = '<p>x</p><style id="fit-vids-style">' + a + "</style>"), 21 r.appendChild(d.childNodes[1]); 22 } 23 return ( 24 e && t.extend(i, e), 25 this.each(function() { 26 var e = [ 27 'iframe[src*="player.vimeo.com"]', 28 'iframe[src*="youtube.com"]', 29 'iframe[src*="youtube-nocookie.com"]', 30 'iframe[src*="kickstarter.com"][src*="video.html"]', 31 "object", 32 "embed" 33 ]; 34 i.customSelector && e.push(i.customSelector); 35 var r = ".fitvidsignore"; 36 i.ignore && (r = r + ", " + i.ignore); 37 var a = t(this).find(e.join(",")); 38 (a = a.not("object object")), 39 (a = a.not(r)), 40 a.each(function() { 41 var e = t(this); 42 if ( 43 !( 44 e.parents(r).length > 0 || 45 ("embed" === this.tagName.toLowerCase() && 46 e.parent("object").length) || 47 e.parent(".fluid-width-video-wrapper").length 48 ) 49 ) { 50 e.css("height") || 51 e.css("width") || 52 (!isNaN(e.attr("height")) && !isNaN(e.attr("width"))) || 53 (e.attr("height", 9), e.attr("width", 16)); 54 var i = 55 "object" === this.tagName.toLowerCase() || 56 (e.attr("height") && !isNaN(parseInt(e.attr("height"), 10))) 57 ? parseInt(e.attr("height"), 10) 58 : e.height(), 59 a = isNaN(parseInt(e.attr("width"), 10)) 60 ? e.width() 61 : parseInt(e.attr("width"), 10), 62 d = i / a; 63 if (!e.attr("name")) { 64 var o = "fitvid" + t.fn.fitVids._count; 65 e.attr("name", o), t.fn.fitVids._count++; 66 } 67 e 68 .wrap('<div class="fluid-width-video-wrapper"></div>') 69 .parent(".fluid-width-video-wrapper") 70 .css("padding-top", 100 * d + "%"), 71 e.removeAttr("height").removeAttr("width"); 72 } 73 }); 74 }) 75 ); 76 }), 77 (t.fn.fitVids._count = 0); 78})(window.jQuery || window.Zepto); 79 80 81/* This is what makes the videos responsive. You can either include this in a <script> tag in the markup, or better yet, include it in a separata JavaScript file.*/ 82$(function() { 83 84 //hide iframe and display youtube banner image on click 85 $('.af-custom-thumbnail').on('click',function(){ 86 $('.af-hide-iframe').addClass('af-display-iframe'); 87 if($('.fluid-width-video-wrapper').length > 0){ 88 $('.fluid-width-video-wrapper').addClass('af-iframe-added'); 89 } 90 91 $('#vid_frame').removeAttr('src'); 92 $('.af-video-wrap').removeAttr('data-video-link'); 93 var selected_vdo_link = $(this).data('video'); 94 $('.af-video-wrap').attr('data-video-link', selected_vdo_link); 95 var img = $(this).data('item'); 96 $('.af-video-wrap').css('background-image', 'url(' + img + ')'); 97 $('.af-video-wrap').css('padding-top', '50%'); 98 // 99 100 101 }); 102 103 $('.af-video-wrap').on('click',function(){ 104 $('#vid_frame').removeAttr('src'); 105 $('.af-hide-iframe').removeClass('af-display-iframe'); 106 $('.fluid-width-video-wrapper').removeClass('af-iframe-added'); 107 108 $(this).css('padding-top',0); 109 var video_link = $(this).attr('data-video-link'); 110 111 $('#vid_frame').attr('src', video_link); 112 $(".vid-container").fitVids(); 113 }); 114 115}); 116 117/*JS FOR SCROLLING THE ROW OF THUMBNAILS*/ 118 119$(document).ready(function() { 120 var active_banner = $('.first_thb_img').data('item'); 121 var first_video = $('.first_thb_img').data('video'); 122 $('.af-video-wrap').css('padding-top', '50%'); 123 $('.af-hide-iframe').addClass('af-display-iframe'); 124 125 $('.af-video-wrap').css('background-image', 'url(' + active_banner + ')'); 126 $('.af-video-wrap').attr('data-video-link', first_video); 127 128 $(".vid-item").each(function(index) { 129 $(this).on("click", function() { 130 var current_index = index + 1; 131 $(".vid-item .thumb").removeClass("active"); 132 $(".vid-item:nth-child(" + current_index + ") .thumb").addClass("active"); 133 }); 134 }); 135});
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.