1/** 2 * Created by thujer on 14.10.16. 3 */ 4 5$(function() { 6 7 //var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com'], object, embed"); 8 var $allVideos = $("iframe[src^='//www.youtube.com']"); 9 var $fluidEl = $("body"); 10 11 12 $allVideos.each(function(e) { 13 14 //console.log($(this).parent().html()) 15 16 var w = $(this).attr('width'); 17 var h = $(this).attr('height'); 18 19 $(this).attr('width', '100%'); 20 $(this).attr('height', '100%'); 21 22 var pw = $(this).parent().width(); 23 24 if(pw < 500) { 25 pw = 226; 26 h = 160; 27 } 28 29 var s_original_html = $(this).parent().html(); 30 $(this).parent().html('<div class="video-container" style="width='+pw+'px; height: '+h+'px">' + s_original_html + '</div>'); 31 32 33 }); 34 35 /* 36 var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com'], object, embed"), 37 $fluidEl = $("body"); 38 39 40 $allVideos.each(function() { 41 42 var w = this.width || 700; 43 var h = this.height || 400; 44 45 console.log($(this).attr('src'), h, w); 46 47 $(this) 48 // jQuery .data does not work on object/embed elements 49 .attr('data-aspectRatio', h / w) 50 .removeAttr('height') 51 .removeAttr('width'); 52 53 }); 54 55 $(window).resize(function() { 56 57 var newWidth = $fluidEl.width(); 58 $allVideos.each(function() { 59 60 var $el = $(this); 61 console.log(newWidth, $el.attr('data-aspectRatio')) 62 $el.width(newWidth) 63 $el.height(newWidth * $el.attr('data-aspectRatio')); 64 65 }); 66 67 }).resize(); 68 69 /* 70 71// Find all YouTube videos - RESIZE YOUTUBE VIDEOS!!! 72 var $allVideos = $("iframe[src^='https://www.youtube.com']"), 73 74// The element that is fluid width 75 $fluidEl = $("body"); 76 77// Figure out and save aspect ratio for each video 78 $allVideos.each(function() { 79 80 $(this) 81 .data('aspectRatio', this.height / this.width) 82 83 // and remove the hard coded width/height 84 .removeAttr('height') 85 .removeAttr('width'); 86 87 }); 88 89// When the window is resized 90 $(window).resize(function() { 91 92 var newWidth = $fluidEl.width(); 93 94 // Resize all videos according to their own aspect ratio 95 $allVideos.each(function() { 96 97 var $el = $(this); 98 $el 99 .width(newWidth) 100 .height(newWidth * $el.data('aspectRatio')); 101 102 }); 103 104// Kick off one resize to fix all videos on page load 105 }).resize(); 106 107// END RESIZE VIDEOS 108*/ 109 110}); 111
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.