1(function ($) { 2 var alert = 0; 3 $('body').on('click', '.start-video', function () { 4 var id = 'v' + Math.random().toString(36).substring(7), video_wrapper = $(this).closest('.yt-video-place'), 5 h = video_wrapper.width() * 3 / 5, 6 vid = document.createElement('div'), playNxt = $('#hpp_mPlayNxt'); 7 video_wrapper.height(h); 8 $(this).closest('.video-fit.video').removeClass('lazy-vd'); //flatsome ux_video.php 9 //_HWIO.detectMob()? 'height:150px':'height:300px' 10 if (playNxt.length == 0) { 11 playNxt = $('<div id="hpp_mPlayNxt"></div>'); 12 playNxt.html('<div class="cover"></div><div class="yt-video-place embed-responsive">' + video_wrapper.html() + '</div>'); 13 playNxt.find('.start-video').click(function () { 14 playNxt.data('pl').playVideo(); 15 playNxt.hide(); 16 video_wrapper[0].scrollIntoView(); 17 }); 18 playNxt.hide().appendTo('body'); 19 } else playNxt.find('img:eq(0)').attr('src', video_wrapper.find('img:eq(0)').attr('src')); 20 21 video_wrapper.empty().append(vid); 22 var player = function () { 23 if (typeof YT == 'object') { 24 var _player = new YT.Player(vid, { 25 height: h + 'px', 26 width: '100%', 27 videoId: video_wrapper.data('yt-url').replace(/\?.+/g, '').replace('https://www.youtube.com/embed/', ''), 28 controls: 1, 29 loop: 1, 30 events: { 31 onReady: function (event) { 32 //_player.setPlaybackRate(2); 33 event.target.playVideo(); 34 playNxt.data('pl', event.target); 35 var pl = event.target; 36 setTimeout(function () { 37 pl.playVideo(); 38 }, 1000) //if safari, try a least 1s 39 if (alert) setTimeout(function () { 40 //hit(event.data==YT.PlayerState.PLAYING); 41 if ([YT.PlayerState.PLAYING, YT.PlayerState.BUFFERING].indexOf(window.ytevt.data) === -1) { 42 playNxt.show(); 43 } 44 }, 2000); 45 }, 46 onStateChange: function (event) { 47 window.ytevt = event;//_player.stopVideo(); //test 48 if (event.data == YT.PlayerState.ENDED) { 49 _player.seekTo(0); 50 } 51 } 52 } 53 }); 54 } else video_wrapper.html('<iframe id="' + id + '" allowfullscreen frameborder="0" width="100%" style="height:' + (h) + 'px !important" src="' + video_wrapper.data('yt-url') + '"></iframe>'); 55 }; 56 if (typeof YT == 'object') player(); else _HWIO.waitForExist(player, 'YT'); 57 }); 58})(jQuery); // EOF
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.