index-soutien/assets/js/onload.js
isUnknown 322d9136b6 PHP dynamique + cache JSON, nettoyage CSS/HTML, CI Forgejo
- Renommage classes/IDs (BEM cohérent, anglais, noms sémantiques)
- Correction HTML : h3→h2 FAQ, button>a→a[role=button] CTA mobile
- Conversion index.html → index.php (FR/EN) avec cache JSON depuis API Kirby
- Pages merci/thanks converties en PHP dynamique
- Ajout includes/cache.php + includes/config.php (cache TTL 5min)
- Ajout CI Forgejo (deploy FTP via lftp)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 08:00:58 +02:00

90 lines
No EOL
2.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

window.onload = function () {
headerShrink();
initCart();
toggleDonationButton();
videos();
};
window.onscroll = function () {
headerShrink();
toggleDonationButton();
};
function initCart() {
const items = document.querySelectorAll('.store__product .link-block');
const header = document.querySelector('#site-header');
}
function headerShrink() {
const header = document.getElementById('site-header');
const scrollPosition = window.scrollY || document.documentElement.scrollTop;
if (scrollPosition > 100) {
header.classList.add('is-shrinked');
} else {
header.classList.remove('is-shrinked');
}
}
function toggleDonationButton() {
const btn = document.getElementById('donation-cta-mobile');
const section = document.getElementById('section__donation');
const footer = document.getElementById('site-footer');
if (!btn || !section || !footer) return; // sécurité
const scrollTop = window.scrollY || window.pageYOffset;
const triggerPoint = section.offsetTop + section.offsetHeight / 2;
// 1⃣ Gestion de la visibilité du bouton
if (scrollTop >= triggerPoint) {
btn.classList.add('is-visible');
} else {
btn.classList.remove('is-visible');
}
// 2⃣ Gestion de la position par rapport au footer
const footerRect = footer.getBoundingClientRect();
const windowHeight = window.innerHeight;
if (footerRect.top < windowHeight) {
const footerVisibleHeight = windowHeight - footerRect.top;
btn.style.bottom = footerVisibleHeight + 'px';
} else {
btn.style.bottom = '0px';
}
}
function videos(){
console.log("video");
let section = document.getElementById("section__video");
console.log(section);
let videoslinks = document.querySelectorAll(".testimony-item");
videoslinks.forEach(function (video, index) {
video.addEventListener("click", (event) => {
let data = video.getAttribute('data-video');
var div = document.createElement('section');
div.id = "video__fullscreen";
div.innerHTML = '<button id="video__close">✕</button>\
<iframe\
src="' + data + '"\
style="aspect-ratio: 9/16; width: 100%; border: 0"\
allow="autoplay; fullscreen; picture-in-picture"\
allowfullscreen ></iframe>';
document.body.appendChild(div);
document.body.classList.add("is-fullscreen");
let close = document.querySelector("#video__close");
close.addEventListener("click", (event) => {
div.remove();
document.body.classList.remove("is-fullscreen");
});
});
});
}