1$ = jQuery; 2 3$(function () { 4 videos.init(); 5}); 6 7var videos = { 8 9 init: function () { 10 11 // collapses the video transcript to height set in css, adds button to reveal full transcript 12 var $vt = $('.video_transcript'); 13 var btn_class = 'vc_general vc_btn3 vc_btn3-size-md vc_btn3-shape-square vc_btn3-style-flat vc_btn3-color-green'; 14 var hide_tpl = '<div class="read_hide"><a href="#">Hide Transcript</a></div>'; 15 16 $vt.prepend(hide_tpl) 17 .append(hide_tpl.replace('read_hide', 'read_hide bottom')) 18 .append('<div class="read_show"><a class="' + btn_class + '">Show Transcript</a></div>') 19 .find('.read_show a').on('click', function () { 20 21 var $this = $(this); 22 var $block = $this.closest('.video_transcript'); 23 var $p = $block.find('p'); 24 25 var h = 0; 26 $p.each(function () { 27 h += $(this).outerHeight(true); 28 }); 29 30 $block 31 .css({ 32 'height': $block.height(), 33 'max-height': 'none' 34 }) 35 .animate({ 36 'height': h 37 }, 500, function () { 38 $(this) 39 .css({ 40 'overflow': 'unset' 41 }) 42 .find('.read_show').css({ 43 'display': 'none' 44 }); 45 46 }); 47 48 }); 49 50 $vt.find('.read_hide a').on('click', function (e) { 51 e.preventDefault(); 52 53 var $this = $(this); 54 var $block = $this.closest('.video_transcript'); 55 56 $block 57 .css({ 58 'height': '', 59 'max-height': '', 60 'overflow': '', 61 }) 62 .find('.read_show').css({ 63 'display': '' 64 }); 65 }); 66 67 // convert :30 - Title in Wordpress to on click action to start video and show bubble 68 $('.video_quicklinks .vtime_play, .video_quicklinks .vtime_display').each(function () { 69 var $this = $(this); 70 var classes = $this.attr('class').split(' '); 71 var time_sec = 0; 72 73 // find vtime_000 and set time_sec 74 for (var i = 0; i < classes.length; i++) { 75 var cl = classes[i]; 76 if (cl.substring(0, 11) == 'vtime_mark-' && cl != 'vtime_display' && cl != 'vtime_play') { 77 t = cl.split('-'); 78 time_sec = (isNaN(t[1])) ? 0 : t[1]; 79 break; 80 } 81 } 82 83 // add time_buble to h4 > a, add video start_at attribute to a tag for on click below 84 if (time_sec > 0) { 85 var min = Math.floor(time_sec / 60); 86 var sec = (time_sec - (min * 60)); 87 sec = (sec.toString().length == 1) ? '0' + sec : sec; 88 var time = min + ':' + sec; 89 90 var $tag = $this.find('h4 span'); 91 html = '<time>' + time + '</time> ' + $tag.html(); 92 $tag.html(html) 93 94 $this.find('h4 a').attr('start_at', time_sec); 95 } 96 97 }); 98 99 // ensure any external links pop to new tab, add target 100 $('.video_quicklinks a').each(function () { 101 var $this = $(this); 102 var link = $this.attr('href'); 103 104 if (link.substring(0, 4) == 'http') $this.attr('target', '_blank'); 105 }); 106 107 // create on click action for video vtime_play using autoplay start time 108 // does not work for mobile since YouTube doesn't allow for autoplay in mobile 109 $('.video_quicklinks .vtime_play a').on('click', function (e) { 110 e.preventDefault(); 111 112 var start_at = $(this).attr('start_at'); 113 114 $('.video-container iframe').each(function () { 115 var $iframe = $(this); 116 var src = $iframe.attr('src'); 117 src = src.split('?'); 118 119 var qs = []; 120 var params = src[1].split('&'); 121 for (var i = 0; i < params.length; i++) { 122 var p = params[i].split('='); 123 if (p[0] != 'start' && p[0] != 'autoplay') { 124 qs.push(params[i]); 125 } 126 } 127 qs.push('start=' + start_at); 128 qs.push('autoplay=1'); 129 130 src = src[0] + '?' + qs.join('&'); 131 132 var top = $('.wpb_video_widget').offset().top - 100; 133 $('html, body').animate({ 134 'scrollTop': top + 'px' 135 }, 500, function () { 136 $iframe.attr('src', src); 137 }); 138 139 }); 140 141 }); 142 143 } 144}
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.