PageSourceSearch

https://www.jeanemmanuel-perchet.fr/assets/js/app.js

js jeanemmanuel-perchet.fr collected 2026-10-06 09:05:30 UTC 22,140 bytes, 749 lines download raw bytes

1AOS.init();
2
3const lightboxContenu = GLightbox({
4  selector: '[data-glightbox="gallery_contenu"]',
5});
6
7const lightboxPhoto = GLightbox({
8  selector: '[data-glightbox="gallery-photo"]',
9});
10
11function notificationGreen(message) {
12  const notification = document.createElement("div");
13  notification.className = "message";
14  notification.id = "messageNotification";
15  notification.innerHTML = `
16      <span class='fa-solid fa-circle-check'></span>
17      <span class="msg">${message}</span>
18  `;
19  document.body.appendChild(notification);
20
21  setTimeout(() => {
22    notification.remove();
23  }, 3000);
24}
25
26function notificationRed(message) {
27  const notification = document.createElement("div");
28  notification.className = "messageRED";
29  notification.id = "messageNotification";
30  notification.innerHTML = `
31      <span class="fas fa-exclamation-circle"></span>
32      <span class="msg">${message}</span>
33  `;
34  document.body.appendChild(notification);
35
36  setTimeout(() => {
37    notification.remove();
38  }, 3000);
39}
40
41// first menu
42function fonction_humberger() {
43  var y = document.getElementById("navbar2");
44  var button = document.getElementById("hamburger");
45  var icon = document.getElementById("hamburger-icon");
46  var navMobile = document.querySelector(".nav-mobile");
47
48  if (y.className === "navbar2") {
49    y.className += " responsive";
50    document.body.style.overflow = "hidden";
51    icon.classList.remove("fa-bars");
52    icon.classList.add("fa-times");
53    navMobile.classList.add("open");
54    navMobile.style.animation = "nav 0.5s linear 0s 1 normal forwards";
55  } else {
56    y.className = "navbar2";
57    document.body.style.overflow = "auto";
58    icon.classList.remove("fa-times");
59    icon.classList.add("fa-bars");
60    navMobile.style.animation = "nav-inverse 0.5s linear 0s 1 normal forwards";
61  }
62}
63
64// second menu
65function openMenu() {
66  var y = document.getElementById("navbar2");
67  var navMobile = document.querySelector(".nav-mobile2");
68
69  y.classList.add("responsive");
70  document.body.style.overflow = "hidden";
71  navMobile.style.display = "flex";
72
73  requestAnimationFrame(() => {
74    navMobile.classList.add("open2");
75  });
76}
77
78function closeMenu() {
79  var y = document.getElementById("navbar2");
80  var icon = document.getElementById("hamburger-icon2");
81  var navMobile = document.querySelector(".nav-mobile2");
82
83  if (y && navMobile && icon) {
84    y.classList.remove("responsive");
85    document.body.style.overflow = "auto";
86    icon.classList.remove("fa-times");
87    icon.classList.add("fa-bars");
88    navMobile.classList.remove("open2");
89
90    setTimeout(function () {
91      navMobile.style.display = "none";
92    }, 500);
93  }
94}
95
96// second menu sous menu
97function toggleSubMenuNavmobile2(icon) {
98  var subMenu = icon.nextElementSibling;
99  if (subMenu.classList.contains("active")) {
100    subMenu.classList.remove("active");
101    icon.classList.remove("fa-chevron-up");
102    icon.classList.add("fa-chevron-down");
103  } else {
104    var allSubMenus = document.querySelectorAll(".nav-mobile2 ul.sous_menu");
105    allSubMenus.forEach(function (menu) {
106      menu.classList.remove("active");
107      var icon = menu.previousElementSibling;
108      if (icon && icon.classList.contains("fa-chevron-up")) {
109        icon.classList.remove("fa-chevron-up");
110        icon.classList.add("fa-chevron-down");
111      }
112    });
113
114    // Ouvrez le sous-menu actuel
115    subMenu.classList.add("active");
116    icon.classList.remove("fa-chevron-down");
117    icon.classList.add("fa-chevron-up");
118  }
119}
120
121function navbartop() {
122  var urlParts = window.location.pathname.split("/");
123  var lastPart = urlParts[urlParts.length - 1];
124
125  if (lastPart === "") {
126    window.addEventListener("scroll", function () {
127      var navbar = document.getElementById("direction");
128      var scrollPosition = window.scrollY;
129
130      if (scrollPosition > 0) {
131        navbar.style.top = "0vh";
132        navbar.style.transition = "ease 0.5s";
133        navbar.style.backgroundColor = "black";
134      } else {
135        navbar.style.top = "45.5px";
136        navbar.style.transition = "ease 0.5s";
137        navbar.style.backgroundColor = "rgba(255, 255, 255, 0)";
138      }
139    });
140  } else {
141    window.addEventListener("scroll", function () {
142      var navbar = document.getElementById("direction");
143      var scrollPosition = window.scrollY;
144
145      if (scrollPosition > 0) {
146        navbar.style.top = "0vh";
147        navbar.style.transition = "ease 0.5s";
148        navbar.style.backgroundColor = "black";
149      } else {
150        navbar.style.top = "45.5px";
151        navbar.style.transition = "ease 0.5s";
152      }
153    });
154  }
155}
156
157// navbartop();
158
159// article copy link
160document.addEventListener("DOMContentLoaded", function () {
161  const copyLinkElement = document.querySelector(".copy-link");
162  const shareFacebookElement = document.querySelector(".share-facebook");
163
164  if (copyLinkElement) {
165    copyLinkElement.addEventListener("click", function (event) {
166      event.preventDefault();
167
168      const articleLink = window.location.href;
169      navigator.clipboard.writeText(articleLink).then(function () {
170        alert("Lien copié dans le presse-papier");
171      });
172    });
173  }
174
175  if (shareFacebookElement) {
176    shareFacebookElement.addEventListener("click", function (event) {
177      event.preventDefault();
178      const facebookShareUrl =
179        "https://www.facebook.com/sharer/sharer.php?u=" +
180        encodeURIComponent(window.location.href);
181
182      window.open(facebookShareUrl, "_blank");
183    });
184  }
185});
186
187function getMaxHeight(elements) {
188  var maxHeight = 0;
189  elements.forEach(function (element) {
190    var height = element.clientHeight;
191    maxHeight = Math.max(maxHeight, height);
192  });
193  return maxHeight;
194}
195
196var elements = document.querySelectorAll("#articleBlogHeight");
197if (
198  !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
199    navigator.userAgent
200  )
201) {
202  var maxHeight = getMaxHeight(elements);
203  elements.forEach(function (element) {
204    element.style.height = maxHeight + "px";
205  });
206}
207
208var contenu_article_editor = document.getElementById("contenu_article_editor");
209
210if (contenu_article_editor) {
211  var contenu_article_editorEnfant =
212    contenu_article_editor.querySelectorAll("*");
213  contenu_article_editorEnfant.forEach(function (element) {
214    element.contentEditable = false;
215  });
216}
217
218// slider avis google
219(function () {
220  "use strict";
221
222  new Swiper(".reviews-slider", {
223    speed: 600,
224    loop: true,
225    autoplay: {
226      delay: 5000,
227      disableOnInteraction: false,
228    },
229    slidesPerView: "auto",
230    breakpoints: {
231      320: {
232        slidesPerView: 1,
233        spaceBetween: 20,
234      },
235      768: {
236        slidesPerView: 1,
237        spaceBetween: 20,
238      },
239      1200: {
240        slidesPerView: 1,
241        spaceBetween: 20,
242      },
243    },
244  });
245})();
246
247// slider partenaire
248(function () {
249  "use strict";
250
251  new Swiper(".swiper-container.slider_partenaire", {
252    speed: 600,
253    loop: true,
254    autoplay: {
255      delay: 5000,
256      disableOnInteraction: false,
257    },
258    slidesPerView: "auto",
259    breakpoints: {
260      320: {
261        slidesPerView: 2,
262        spaceBetween: 20,
263      },
264      768: {
265        slidesPerView: 4,
266        spaceBetween: 20,
267      },
268      1200: {
269        slidesPerView: 4,
270        spaceBetween: 20,
271      },
272    },
273  });
274})();
275
276//slider accueil
277(function () {
278  "use strict";
279
280  new Swiper(".slideraccueil", {
281    speed: 600,
282    loop: false,
283    autoplay: {
284      delay: 8500,
285      disableOnInteraction: false,
286    },
287    lazy: {
288      loadPrevNext: true,
289    },
290    slidesPerView: 1,
291
292    pagination: {
293      el: ".swiper-pagination",
294      clickable: true,
295    },
296
297    navigation: {
298      nextEl: ".swiper-button-next",
299      prevEl: ".swiper-button-prev",
300    },
301  });
302})();
303
304(function () {
305  "use strict";
306
307  new Swiper(".slideraccueil_second", {
308    speed: 600,
309    loop: false,
310    autoplay: {
311      delay: 8500,
312      disableOnInteraction: false,
313    },
314    lazy: {
315      loadPrevNext: true,
316    },
317    slidesPerView: 1,
318  });
319})();
320
321// faq open question
322document.querySelectorAll(".faq-question").forEach((faqQuestion) => {
323  faqQuestion.addEventListener("click", () => {
324    const currentlyActiveFaq = document.querySelector(".faq-question.active");
325
326    if (currentlyActiveFaq && currentlyActiveFaq !== faqQuestion) {
327      currentlyActiveFaq.classList.remove("active");
328    }
329
330    faqQuestion.classList.toggle("active");
331  });
332});
333
334document.addEventListener("DOMContentLoaded", function () {
335  var articleBlocks = document.querySelectorAll(".article-color");
336  articleBlocks.forEach(function (block) {
337    var color = block.getAttribute("data-color");
338    block.style.color = color;
339  });
340});
341
342// galerie photo :
343document.querySelectorAll(".image_album").forEach((button) => {
344  button.addEventListener("click", function () {
345    const albumId = this.getAttribute("data-album-id");
346    const galerieName = this.querySelector("h3").textContent;
347    document.querySelector(".album").style.display = "none";
348    document.getElementById("backButton").style.display = "block";
349    document.getElementById("allImageTitle").style.display = "none";
350    document.getElementById("textGalerie").style.display = "none";
351    document.getElementById("div_img_h2").style.display = "flex";
352    document.getElementById("galerieName").textContent = galerieName;
353    document.querySelectorAll(".images").forEach((image) => {
354      if (image.getAttribute("data-album-id") === albumId) {
355        image.style.display = "block";
356      } else {
357        image.style.display = "none";
358      }
359    });
360  });
361});
362
363const backButtonGalerie = document.getElementById("backButtonGalerie");
364
365if (backButtonGalerie) {
366  backButtonGalerie.addEventListener("click", function () {
367    document.querySelector(".album").style.display = "flex";
368    document.getElementById("backButton").style.display = "none";
369    document.getElementById("allImageTitle").style.display = "block";
370    document.getElementById("textGalerie").style.display = "block";
371    document.getElementById("div_img_h2").style.display = "none";
372    document.querySelectorAll(".images").forEach((image) => {
373      image.style.display = "block";
374    });
375  });
376}
377
378var backButton = document.getElementById("backButton");
379
380if (backButton) {
381  backButton.addEventListener("click", function (event) {
382    window.location.reload();
383  });
384}
385
386document.querySelectorAll(".col-md-8 ul li").forEach(function (menuItem) {
387  const sousMenu = menuItem.querySelector(".sous_menu");
388  const arrowIcon = menuItem.querySelector("i.fa-chevron-down");
389  let timeout;
390
391  if (sousMenu) {
392    menuItem.addEventListener("mouseenter", function () {
393      clearTimeout(timeout);
394      sousMenu.style.display = "block";
395      sousMenu.style.maxHeight = sousMenu.scrollHeight + "px";
396      sousMenu.style.opacity = "1";
397
398      if (arrowIcon) {
399        arrowIcon.classList.add("rotate");
400        arrowIcon.classList.remove("rotate-inverse");
401      }
402    });
403
404    menuItem.addEventListener("mouseleave", function () {
405      timeout = setTimeout(() => {
406        sousMenu.style.maxHeight = "0px";
407        sousMenu.style.opacity = "0";
408
409        if (arrowIcon) {
410          arrowIcon.classList.add("rotate-inverse");
411          arrowIcon.classList.remove("rotate");
412        }
413
414        sousMenu.addEventListener(
415          "transitionend",
416          () => {
417            if (sousMenu.style.opacity === "0") sousMenu.style.display = "none";
418          },
419          { once: true }
420        );
421      }, 200);
422    });
423  }
424});
425
426// optimise google maps
427document.addEventListener("DOMContentLoaded", function () {
428  let mapContainers = document.getElementsByClassName("map-container");
429
430  let observer = new IntersectionObserver((entries) => {
431    entries.forEach((entry) => {
432      if (entry.isIntersecting) {
433        loadGoogleMaps(entry.target);
434        observer.unobserve(entry.target);
435      }
436    });
437  });
438
439  Array.prototype.forEach.call(mapContainers, (container) => {
440    observer.observe(container);
441  });
442
443  function loadGoogleMaps(mapContainer) {
444    let address = mapContainer.getAttribute("data-address");
445    let zoom = mapContainer.getAttribute("data-zoom");
446    let iframe = document.createElement("iframe");
447    iframe.id = "googleMap";
448    iframe.title = "Google map";
449    iframe.src = `https://www.google.com/maps?q=${address}&z=${zoom}&output=embed`;
450    iframe.width = "100%";
451    iframe.height = "500px";
452    iframe.style.border = "0";
453    iframe.allowFullscreen = "";
454    iframe.loading = "lazy";
455    iframe.referrerPolicy = "no-referrer-when-downgrade";
456
457    mapContainer.appendChild(iframe);
458  }
459});
460
461// product page, display the other image on hover
462document.querySelectorAll(".image_product").forEach(function (image) {
463  var originalSrc = image.src;
464  var otherImages = image.getAttribute("data-other-images");
465  image.style.transition = "opacity 0.2s ease-in-out";
466
467  var preloadImage = new Image();
468  if (otherImages) {
469    preloadImage.src = otherImages;
470
471    preloadImage.onload = function () {
472      image.addEventListener("mouseenter", function () {
473        image.style.opacity = "0.5";
474        setTimeout(function () {
475          image.src = otherImages;
476          image.style.opacity = "1";
477        }, 200);
478      });
479
480      image.addEventListener("mouseleave", function () {
481        image.style.opacity = "0.5";
482        setTimeout(function () {
483          image.src = originalSrc;
484          image.style.opacity = "1";
485        }, 200);
486      });
487    };
488  }
489});
490
491// page product hover new image
492document.addEventListener("DOMContentLoaded", function () {
493  const littleImages = document.querySelectorAll(".little_image img");
494  const bigImage = document.getElementById("big-image");
495
496  if (littleImages.length > 0 && bigImage) {
497    littleImages[0].classList.add("img_little_active");
498
499    littleImages.forEach((image) => {
500      image.addEventListener("mouseover", function () {
501        bigImage.classList.add("fade");
502        bigImage.src = this.src;
503        bigImage.onload = function () {
504          bigImage.classList.remove("fade");
505        };
506        littleImages.forEach((img) =>
507          img.classList.remove("img_little_active")
508        );
509        this.classList.add("img_little_active");
510      });
511    });
512  }
513});
514
515// display form panier
516document.addEventListener("DOMContentLoaded", function () {
517  const openPopupButton = document.getElementById("openPopup");
518  const infoPopup = document.getElementById("infoPopup");
519  const leftSidePanier = document.getElementById("left_side_panier");
520  const backToCoordonneesButton = document.getElementById("backToCoordonnees");
521  const backToCoordonneesButton2 =
522    document.getElementById("backToCoordonnees2");
523
524  const sectionCoordonnees = document.getElementById("section-coordonnees");
525  const sectionAdresse = document.getElementById("section-adresse");
526  const sectionPayment = document.getElementById("section-payment");
527
528  const nextToAddressButton = document.getElementById("nextToAddress");
529  const backToAddressButton = document.getElementById("backToAddress");
530  const nextToPaymentButton = document.getElementById("nextToPayment");
531
532  const validateCoordonnees = () => {
533    const nom = document.getElementById("nom").value.trim();
534    const prenom = document.getElementById("prenom").value.trim();
535    const email = document.getElementById("email").value.trim();
536    const numero = document.getElementById("numero").value.trim();
537
538    const isValid = nom && prenom && email && numero;
539    nextToAddressButton.disabled = !isValid;
540    nextToAddressButton.classList.toggle("disabled", !isValid);
541  };
542
543  const validateAdresse = () => {
544    const adresse = document.getElementById("adresse").value.trim();
545    const codePostal = document.getElementById("code_postal").value.trim();
546    const ville = document.getElementById("ville").value.trim();
547
548    const isValid = adresse && codePostal && ville;
549    nextToPaymentButton.disabled = !isValid;
550    nextToPaymentButton.classList.toggle("disabled", !isValid);
551  };
552
553  // Navigation entre les sections
554  if (nextToAddressButton) {
555    nextToAddressButton.onclick = function () {
556      sectionCoordonnees.style.display = "none";
557      sectionAdresse.style.display = "block";
558    };
559  }
560
561  if (backToCoordonneesButton) {
562    backToCoordonneesButton.onclick = function () {
563      sectionAdresse.style.display = "none";
564      sectionCoordonnees.style.display = "block";
565    };
566  }
567
568  if (backToCoordonneesButton2) {
569    backToCoordonneesButton2.onclick = function () {
570      sectionAdresse.style.display = "none";
571      sectionCoordonnees.style.display = "block";
572    };
573  }
574
575  // Validation et affichage du résumé lors du clic sur Suivant (nextToPayment)
576  if (nextToPaymentButton) {
577    nextToPaymentButton.onclick = function () {
578      // Cacher la section adresse et afficher la section paiement
579      sectionAdresse.style.display = "none";
580      sectionPayment.style.display = "block";
581
582      // Mettre à jour les valeurs du résumé
583      document.getElementById("nomResume").textContent =
584        document.getElementById("nom").value;
585      document.getElementById("prenomResume").textContent =
586        document.getElementById("prenom").value;
587      document.getElementById("emailResume").textContent =
588        document.getElementById("email").value;
589      document.getElementById("numeroResume").textContent =
590        document.getElementById("numero").value;
591      document.getElementById("adresseResume").textContent =
592        document.getElementById("adresse").value;
593      document.getElementById("codePostalResume").textContent =
594        document.getElementById("code_postal").value;
595      document.getElementById("villeResume").textContent =
596        document.getElementById("ville").value;
597    };
598  }
599
600  if (backToAddressButton) {
601    backToAddressButton.onclick = function () {
602      sectionPayment.style.display = "none";
603      sectionAdresse.style.display = "block";
604    };
605  }
606
607  // Validation des champs du formulaire
608  document.querySelectorAll("#section-coordonnees input").forEach((input) => {
609    input.addEventListener("input", validateCoordonnees);
610  });
611
612  document.querySelectorAll("#section-adresse input").forEach((input) => {
613    input.addEventListener("input", validateAdresse);
614  });
615
616  // Afficher et masquer le popup des informations panier
617  if (openPopupButton && infoPopup && leftSidePanier) {
618    openPopupButton.onclick = function () {
619      leftSidePanier.style.display = "none";
620      infoPopup.style.display = "block";
621      openPopupButton.style.display = "none";
622    };
623  }
624
625  if (backToCoordonneesButton) {
626    backToCoordonneesButton.onclick = function () {
627      infoPopup.style.display = "none";
628      leftSidePanier.style.display = "block";
629      openPopupButton.style.display = "flex";
630    };
631  }
632});
633
634// close promotion message
635function hidePromotion() {
636  document.getElementById("promotionMessage").classList.remove("show");
637  localStorage.setItem("promotionHidden", "true");
638}
639
640function checkPromotionStatus() {
641  const promotionMessage = document.getElementById("promotionMessage");
642  if (promotionMessage && localStorage.getItem("promotionHidden") !== "true") {
643    promotionMessage.classList.add("show");
644  }
645}
646
647document.addEventListener("DOMContentLoaded", checkPromotionStatus);
648
649const closeBtnPromotion = document.getElementById("closebtn_promotion");
650
651if (closeBtnPromotion) {
652  closeBtnPromotion.addEventListener("click", hidePromotion);
653}
654
655setTimeout(() => {
656  if (document.getElementById("promotionMessage")) {
657    hidePromotion();
658  }
659}, 10000);
660
661// btn procede to payement
662document.addEventListener("DOMContentLoaded", function () {
663  if (window.location.hash === "#section-payment") {
664    document.getElementById("left_side_panier").style.display = "none";
665    document.getElementById("section-adresse").style.display = "none";
666    document.getElementById("openPopup").style.display = "none";
667    document.getElementById("infoPopup").style.display = "block";
668  }
669});
670
671// Page video pause de video
672document.querySelectorAll(".video-player").forEach((video) => {
673  video.addEventListener("play", function () {
674    this.pause();
675  });
676});
677
678// page contact form / anti bot
679document.addEventListener("DOMContentLoaded", function () {
680  const tempsDebutElement = document.getElementById("temps_debut");
681
682  if (tempsDebutElement) {
683    tempsDebutElement.value = Date.now();
684  }
685});
686
687function verifierTempsSoumission() {
688  const tempsDebut = document.getElementById("temps_debut").value;
689  const tempsSoumission = Date.now() - tempsDebut;
690  if (tempsSoumission < 3000) {
691    window.history.back();
692    return false;
693  }
694
695  const additionUtilisateur = document.getElementById("addition").value;
696  if (parseInt(additionUtilisateur) !== sommeCorrecte) {
697    window.history.back();
698    return false;
699  }
700
701  document.getElementById("formulaire_contact").submit();
702  return true;
703}
704
705// modal open rdv
706document.addEventListener("DOMContentLoaded", () => {
707  const openModalButtonRdv = document.getElementById("openModalButtonRdv");
708  const openModalButtonRdvContact = document.getElementById(
709    "openModalButtonRdvContact"
710  );
711  const modalRdv = document.getElementById("calendlyModal");
712  const closeButtonRdv = document.getElementById("close-button-rdv");
713
714  if (
715    openModalButtonRdv ||
716    (openModalButtonRdvContact && modalRdv && closeButtonRdv)
717  ) {
718    if (openModalButtonRdv) {
719      openModalButtonRdv.addEventListener("click", () => {
720        modalRdv.style.display = "flex";
721      });
722    }
723
724    if (openModalButtonRdvContact) {
725      openModalButtonRdvContact.addEventListener("click", () => {
726        modalRdv.style.display = "flex";
727      });
728    }
729
730    closeButtonRdv.addEventListener("click", () => {
731      modalRdv.style.display = "none";
732    });
733
734    modalRdv.addEventListener("click", (event) => {
735      if (event.target === modalRdv) {
736        modalRdv.style.display = "none";
737      }
738    });
739  }
740});
741
742
743// carte cadeau
744const closeBtnCarteCadeau = document.getElementById("btn-close-carte-cadeau");
745if (closeBtnCarteCadeau) {
746    closeBtnCarteCadeau.addEventListener("click", function () {
747        document.getElementById("carte_cadeau_modal").style.display = "none";
748    });
749}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.