feat: move script handling to use swup instead of astro transitions, move animations to baselayout
All checks were successful
renovate / renovate (push) Successful in 41s
test-build / build (push) Successful in 1m25s
test-build / guarddog (push) Successful in 1m43s

This commit is contained in:
2026-03-13 10:59:25 -05:00
parent 70a94990e2
commit 500d9e2ea0
14 changed files with 128 additions and 498 deletions

View File

@@ -58,6 +58,12 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
window.localStorage.setItem('theme', theme);
</script>
<!-- Preline -->
<script
src="/vendor/preline/collapse2.1.0.min.js"
is:inline
/>
<!-- Rybbit Tracking Snippet -->
<script
src="https://rybbit.alexlebens.dev/api/script.js"
@@ -102,7 +108,52 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
}
};
resetScroll();
document.addEventListener('astro:after-swap', resetScroll);
document.addEventListener('swup:page:view', () => {
resetScroll();
if (typeof (window as any).HSStaticMethods !== 'undefined') {
(window as any).HSStaticMethods.autoInit();
}
if (typeof (window as any).rybbit === 'function') {
(window as any).rybbit('trackPageview');
}
});
</script>
<script>
const animateContent = () => {
const smoothReveal = document.querySelectorAll('.smooth-reveal');
smoothReveal.forEach((el, index) => {
setTimeout(() => {
el.classList.add('animate-reveal');
}, 50 + index * 100);
});
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
smoothReveal2.forEach((el, index) => {
setTimeout(() => {
el.classList.add('animate-reveal');
}, 200 + index * 250);
});
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
smoothRevealCards.forEach((el, index) => {
setTimeout(() => {
el.classList.add('animate-reveal');
}, 400 + index * 250);
});
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
smoothRevealFade.forEach((el, index) => {
setTimeout(() => {
el.classList.add('animate-reveal-fade');
}, 100 + index * 250);
});
};
animateContent();
document.addEventListener('swup:page:view', animateContent);
</script>
<style>