1(function ($) { 2 var $popups = $('.wp-video-popup-wrapper'); 3 var speed = 200; 4 5 function init() { 6 if (!$popups.length) return; 7 setupOpenActions(); 8 setupVideoHeight(); 9 setupCloseActions(); 10 } 11 12 function setupOpenActions() { 13 // Setup trigger for single popup. 14 $('.wp-video-popup').on('click', function (e) { 15 e.preventDefault(); 16 openPopup($popups); 17 }); 18 19 // Setup trigger for single popup (backward compatibility support). 20 $('.ryv-popup').on('click', function (e) { 21 e.preventDefault(); 22 openPopup($popups); 23 }); 24 } 25 26 function setupCloseActions() { 27 // Close on click. 28 $popups.click(function (e) { 29 if (e.target == this || e.target.classList.contains('wp-video-popup-close')) closePopup($(this)); 30 }); 31 32 // Close on escape. 33 $(document).keyup(function (e) { 34 if (e.which != 27) return; 35 if ($popups.is(':visible')) closePopup($popups); 36 }); 37 } 38 39 function setupVideoHeight() { 40 $(window).on('resize', function () { 41 var $video = $('.wp-video-popup-video'); 42 43 $video.height($video.width() * 0.5625); 44 }); 45 } 46 47 function openPopup($popup) { 48 var $video = $popup.find('.wp-video-popup-video'); 49 50 $popup.prependTo('body'); 51 52 $popup.css({ display: 'flex' }).stop().animate({ 53 opacity: 1 54 }, speed); 55 56 $video.stop().fadeIn(speed); 57 $video.attr("src", $video.attr('data-wp-video-popup-url')); 58 59 $(window).trigger('resize'); 60 } 61 62 function closePopup($popup) { 63 var $video = $popup.find('.wp-video-popup-video'); 64 65 $popup.stop().animate({ 66 opacity: 0 67 }, speed, function () { 68 $popup.css({ display: 'none' }); 69 }); 70 71 $video.stop().fadeOut(speed, function () { 72 $video.attr('src', ''); 73 }); 74 } 75 76 init(); 77})(jQuery);
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.