feat: move scripts to script folder
All checks were successful
renovate / renovate (push) Successful in 26s
test-build / guarddog (push) Successful in 3m51s
test-build / build (push) Successful in 4m40s

This commit is contained in:
2026-03-15 21:53:59 -05:00
parent 93a53cab3d
commit 641c7cb33f
23 changed files with 96 additions and 99 deletions

View File

@@ -101,16 +101,22 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
</html>
<script>
import { initPhotoSwipe } from '@/scripts/photoswipe';
import { animateContent } from '@/scripts/animations';
const resetScroll = () => {
const scrollContainer = document.getElementById('reset-scroll');
if (scrollContainer) {
scrollContainer.scrollTop = 0;
}
if (scrollContainer) scrollContainer.scrollTop = 0;
};
resetScroll();
initPhotoSwipe();
animateContent();
document.addEventListener('swup:page:view', () => {
resetScroll();
initPhotoSwipe();
animateContent();
if (typeof (window as any).HSStaticMethods !== 'undefined') {
(window as any).HSStaticMethods.autoInit();
}
@@ -120,84 +126,6 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
});
</script>
<script>
import PhotoSwipeLightbox from 'photoswipe/lightbox';
import PhotoSwipe from "photoswipe";
let lightbox: PhotoSwipeLightbox | null = null;
function initPhotoSwipe() {
const links = document.querySelectorAll<HTMLAnchorElement>('a.pswp-link');
links.forEach((link) => {
const img = link.querySelector('img');
if (img) {
const applyDimensions = () => {
link.dataset.pswpWidth = (img.naturalWidth || 1920).toString();
link.dataset.pswpHeight = (img.naturalHeight || 1080).toString();
};
if (img.complete) {
applyDimensions();
} else {
img.addEventListener('load', applyDimensions);
}
}
});
if (lightbox) {
lightbox.destroy();
}
lightbox = new PhotoSwipeLightbox({
gallery: '.prose',
children: 'a.pswp-link',
pswpModule: PhotoSwipe,
allowPanToNext: true,
});
lightbox.init();
}
initPhotoSwipe();
document.addEventListener('swup:page:view', initPhotoSwipe);
</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>
/* Fade away content below header when scrolling */
.mask-container {