@@ -44,53 +44,12 @@ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
4444
4545document . addEventListener ( "DOMContentLoaded" , function ( ) {
4646 const heroVideo = document . querySelector ( "#heading-container .hero-video" ) ;
47- const heroSection = document . querySelector ( "#heading-container" ) ;
48- const isMobileViewport = window . matchMedia ( "(max-width: 900px)" ) . matches ;
49-
50- function safePlayVideo ( videoEl ) {
51- if ( ! videoEl ) {
52- return ;
53- }
54- const playPromise = videoEl . play ( ) ;
55- if ( playPromise && typeof playPromise . catch === "function" ) {
56- playPromise . catch ( function ( ) {
57- // Ignore autoplay interruptions from browser policies.
58- } ) ;
59- }
60- }
61-
6247 if ( heroVideo ) {
6348 heroVideo . addEventListener ( "loadedmetadata" , function ( ) {
6449 heroVideo . currentTime = 5.5 ;
6550 } , { once : true } ) ;
6651 }
6752
68- if ( heroVideo && heroSection && isMobileViewport && "IntersectionObserver" in window ) {
69- let heroIsVisible = true ;
70- const observer = new IntersectionObserver ( function ( entries ) {
71- entries . forEach ( function ( entry ) {
72- heroIsVisible = entry . isIntersecting && entry . intersectionRatio >= 0.18 ;
73- } ) ;
74- if ( heroIsVisible ) {
75- safePlayVideo ( heroVideo ) ;
76- } else {
77- heroVideo . pause ( ) ;
78- }
79- } , {
80- threshold : [ 0 , 0.18 , 0.4 ]
81- } ) ;
82-
83- observer . observe ( heroSection ) ;
84-
85- document . addEventListener ( "visibilitychange" , function ( ) {
86- if ( document . hidden ) {
87- heroVideo . pause ( ) ;
88- } else if ( heroIsVisible ) {
89- safePlayVideo ( heroVideo ) ;
90- }
91- } ) ;
92- }
93-
9453 const heroIntroTargets = document . querySelectorAll ( [
9554 "#heading-container .container-left img" ,
9655 "#heading-container .container-left p" ,
0 commit comments