1(function($) { 2 "use strict"; 3 4 UNCODE.backgroundSelfVideos = function( $ctx ) { 5 6 var backgroundSelfVideosInit = function( $ctx ) { 7 if ( SiteParameters.block_mobile_videos === true ) { 8 return false; 9 } 10 if (typeof MediaElement === "function") { 11 if ( typeof $ctx === 'undefined' ) { 12 $ctx = document; 13 } 14 15 $(".background-video-shortcode", $ctx).each(function(index, el) { 16 if ( $(this).closest('mediaelementwrapper').length ) { 17 return true; 18 } 19 var $video_el = $(this), 20 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 21 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 22 video_id = $video_el.attr('id'); 23 24 if ( SiteParameters.is_frontend_editor ) { 25 video_id = video_id + '_' + index; 26 $video_el.attr('id', video_id); 27 } 28 29 var media = new MediaElement(video_id, { 30 startVolume: 0, 31 loop: true, 32 success: function(mediaElement, domObject) { 33 domObject.volume = 0; 34 $(mediaElement).data('started', false); 35 mediaElement.addEventListener('timeupdate', function(e) { 36 if (!$(e.target).data('started')) { 37 $(mediaElement).data('started', true); 38 } 39 }); 40 mediaElement.addEventListener('loadedmetadata', function(e) { 41 $('body').removeClass('video-not-supported'); 42 mediaElement.play(); 43 }); 44 if (!UNCODE.isMobile) { 45 requestTimeout(function() { 46 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 47 }, 100); 48 } 49 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 50 mediaElement.play(); 51 } 52 53 if ( $parent_drop_move.length ) { 54 var setResizeMEto, 55 resizeMediaElement = function(){ 56 var dataW = $parent_drop_move.attr('data-w'), 57 videoW = domObject.width, 58 videoH = domObject.height, 59 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 60 newH = newW / ( videoW / videoH ); 61 62 $(domObject).css({ 63 'height': newH, 64 'width': newW 65 }); 66 }; 67 $(window).on( 'resize load', function(){ 68 clearRequestTimeout(setResizeMEto); 69 setResizeMEto = requestTimeout( function() { 70 resizeMediaElement(); 71 }, 10 ); 72 }); 73 } 74 75 mediaElement.addEventListener('play', function() { 76 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 77 $(mediaElement).closest('#page-header').addClass('video-started'); 78 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 79 }, true); 80 81 }, 82 // fires when a problem is detected 83 error: function() {} 84 }); 85 }); 86 } else { 87 88 if ( typeof $ctx === 'undefined' ) { 89 $ctx = document; 90 } 91 92 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 93 Array.from(videos).forEach(function(video_el) { 94 video_el.addEventListener('loadedmetadata', function(e) { 95 $('body').removeClass('video-not-supported'); 96 video_el.play(); 97 }); 98 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 99 video_el.muted = true; 100 video_el.loop = true; 101 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 102 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 103 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 104 $('body').removeClass('video-not-supported'); 105 video_el.play(); 106 } else { 107 requestTimeout(function(){ 108 backgroundSelfVideosInit( $ctx ); 109 }, 1000); 110 } 111 }); 112 } 113 }; 114 115 backgroundSelfVideosInit( $ctx ); 116 117 $(document).on('un-menu-show', function(){ 118 setTimeout(function(){ 119 UNCODE.initVideoComponent(document.body, '.un-submenu .uncode-video-container.video:not(.drop-move):not(.fluid-object), .un-submenu .uncode-video-container.self-video:not(.drop-move)'); 120 }, 1); 121 }); 122 123 124 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 125 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 126 var $el = model.view.$el, 127 shortcode = model.attributes.shortcode; 128 129 if (typeof MediaElement === "function") { 130 backgroundSelfVideosInit( $el ); 131 } else { 132 backgroundSelfVideosInit( $el[0] ); 133 } 134 }); 135 } 136}; 137 138 139})(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.