@fynd-design-engineering/fynd-bloom 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{
|
|
1
|
+
"use strict";(()=>{"scrollRestoration"in history&&(history.scrollRestoration="manual");var L=()=>{window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0};window.addEventListener("load",()=>{L()});window.addEventListener("pageshow",c=>{c.persisted&&L()});var v=!1;document.addEventListener("DOMContentLoaded",()=>{let c=document.querySelectorAll("[data-anchor-trigger]"),n=document.querySelectorAll("[data-page-anchor]"),m=()=>window.innerWidth>992?120:52,o=e=>{c.forEach(i=>{let a=i.getAttribute("data-anchor-trigger");i.setAttribute("data-current-anchor",a===e?"true":"false")})},l=()=>{let e=m(),i=[];n.forEach(s=>{let f=s.getBoundingClientRect();f.top-e<=0&&f.bottom>e&&i.push(s)});let a=i.map(s=>s.getAttribute("data-page-anchor")).filter(s=>s!==null);a.length>0&&o(a[0])};c.forEach(e=>{e.addEventListener("click",()=>{let i=e.getAttribute("data-anchor-trigger");if(!i)return;let a=document.querySelector(`[data-page-anchor="${i}"]`);if(!a)return;let s=m(),f=a.getBoundingClientRect().top+window.scrollY-s;window.scrollTo({top:f,behavior:"auto"}),v&&(d(),v=!1),o(i),l()})}),window.addEventListener("scroll",l);let r=992,y=()=>window.innerWidth<r;function h(){let e=document.getElementById("menu-toggle");e&&(e.checked=!0)}function p(){let e=document.getElementById("menu-toggle");e&&(e.checked=!1)}function E(){if(!y())return;let e=document.querySelector("[data-menu-content]");e&&(e.style.display="block",h())}function d(){let e=document.querySelector("[data-menu-content]");e&&(e.style.display="none",p())}d(),v=!1;let u=document.querySelector("[data-menu-toggle]");u&&u.addEventListener("click",()=>{v=!v,v?E():d()}),l()});document.querySelectorAll("[large-card]").forEach(c=>{if(c.classList.contains("w-condition-invisible"))return;let n=c.parentElement;n&&n.setAttribute("col-span","2")});document.addEventListener("DOMContentLoaded",()=>{let c=window.innerWidth>992?1500:2500,n=document.querySelector("[bloom-element='video-1']"),m=document.querySelector("[bloom-element='video-poster-1']"),o=document.querySelector("[bloom-element='video-2']"),l=document.querySelector("[bloom-element='video-3']"),r=document.querySelector("[bloom-element='content']");if(!n||!m||!o||!r||!l){console.warn("Required elements missing");return}let y=document.querySelector("[bloom-element='navigation']"),h=document.querySelector("[bloom-element='footer']"),p=document.querySelector("[bloom-element='scroll-indicator']");p&&setTimeout(()=>{p.style.opacity="1"},1600),window.innerWidth<992&&document.getElementById("bgVideo")?.play(),L(),document.body.classList.add("scroll-locked"),r.style.transition="none",r.style.transform="translateY(100vh)",r.getBoundingClientRect(),r.style.transition="transform 0.8s ease";let E=!1,d=!1,u=!1;l&&(l.loop=!0,l.style.display="none");let e=()=>{if(E)return;E=!0;let t=n.play();t&&t.then(()=>{m.style.display="none"}).catch(g=>{console.warn("Video 1 autoplay failed:",g)})};n.readyState>=HTMLMediaElement.HAVE_METADATA?e():n.addEventListener("loadedmetadata",e,{once:!0}),n.addEventListener("ended",()=>{n.pause(),n.currentTime=n.duration,d=!0,o.style.display="block",console.log("Video 1 ended, Video 1 Finished set to true")});let i=()=>{if(!d){console.log("Video 1 not finished yet, skipping Video 2 trigger");return}if(u){console.log("Video 2 already triggered");return}console.log("Triggering Video 2"),u=!0,p&&(p.style.opacity="0");let t=o.play();window.innerWidth<992&&document.getElementById("bgVideo-2")?.play(),t&&t.then(()=>{console.log("Video 2 playing")}).catch(g=>{console.warn("Video 2 play failed:",g)}),setTimeout(()=>{w()},c)},a=t=>{d&&(u||(t.preventDefault(),console.log("Wheel event detected"),i(),window.removeEventListener("wheel",a)))};window.addEventListener("wheel",a,{passive:!1});let s=0,f=t=>{d&&(u||(s=t.touches[0].clientY))},T=t=>{if(!d||u)return;let g=t.touches[0].clientY;s-g>10&&(console.log("Touch scroll detected"),t.preventDefault(),i(),window.removeEventListener("touchstart",f),window.removeEventListener("touchmove",T))};window.addEventListener("touchstart",f,{passive:!0}),window.addEventListener("touchmove",T,{passive:!1}),o.addEventListener("ended",()=>{console.log("Video 2 ended"),o.pause(),o.currentTime=o.duration,l.style.display="block";let t=l.play();t&&t.then(()=>{console.log("Video 3 playing")}).catch(g=>{console.warn("Video 3 play failed:",g)})});let w=()=>{console.log("Revealing content"),requestAnimationFrame(()=>{r.style.transform="translateY(0)",y&&(y.style.transform="translateY(0)"),h&&(h.style.transform="translateY(0)")}),setTimeout(()=>{document.body.classList.remove("scroll-locked")},500)};n.addEventListener("ended",()=>{setTimeout(()=>{!u&&d&&(console.log("Auto-triggering Video 2 (fallback after Video 1 ends)"),i())},1e3)})});document.addEventListener("DOMContentLoaded",()=>{if(window.innerWidth>991)return;let m=document.querySelectorAll(".bloom-sticky_block");if(!m.length)return;let o=()=>{m.forEach(l=>{let r=l.getBoundingClientRect(),y=r.top<=52&&r.bottom>52;l.setAttribute("active-page",y?"true":"false")})};window.addEventListener("scroll",o,{passive:!0}),o()});})();
|