ЗСД Фонтанка Фест

→ Оригинал (без защиты от корпорастов)

` : ''}

`); let v = $e.find('video')[0], f = function() { annexxAddStyle('011','.' + e.className.replace(/\s+/g,'.') + ' {display:table;}'); let $removeelementload = $(''); if ($removeelementload.length) $('').remove(); window.arrAnnexxVideoTooltip.push({'el': $e.find('video')[0], 'service': 'direct','modtype': '011', 'playElClick': d, 'buttonMute': 'no','actionPlayAnotherVideo': actionPlayAnotherVideo,'actionOpenPopup': actionOpenPopup, 'actionCloseTab': 'mute,pause'.split(','), elements: {shapePlayClick: $shapePlayClick, shapePlayHover: $shapePlayHover,shapePauseClick: $shapePauseClick, shapePauseHover: $shapePauseHover, shapeUnmuteClick: $shapeUnmuteClick, shapeMuteClick: $shapeMuteClick, shapeMuteHover: $shapeMuteHover, shapeUnmuteHover: $shapeUnmuteHover}, 'switchElementMuteUnmute': switchElementMuteUnmute, function: {playV: playV, pauseV: pauseV, mute: mute}}); ll--; if (!ll) resolve(); if (userFunctionNameEnd) { v.addEventListener('ended', function() { window.arrAnnexxVideoTooltip.userFunction.forEach(function(e) { if (e === userFunctionNameEnd) window[e](); }); }); } if (autoplay){ v.muted = true; function pl() { try { v.play(); } catch (e) {} } pl(); setTimeout(pl,1e3); } v.removeEventListener('canplay', f); function showElemOnplay() { if ($showElemOnplay) { $showElemOnplay.removeClass('hide-elem-onplay'); } if ($hideElemOnplay) { $hideElemOnplay.addClass('hide-elem-onplay'); } if (false) { this.removeEventListener('play',showElemOnplay); this.removeEventListener('pause',hideElemOnplay); } if ($previewvideo) { $previewvideo.addClass("hide-preload-shape"); if (!previewOnPause) $previewvideo = false; } } function hideElemOnplay() { if ($showElemOnplay) { $showElemOnplay.addClass('hide-elem-onplay'); } if ($hideElemOnplay) { $hideElemOnplay.removeClass('hide-elem-onplay'); } if ($previewvideo) { $previewvideo.removeClass("hide-preload-shape"); } } function showElemOnend() { if ($showElemOnend) { $showElemOnend.removeClass('show-elem-onend'); } this.removeEventListener('ended', showElemOnend); } v.addEventListener('play', showElemOnplay); v.addEventListener('pause', function() { if (!this.closest(".t396__elem").classList.contains("hide-elem-onplay")) hideElemOnplay(); }); v.addEventListener('ended', showElemOnend); /* После обновления стал скакать зум видео */ /* $tnatom.css('zoom','inherit'); */ setTimeout(function() { $tnatom.css('zoom',''); window.dispatchEvent(new CustomEvent('resize')); v.addEventListener('webkitfullscreenchange', function(e) { let fullscreen = e.target.webkitDisplayingFullscreen !== undefined ? e.target.webkitDisplayingFullscreen : 'nowebkit'; if (fullscreen !== 'nowebkit') { if (fullscreen) {v.style.objectFit = 'contain';} else {v.style.objectFit = '';} } }); },200); }; if (true) { v.addEventListener('canplay', f); } else { v.addEventListener('loadedmetadata', f); v.muted = true; } if ('rgba(0, 0, 0, 0)' !== 'rgba(0, 0, 0, 0)') { e.querySelector('.tn-atom').insertAdjacentHTML('afterBegin','

'); } if (switchElementShowOnhoverVideo && $shapePlayClick && $shapePlayClick.length && $shapePauseClick && $shapePauseClick.length) { let timeout, firstHover = false; function mousemoveShow() { if (false && false&& !firstHover) { firstHover = true; $shapePlayClick.css('opacity', ''); } if (timeout) clearTimeout(timeout); if (!$shapePlayClick.hasClass('annexx-onhover-video-show')) $shapePlayClick.addClass('annexx-onhover-video-show annexx-onhover-video-show-pe'); if (!$shapePauseClick.hasClass('annexx-onhover-video-show')) $shapePauseClick.addClass('annexx-onhover-video-show annexx-onhover-video-show-pe'); timeout = setTimeout(function() { $shapePlayClick.add($shapePauseClick).removeClass('annexx-onhover-video-show'); setTimeout(function() { $shapePlayClick.add($shapePauseClick).removeClass('annexx-onhover-video-show-pe') },300); },2000); } if ($previewvideo) $previewvideo.on('mousemove', mousemoveShow); $e.on('mousemove', mousemoveShow); } if (switchElementUnmuteOnhoverVideo && $shapeUnmuteClick && $shapeUnmuteClick.length && $shapeMuteClick && $shapeMuteClick.length) { let timeout, firstHover = false; function mousemoveShow() { if (false && false&& !firstHover) { firstUnmuteHover = true; if (switchElementMuteUnmute) { if (switchElementMuteUnmuteLoad === 'unmute') $shapeUnmuteClick.css('opacity', ''); else if (switchElementMuteUnmuteLoad === 'mute') $shapeMuteClick.css('opacity', ''); } else $shapeUnmuteClick.css('opacity', ''); } if (timeout) clearTimeout(timeout); if (!$shapeUnmuteClick.hasClass('annexx-onhover-video-show')) $shapeUnmuteClick.addClass('annexx-onhover-video-show annexx-onhover-video-show-pe'); if (!$shapeMuteClick.hasClass('annexx-onhover-video-show')) $shapeMuteClick.addClass('annexx-onhover-video-show annexx-onhover-video-show-pe'); timeout = setTimeout(function() { $shapeUnmuteClick.add($shapeMuteClick).removeClass('annexx-onhover-video-show'); setTimeout(function() { $shapeUnmuteClick.add($shapeMuteClick).removeClass('annexx-onhover-video-show-pe') },300); },2000); } if ($previewvideo) $previewvideo.on('mousemove', mousemoveShow); $e.on('mousemove', mousemoveShow); } setTimeout(function() { /*Закомментировал блок ниже, так как тильда вроде попарвила масштабирование*/ /*if (/opr/i.test(navigator.userAgent) && false) { annexxAddStyle('011',` .annexx-wrapper-video-in-shape${d}:not(.t-animate), .annexx-wrapper-video-in-shape${d} .tn-atom__scale-wrapper { overflow: hidden; } .annexx-wrapper-video-in-shape${d}:not(.t-animate) .tn-atom__scale-wrapper { transform: none !important; } `); } else if (/firefox/i.test(navigator.userAgent)) { annexxAddStyle('011',` .annexx-wrapper-video-in-shape${d} .tn-atom__scale-wrapper { overflow: hidden; } `); } else if (!false && !/opr/i.test(navigator.userAgent) && !false) { annexxAddStyle('011',` .annexx-wrapper-video-in-shape${d} { overflow: hidden; } `); }*/ let $tab = $('.t395__tab, .t397__tab'), videoBlockId = +$e.closest('.r').attr('id').replace(/\D+/,''), $tabVideo = $tab.filter((i,e) => $(e).data('tab-rec-ids').toString().split(',').some(e => +e === videoBlockId)); if ($tabVideo.length) { function processTab() { if ($tabVideo[0].classList.value.indexOf('tab_active') !== -1) { let action = 'mute,pause'.split(','); if (action.some(e => e === 'mute')) v.muted = true; else v.muted = false; if (action.some(e => e === 'pause')) v.pause(); else v.play(); if (action.some(e => e === 'start')) v.currentTime = 0; } else { let action = 'mute,pause'.split(','); if (action.some(e => e === 'mute')) v.muted = true; else v.muted = false; if (action.some(e => e === 'pause')) v.pause(); else v.play(); } } let config = { attributes: true, childList: false, characterData: false, }; observer = new MutationObserver(processTab); observer.observe($tabVideo[0], config); } /* Баг с тем что не применяется автоскейл тильды к шейпам с видео*/ /*function autoscaleVideoFix() { setTimeout(function(){ if ($e.closest('.t396__artboard_scale').length && !e.style.zoom) { $e.css('transform','scale(' + window.tn_scale_factor + ')'); } },1e3); } autoscaleVideoFix(); $(window).on("resize", autoscaleVideoFix);*/ },500); }); }).then(function() { if (!window.annexxTabClickPauseVideo) window.annexxTabClickPauseVideo = true; $('.t395__tab').on("click", e => { if ($(e.target).hasClass("t395__tab_active")) return false; $(e.target) .closest(".t395__tab") .siblings(".t395__tab:not('.t395__tab_active')") .each((i,el) => { let id = "rec" + $(el).data("tab-rec-ids"); arrAnnexxVideoTooltip.forEach((e) => { if ($(e.el).closest(".r").attr("id") === id) e.function.pauseV(); }); }); }); let intFixSizeVideoShape; window.addEventListener('resize', function() { clearTimeout(intFixSizeVideoShape); intFixSizeVideoShape = setTimeout(fixSizeVideoShape, 500); }); $shape.find('.annexx-preloader-video-shape').fadeOut(500, function() { $(this).remove(); }); function isScrolledIntoView(elem,alwaysToStart) { let tnelem = elem.closest(".tn-elem"), docViewTop = window.pageYOffset, docViewBottom = docViewTop + window.innerHeight, elemHeight = elem.clientHeight, elemTop = isSafari && !isMobile && +tnelem.style.zoom ? (window.scrollY - elem.closest(".r").offsetTop) + tnelem.offsetTop * +tnelem.style.zoom + window.scrollY : elem.getBoundingClientRect().top + window.scrollY + (isMobile ? window.innerHeight / 2 : 0), elemBottom = elemTop + elemHeight, inViewport = elemBottom + playVideoVisibleOnScreenOffset <= docViewBottom + (elemHeight / 2) && elemTop >= docViewTop - (elemHeight / 2); return inViewport; }; if (false && !(isSafari && isMobile)) { window.arrAnnexxVideoTooltip.forEach(function(e,i) { if (e.playElClick && e.playElClick === d) { $(window).on('scroll', function() { let docViewTop = window.pageYOffset, docViewBottom = docViewTop + window.innerHeight, elemHeight = e.el.clientHeight, elemTop = e.el.getBoundingClientRect().top + window.scrollY, elemBottom = elemTop + elemHeight; if (elemTop > docViewBottom || elemBottom < docViewTop) e.el.currentTime = 0; }); } }); } if (playVideoTimeout && playVideoVisibleOnScreen) { window.arrAnnexxVideoTooltip.forEach(function(e,i) { if (e.playElClick && e.playElClick === d) { $(window).on('mousemove.screenPlayStart' + i + ' scroll.screenPlayStart' + i, function() { if (e.el.paused && isScrolledIntoView(e.el)) { function alwaysVideoOnScroll() { $(window).on('scroll.screenPlayStart' + i, function() { if (isScrolledIntoView(e.el)) { if (false) { e.el.muted = true; e.buttonMute = true; playV(e); } } }); } if (isMobile) { let int = setInterval(function() { if (rv) { firstLoadVideo(); clearInterval(int); setTimeout(function () { $shape.find('video').each(function(i,e) { playOnTimeout(e); }); timeoutReady = true; if (playVideoVisibleOnScreenAlways) alwaysVideoOnScroll(); }, playVideoTimeout); if (fixVisibleTouch) { $(window).off('mousemove.screenPlayStart' + i + ' scroll.screenPlayStart' + i); } } }, 500); } else { setTimeout(function () { $shape.find('video').each(function(i,e) { playOnTimeout(e); }); timeoutReady = true; if (playVideoVisibleOnScreenAlways) alwaysVideoOnScroll(); }, playVideoTimeout); $(window).off('mousemove.screenPlayStart' + i + ' scroll.screenPlayStart' + i); } } }); } }); } else if (playVideoTimeout) { if (isMobile) { let int = setInterval(function() { if (rv) { firstLoadVideo(); clearInterval(int); setTimeout(function () { $shape.find('video').each(function(i,e) { playOnTimeout(e); }); timeoutReady = true; }, playVideoTimeout); } }, 500); } else { setTimeout(function () { $shape.find('video').each(function(i,e) { playOnTimeout(e); }); timeoutReady = true; }, playVideoTimeout); } } else if (playVideoVisibleOnScreen) { window.arrAnnexxVideoTooltip.forEach(function(e,i) { if (e.playElClick && e.playElClick === d) { $(window).on('scroll.screenPlayStart' + i, function() { if (isScrolledIntoView(e.el)) { if (e.el.paused) { e.el.muted = true; e.buttonMute = true; playV(e); if (!playVideoVisibleOnScreenAlways) { if (isMobile) { if (fixVisibleTouch) { $(window).off('scroll.screenPlayStart' + i); } } else { $(window).off('scroll.screenPlayStart' + i); } } } } }); } }) }; if (stopVideoVisibleOnScreen) { window.arrAnnexxVideoTooltip.forEach(function(e,i) { if (e.playElClick && e.playElClick === d) { $(window).on('scroll', function() { if (!e.el.paused && !isScrolledIntoView(e.el)) pauseV(); }); } }) } let rv = false; window.arrAnnexxVideoTooltip.forEach(function(e,i) { if (e.playElClick === d) { e.el.addEventListener('play', function(e) { if (!playHTML) { if (!playVideoVisibleOnScreen) { window.arrAnnexxVideoTooltip.forEach(el => { if (el.el === e.target) playV(el); }); } playHTML = true; } if (switchElementPlayPause) { if (switchElementPlayPauseFirst) { setTimeout(function() { switchElementPlayPauseFirst = false; }, 1e3); } else { if ($shapePlayClick) $shapePlayClick.hide(); if ($shapePauseClick) $shapePauseClick.css('display', 'table'); }; } }); e.el.addEventListener('pause', function() { pauseVAddon(); }); e.el.addEventListener('volumechange', function(e) { if (!e.target.muted || !e.target.volume) { unmute(); if (!e.target.paused) { window.arrAnnexxVideoTooltip.forEach(function(e) { if (e.playElClick !== d) { setTimeout(function () { e.el.muted = true; if (e.switchElementMuteUnmute) { if (e.elements.shapeMuteClick) e.elements.shapeMuteClick.hide(); if (e.elements.shapeUnmuteClick) e.elements.shapeUnmuteClick.css('display', 'table'); } },200); } }); } } else mute(); }); } }); if (!switchElementPlayPause) { if ($shapePlayClick) $shapePlayClick.css('display', 'table'); if ($shapePauseClick) $shapePauseClick.css('display', 'table'); } else { switch (switchElementPlayPauseLoad) { case 'play': if ($shapePlayClick) $shapePlayClick.css('display', 'table'); break; case 'pause': if ($shapePauseClick) $shapePauseClick.css('display', 'table'); break; } } function checkPlayed() { let r = false; window.arrAnnexxVideoTooltip.forEach(function(e) { if (e.playElClick === d && !e.el.paused) r = true; }); return r; } let toc; if($shapePlayClick) { let toc; $shapePlayClick.on('click', function() { if (false && checkPlayed()) { clearTimeout(toc); pauseV(); if (switchElementPlayPause) { $shapePauseClick.hide(); if ($shapePlayClick) $shapePlayClick.css('display', 'table'); } return false; } if (false) { $shapePlayClick.hide(); if ($shapePlayHover) $shapePlayHover.hide(); $shape.find('video').attr('controls',''); } clearTimeout(toc); toc = setTimeout(function() { playV(undefined, playVideoUnmuteClick, playVideoFromStart); },0); if (switchElementPlayPause) { $shapePlayClick.hide(); if ($shapePauseClick) $shapePauseClick.css('display', 'table'); } if ($shapePlayAnalytic) { let $el = $shapePlayAnalytic.find('a'); Tilda.sendEventToStatistics($el.data('tilda-event-name'), $el.text()); } }); } let toh; if ($shapePlayHover) { $shapePlayHover.on('mouseover', function() { if (false && checkPlayed()) { clearTimeout(toh); pauseV(); if (switchElementPlayPause) { $shapePauseClick.hide(); if ($shapePlayClick) $shapePlayClick.css('display', 'table'); } return false; } if (false) { if ($shapePlayClick) $shapePlayClick.hide(); $shapePlayHover.hide(); $shape.find('video').attr('controls',''); } if (playVideoTimeout && !timeoutReady) return false; clearTimeout(toh); toh = setTimeout(function() { playV(undefined, undefined, playVideoFromStart); },0); if (switchElementPlayPause) { if ($shapePlayClick) $shapePlayClick.hide(); if ($shapePauseClick) $shapePauseClick.css('display', 'table'); } }); if (!playVideoWhenMouseleave) { $shapePlayHover.on('mouseout', function() { if (playVideoTimeout && !timeoutReady) return false; window.arrAnnexxVideoTooltip.forEach(function(e) { if (e.playElClick === d){ clearTimeout(toh); pauseV(); if (switchElementPlayPause) { if ($shapePauseClick) $shapePauseClick.hide(); if ($shapePlayClick) $shapePlayClick.css('display', 'table'); } } }); }); } } if ($shapePauseClick) { $shapePauseClick.on('click', function() { clearTimeout(toc); pauseV(); if (switchElementPlayPause) { $shapePauseClick.hide(); if ($shapePlayClick) $shapePlayClick.css('display', 'table'); } }); } if ($shapePauseHover) { $shapePauseHover.on('mouseover', function() { clearTimeout(toh); pauseV(); }); if (pauseVideoWhenMouseover) { $shapePauseHover.on('mouseout', function() { if (playVideoTimeout && !timeoutReady) return false; toh = setTimeout(function() { playV(); },0); if (switchElementPlayPause) { if ($shapePlayClick) $shapePlayClick.hide(); if ($shapePauseClick) $shapePauseClick.css('display', 'table'); } }); } } if ($shapeMuteClick){ $shapeMuteClick.on('click', function() { playVideoUnmuteClick = false; mute(); }); } if ($shapeUnmuteClick){ $shapeUnmuteClick.on('click', function() { playVideoUnmuteClick = true; unmute(); }); if ($shapeUnmuteAnalytic) { let $el = $shapeUnmuteAnalytic.find('a'); Tilda.sendEventToStatistics($el.data('tilda-event-name'), $el.text()); } } if ($shapeMuteHover)$shapeMuteHover.on('mouseover', mute); if ($shapeUnmuteHover)$shapeUnmuteHover.on('mouseover', unmute); if (!switchElementMuteUnmute) { if ($shapeMuteClick) $shapeMuteClick.css('display', 'table'); if ($shapeUnmuteClick) $shapeUnmuteClick.css('display', 'table'); } else { switch (switchElementMuteUnmuteLoad) { case 'mute': if ($shapeMuteClick) $shapeMuteClick.css('display', 'table'); break; case 'unmute': if ($shapeUnmuteClick) $shapeUnmuteClick.css('display', 'table'); break; } } let g = Math.round(Math.random()*1e10); setTimeout(function() { if ((playOnloadPage || playVideoTimeout || playVideoVisibleOnScreen) && !$shape.find('video').data('mobileHasPlay')) { if (isMobile) $('body').on('touchstart.loadVideo' + g, firstLoadVideo); else $('body').on('click.loadVideo' + g, firstLoadVideo); } },500); function firstLoadVideo() { let c = function () { window.arrAnnexxVideoTooltip.forEach(function(e) { if (e.playElClick === d) { let l = e.el; l.muted = true; l.play().then(() => { l.pause(); if ($(l).attr('autoplay'))playV(); }); } }); }; c(); if (isMobile) $('body').off('touchstart.loadVideo' + g); else $('body').off('click.loadVideo' + g); rv = true; /* return c(); */ } function popupShowAction(mutationList, observer) { mutationList.forEach(function(mutation) { switch(mutation.type) { case 'attributes': if ($('body').hasClass('t-body_popupshowed')) { window.arrAnnexxVideoTooltip.forEach(function(e) { if (e.service === 'direct') { switch (e.actionOpenPopup) { case 'mute': e.el.muted = true; e.el.play(); e.buttonMute = true; if (switchElementMuteUnmute) { if ($shapeMuteClick) $shapeMuteClick.hide(); if ($shapeUnmuteClick) $shapeUnmuteClick.css('display', 'table'); } break; case 'pause': e.el.pause(); if (switchElementPlayPause) { if ($shapePauseClick) $shapePauseClick.hide(); if ($shapePlayClick) $shapePlayClick.css('display', 'table'); } break; } } }); } break; } }); } let observerOptions = { childList: false, attributes: true, subtree: false }, observer = new MutationObserver(popupShowAction); observer.observe($('body')[0], observerOptions); $(document).on('click', '.t-popup', function() { if (!$(this).hasClass('t-popup_show')) { this.querySelectorAll('video').forEach(function(e) { e.pause(); }); } }); }); } }); } },100); setTimeout(function() { clearInterval(int); },5e3); }())