1// WPLife Hero Video - Frontend Script 2(function() { 3 // ФÑнкÑÐ¸Ñ Ð´Ð»Ñ Ð¸Ð½Ð¸ÑиализаÑии каждой ÑекÑии 4 function initHeroVideo(section) { 5 const video = section.querySelector('video'); 6 const iframe = section.querySelector('iframe'); 7 const fullscreenBtn = section.querySelector('.wplife-fullscreen-btn'); 8 const overlayText = section.querySelector('.wplife-hero__text--overlay'); 9 let originalViewportContent = ''; 10 11 function toggleFullscreen() { 12 if (!document.fullscreenElement && 13 !document.webkitFullscreenElement && 14 !document.mozFullScreenElement && 15 !document.msFullscreenElement) { 16 17 const viewportMeta = document.querySelector('meta[name="viewport"]'); 18 if (viewportMeta) { 19 originalViewportContent = viewportMeta.content; 20 viewportMeta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'; 21 } 22 23 const elem = video || iframe || section; 24 25 if (elem.requestFullscreen) { 26 elem.requestFullscreen(); 27 } else if (elem.webkitRequestFullscreen) { 28 elem.webkitRequestFullscreen(); 29 } else if (elem.msRequestFullscreen) { 30 elem.msRequestFullscreen(); 31 } else if (elem.mozRequestFullScreen) { 32 elem.mozRequestFullScreen(); 33 } 34 35 if (screen.orientation && screen.orientation.lock) { 36 screen.orientation.lock('landscape').catch(function() {}); 37 } 38 } else { 39 if (document.exitFullscreen) { 40 document.exitFullscreen(); 41 } else if (document.webkitExitFullscreen) { 42 document.webkitExitFullscreen(); 43 } else if (document.msExitFullscreen) { 44 document.msExitFullscreen(); 45 } else if (document.mozCancelFullScreen) { 46 document.mozCancelFullScreen(); 47 } 48 } 49 } 50 51 function resetViewportAndZoom() { 52 const viewportMeta = document.querySelector('meta[name="viewport"]'); 53 if (viewportMeta && originalViewportContent) { 54 viewportMeta.content = originalViewportContent; 55 } 56 57 document.body.style.zoom = ''; 58 document.documentElement.style.zoom = ''; 59 document.body.style.transform = ''; 60 document.body.style.transformOrigin = ''; 61 62 setTimeout(function() { 63 window.scrollTo(0, 0); 64 }, 50); 65 } 66 67 function onFullscreenChange() { 68 if (document.fullscreenElement || 69 document.webkitFullscreenElement || 70 document.mozFullScreenElement || 71 document.msFullscreenElement) { 72 73 if (overlayText) overlayText.style.display = 'none'; 74 if (fullscreenBtn) { 75 fullscreenBtn.textContent = 'â'; 76 fullscreenBtn.setAttribute('aria-label', 'ÐÑйÑи из полноÑкÑанного Ñежима'); 77 fullscreenBtn.setAttribute('title', 'ÐÑйÑи из полноÑкÑанного Ñежима'); 78 } 79 80 if (video) { 81 video.muted = false; 82 video.controls = true; 83 } 84 } else { 85 if (overlayText) overlayText.style.display = 'flex'; 86 if (fullscreenBtn) { 87 fullscreenBtn.textContent = 'â¶'; 88 fullscreenBtn.setAttribute('aria-label', 'ÐолноÑкÑаннÑй Ñежим'); 89 fullscreenBtn.setAttribute('title', 'Ðа веÑÑ ÑкÑан'); 90 } 91 92 if (video) { 93 video.muted = true; 94 video.controls = false; 95 video.play(); 96 } 97 98 if (screen.orientation && screen.orientation.unlock) { 99 screen.orientation.unlock(); 100 } 101 102 resetViewportAndZoom(); 103 } 104 } 105 106 if (fullscreenBtn) { 107 fullscreenBtn.addEventListener('click', toggleFullscreen); 108 } 109 110 document.addEventListener('fullscreenchange', onFullscreenChange); 111 document.addEventListener('webkitfullscreenchange', onFullscreenChange); 112 document.addEventListener('mozfullscreenchange', onFullscreenChange); 113 document.addEventListener('MSFullscreenChange', onFullscreenChange); 114 115 window.addEventListener('orientationchange', function() { 116 if (!document.fullscreenElement && 117 !document.webkitFullscreenElement && 118 !document.mozFullScreenElement && 119 !document.msFullscreenElement) { 120 resetViewportAndZoom(); 121 } 122 }); 123 124 window.addEventListener('resize', function() { 125 if (!document.fullscreenElement && 126 !document.webkitFullscreenElement && 127 !document.mozFullScreenElement && 128 !document.msFullscreenElement) { 129 document.body.style.zoom = ''; 130 document.documentElement.style.zoom = ''; 131 } 132 }); 133 } 134 135 // ÐниÑиализаÑÐ¸Ñ Ð²ÑÐµÑ ÑекÑий пÑи загÑÑзке ÑÑÑаниÑÑ 136 document.addEventListener('DOMContentLoaded', function() { 137 const sections = document.querySelectorAll('.wplife-intro-video'); 138 sections.forEach(function(section) { 139 initHeroVideo(section); 140 }); 141 });
vendor: 5 bytes, line 142
142})();
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.