1(function (component) { 2 const videoIOOptions = { 3 threshold: 0 4 } 5 6 component.init = init; 7 8 $(() => { 9 init(); 10 }); 11 12 function init() { 13 console.log('Elo Video initialized'); 14 $('[data-video-info]').each(function () { 15 var elem = $(this); 16 var videoType = elem.attr('data-video-type'); 17 var videoCode = elem.attr('data-video-code'); 18 var videoCodeFull = elem.attr('data-video-code-full'); 19 var videoControls = elem.attr('data-video-controls') == 'true'; 20 var videoUrl = elem.attr('data-video-url'); 21 var videoUrlFull = elem.attr('data-video-url-full'); 22 var videoEmbed = elem.find('[data-name="embed-preview"]').html().replace('<!--', '').replace('-->', ''); 23 var videoEmbedFull = elem.find('[data-name="embed-detail"]').html().replace('<!--', '').replace('-->', ''); 24 var videoShowModal = elem.attr('data-video-showmodal') == 'true' || elem.attr('data-video-showmodal') == 'True'; 25 console.log('Video type: ' + videoType); 26 27 //verifico se c'è il placeholder dell'immagine o meno, nel qual caso imposto il video 28 if (elem.parent().find('[data-video-sentinel]').length > 0) { 29 var videoIO = new IntersectionObserver((entries) => { 30 entries.forEach((entry) => { 31 if (entry.intersectionRatio > 0) { 32 var elemx = $(entry.target); 33 if (elemx.attr('data-loaded') == 'true') return; 34 35 console.log('loading video..') 36 37 var container = elemx.parent().find('[data-video-container]'); 38 var html = ''; 39 40 switch (videoType) { 41 //vimeo o youtube 42 case '1': 43 case '2': 44 case 'YouTube': 45 case 'Vimeo': 46 var videoSrc = '' 47 if (videoType == '1' || videoType == 'YouTube') 48 videoSrc = 'https://www.youtube.com/embed/' + videoCode + '?autoplay=1&mute=1&' + (videoControls == '1' ? 'controls=1' : 'controls=0&disablekb=1') + '&showinfo=0&autohide=1&modestbranding=1&mute=1&enablejsapi=1&widgetid=1'; 49 else 50 videoSrc = 'https://player.vimeo.com/video/' + videoCode + '?autoplay=1&loop=1&title=0&byline=0&portrait=0&muted=1&' + (videoControls == '1' && !videoShowModal ? 'controls=1' : 'controls=0&keyboard=0') + '&sidedock=0'; 51 html = '<iframe ' + (videoControls == '1' ? '' : 'class=playerNoControls') + ' title="Video" style="width: 100%; height: 100%;" class="embed-responsive-item" src="' + videoSrc + '" frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"></iframe>'; 52 break; 53 //video locale 54 case '4': 55 case 'Local': 56 html = '<video class="w-100 h-auto object-fit-cover" ' + (videoControls == '1' ? 'controls muted ' + (videoShowModal ? '' : 'autoplay') : (videoShowModal ? '' : 'autoplay') + ' loop muted playsinline') + '><source src="' + videoUrl + '" type="video/mp4">Your browser does not support the video tag.</video>'; 57 break; 58 case '8': 59 case 'Embed': 60 html = videoEmbed; 61 break; 62 } 63 console.log(html) 64 container.html(html); 65 console.log('..video loaded') 66 67 elemx.attr('data-loaded', 'true'); 68 } 69 }); 70 }, videoIOOptions); 71
72 videoIO.observe(elem.parent().find('[data-video-sentinel]')[0]); 73 } 74 75 //verifico se c'è il pulsante di play 76 if (elem.parent().find('[data-video-open]').length > 0) { 77 elem.parent().find('[data-video-open]').click(function () { 78 var html = ''; 79 80 switch (videoType) { 81 //vimeo o youtube 82 case '1': 83 case '2': 84 case 'YouTube': 85 case 'Vimeo': 86 var videoSrc = '' 87 if (videoType == '1' || videoType == 'YouTube') 88 videoSrc = 'https://www.youtube.com/embed/' + (videoCodeFull != undefined && videoCodeFull != '' ? videoCodeFull : videoCode) + '?autoplay=1&loop=0&controls=1&showinfo=1&autohide=1&modestbranding=1&mute=0&enablejsapi=1&widgetid=1'; 89 else 90 videoSrc = 'https://player.vimeo.com/video/' + (videoCodeFull != undefined && videoCodeFull != '' ? videoCodeFull : videoCode) + '?autoplay=1&loop=1&title=0&byline=0&portrait=0&muted=0&' + (videoControls == '1' ? 'controls=1' : 'controls=0&keyboard=0') + '&sidedock=0'; 91 html = '<iframe ' + (videoControls == '1' ? '' : 'class=playerNoControls') + ' title="Video" style="width: 100%; height: 100%;" class="embed-responsive-item" src="' + videoSrc + '" frameborder="0" allowfullscreen="1" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"></iframe>'; 92 break; 93 //video locale 94 case '4': 95 case 'Local': 96 html = '<video class="w-100 h-auto object-fit-cover" ' + (videoControls == '1' ? 'controls autoplay' : 'autoplay loop playsinline') + '><source src="' + (videoUrlFull != undefined && videoUrlFull != '' ? videoUrlFull : videoUrl) + '" type="video/mp4">Your browser does not support the video tag.</video>'; 97 break; 98 case '8': 99 case 'Embed': 100 html = videoEmbedFull; 101 break; 102 } 103 $('[data-video-modal] [data-video-player-div]').html(html); 104 $('[data-video-modal] .video-yt').removeClass('d-none'); 105 window.$eloGlobal.openGlobalModal(); 106 }); 107 } 108 }); 109 } 110}(window.$eloVideo = window.$eloVideo || {}));
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.