First commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Point d'entrée principal — instancie Gallery et ContactForm
|
||||
* après le chargement du DOM.
|
||||
*/
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// ── Galerie photos ─────────────────────────────────────────────────────────
|
||||
const galleryModal = document.getElementById('gallery-modal');
|
||||
if (galleryModal && typeof GALLERY_DATA !== 'undefined') {
|
||||
window._gallery = new Gallery(GALLERY_DATA, galleryModal);
|
||||
}
|
||||
|
||||
// ── Formulaire de contact ──────────────────────────────────────────────────
|
||||
const contactModal = document.getElementById('contact-modal');
|
||||
const contactForm = document.getElementById('contact-form');
|
||||
if (contactModal && contactForm && typeof CONTACT_URL !== 'undefined') {
|
||||
window._contactForm = new ContactForm(
|
||||
contactForm,
|
||||
contactModal,
|
||||
CONTACT_URL,
|
||||
typeof CSRF_TOKEN !== 'undefined' ? CSRF_TOKEN : '',
|
||||
);
|
||||
}
|
||||
|
||||
// ── Disparition auto des messages flash Django ─────────────────────────────
|
||||
document.querySelectorAll('.alert-auto-hide').forEach((alert) => {
|
||||
setTimeout(() => {
|
||||
alert.style.opacity = '0';
|
||||
alert.style.transition = 'opacity .5s';
|
||||
setTimeout(() => alert.remove(), 500);
|
||||
}, 4000);
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user