PageSourceSearch

https://www.lihus.fr/wp-content/themes/visibilite/assets/js/old/script.js?ver=7.1

js lihus.fr collected 2026-09-25 12:15:34 UTC 19,326 bytes, 497 lines download raw bytes

1// /* <-------------------- TOUTES PAGES | Tirroir --------------------> */
2
3// //uses classList, setAttribute, and querySelectorAll
4// //if you want this to work in IE8/9 youll need to polyfill these
5// (function () {
6//     var d = document,
7//         accordionToggles = d.querySelectorAll(".js-accordionTrigger"),
8//         setAria,
9//         setAccordionAria,
10//         switchAccordion,
11//         touchSupported = "ontouchstart" in window,
12//         pointerSupported = "pointerdown" in window;
13
14
15//     skipClickDelay = function (e) {
16//         e.preventDefault();
17//         e.target.click();
18//     };
19
20//     setAriaAttr = function (el, ariaType, newProperty) {
21//         el.setAttribute(ariaType, newProperty);
22//     };
23//     setAccordionAria = function (el1, el2, expanded) {
24//         switch (expanded) {
25//             case "true":
26//                 setAriaAttr(el1, "aria-expanded", "true");
27//                 setAriaAttr(el2, "aria-hidden", "false");
28//                 break;
29//             case "false":
30//                 setAriaAttr(el1, "aria-expanded", "false");
31//                 setAriaAttr(el2, "aria-hidden", "true");
32//                 break;
33//             default:
34//                 break;
35//         }
36//     };
37//     //function
38//     switchAccordion = function (e) {
39//         console.log("triggered");
40//         e.preventDefault();
41//         var thisAnswer = e.target.parentNode.nextElementSibling;
42//         var thisQuestion = e.target;
43//         if (thisAnswer.classList.contains("is-collapsed")) {
44//             setAccordionAria(thisQuestion, thisAnswer, "true");
45//         } else {
46//             setAccordionAria(thisQuestion, thisAnswer, "false");
47//         }
48//         thisQuestion.classList.toggle("is-collapsed");
49//         thisQuestion.classList.toggle("is-expanded");
50//         thisAnswer.classList.toggle("is-collapsed");
51//         thisAnswer.classList.toggle("is-expanded");
52//         thisAnswer.classList.toggle("animateIn");
53//     };
54//     for (var i = 0, len = accordionToggles.length; i < len; i++) {
55//         if (touchSupported) {
56//             accordionToggles[i].addEventListener(
57//                 "touchstart",
58//                 skipClickDelay,
59//                 false
60//             );
61//         }
62//         if (pointerSupported) {
63//             accordionToggles[i].addEventListener(
64//                 "pointerdown",
65//                 skipClickDelay,
66//                 false
67//             );
68//         }
69//         accordionToggles[i].addEventListener("click", switchAccordion, false);
70//     }
71// })();
72
73// /* <------------------------------------------------------------------> */
74
75// /* <---------------------------------------------------------------------------------> */
76
77// /* <-------------------- TOUTES PAGES - HEADER | Add a div to media screen mobile in navbar (menuburger) --------------------> */
78
79// var navbar = document.getElementById("header-nav");
80// var parent = document.createElement("div");
81// parent.setAttribute("id", "burger-search");
82// var nav = document.querySelector(".menu-principal");
83// var search = document.querySelector(".search-nav");
84// var formSearch = document.getElementById("search-forms");
85// var headerComplet = document.querySelector("div.header-complet");
86
87// function functionMax(x) {
88//     if (x.matches) {
89//         // If media query matches
90//         navbar.appendChild(parent);
91//         parent.appendChild(nav);
92//         parent.appendChild(search);
93//         parent.appendChild(formSearch);
94//     } else {
95//         $(parent).find(formSearch).unwrap();
96//         $(parent).find(search).unwrap();
97//         $(parent).find(nav).unwrap();
98//         $(navbar).find(parent).unwrap();
99//         $(parent).remove();
100//         nav.appendChild(search);
101//     }
102// }
103
104// var x = window.matchMedia("(max-width: 1024px)");
105// //functionMax(x); // Call listener function at run time
106// x.addListener(functionMax); // Attach listener function on state changes
107
108// /* <---------------------------------------------------------------------------------> */
109
110// /* <--------------------- TOUTES PAGES | Sticky Menu (Appel sticky et back to top on.scroll) --------------------> */
111
112// // When the user scrolls the page, execute myFunction
113// window.onscroll = function () {
114//     myFunction();
115//     btnFunction();
116//     searchFunction();
117// };
118
119// // Get the header
120// var header = document.getElementById("header-nav");
121// var headerComplet = document.querySelector("header > div:last-of-type");
122
123// var page = document.querySelector("div.first");
124
125// // Get the offset position of the navbar
126// if (header) {
127//     var sticky = header.offsetTop;
128
129//     // Add the sticky class to the header when you reach its scroll position. Remove "sticky" when you leave the scroll position
130//     function myFunction() {
131//         if (window.pageYOffset > sticky) {
132//             header.classList.add("sticky");
133//         } else {
134//             header.classList.remove("sticky");
135//         }
136//     }
137// }
138
139// /* <---------------------------------------------------------------------------------> */
140
141// /* <-------------------- TOUTES PAGES | Bouton back-to-top --------------------> */
142
143// //Get the button:
144// mybutton = document.getElementById("boutonTop");
145
146// function btnFunction() {
147//     if (
148//         document.body.scrollTop > 250 ||
149//         document.documentElement.scrollTop > 250
150//     ) {
151//         mybutton.style.display = "flex";
152//     } else {
153//         mybutton.style.display = "none";
154//     }
155// }
156
157// // When the user clicks on the button, scroll to the top of the document
158// function topFunction() {
159//     document.body.scrollTop = 0; // For Safari
160//     document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
161// }
162
163// /* <---------------------------------------------------------------------------------> */
164
165// /* <-------------------- TOUTES PAGES | Supprimer class sticky lorsque moteur de recherche déployé --------------------> */
166
167// if (header) header.classList.remove("sticky");
168
169// const searchForm = document.getElementById("search-forms");
170
171// if (searchForm) {
172//     const searchIcon = document.getElementById("search-link");
173//     const closeSearchIcon = document.getElementById("close-search-form");
174
175//     searchIcon.addEventListener("click", () => {
176//         searchForm.classList.remove("hide");
177//     });
178
179//     closeSearchIcon.addEventListener("click", () => {
180//         searchForm.classList.add("hide");
181//     });
182// }
183
184// /* <---------------------------------------------------------------------------------> */
185
186// /* <-------------------- TOUTES PAGES - Ajouter span indicator au dernier lien parent (Vie quotidienne) --------------------> */
187
188// var listMenu = document.querySelectorAll(
189//     "#mega-menu-wrap-menu-principal #mega-menu-menu-principal > li.mega-menu-item"
190// );
191
192// for (i = 0; i < listMenu.length; i++) {
193//     var spanRond = document.createElement("span");
194//     spanRond.setAttribute("class", "separateur-point");
195//     spanRond.setAttribute("aria-hidden", "true");
196
197//     $(listMenu[i]).after($(spanRond));
198// }
199
200// /* <---------------------------------------------------------------------------------> */
201
202// /* <-------------------- TOUTES PAGES - MODAL RECHERCHE INPUT ET BOUTON FLEX-DIRECTION --------------------> */
203
204// var searchG = document.getElementById("search-header");
205// var inputSearch = document.getElementById("s");
206// var formulaireSearch = document.getElementById("searchform");
207
208// // var inputSearch = searchGroup.getElementById("input-search");
209// // var buttonSearch = searchGroup.querySelector("button.button-red");
210
211// function functionModalSearch(s) {
212//     if (s.matches) {
213//         // If media query matches
214//         if (searchG != null) searchG.style.flexDirection = "column";
215//         if (searchG != null) formulaireSearch.style.border = "none";
216//         if (searchG != null)
217//             inputSearch.style.borderBottom = "solid 2px #556271";
218//         if (searchG != null) inputSearch.style.paddingBottom = "1.6rem";
219//         if (searchG != null) inputSearch.style.marginBottom = "2.4rem";
220//     } else {
221//         if (searchG != null) searchG.style.flexDirection = "row";
222//         if (searchG != null)
223//             formulaireSearch.style.borderBottom = "solid 2px #556271";
224//         if (searchG != null) inputSearch.style.border = "none";
225//         if (searchG != null) inputSearch.style.paddingBottom = "0";
226//         if (searchG != null) inputSearch.style.marginBottom = "0";
227//     }
228// }
229
230// var s = window.matchMedia("(max-width: 900px)");
231// functionModalSearch(s); // Call listener function at run time
232// s.addListener(functionModalSearch); // Attach listener function on state changes
233
234// /* <---------------------------------------------------------------------------------> */
235
236// /* <-------------------- TOUTES PAGES | Lien actif au click (ajout d'une classe pour changer le comportement du soulignement) --------------------> */
237
238// $(document).ready(function () {
239//     $("main a").click(function (event) {
240//         //remove all pre-existing active classes
241//         $(".active").removeClass("active");
242
243//         //add the active class to the link we clicked
244//         $(this).addClass("active");
245//     });
246// });
247
248// /* <---------------------------------------------------------------------------------> */
249
250// /* <-------------------- PAGE D'ACCUEIL - GAZETTES EN COLONNE EN TOUT PETIT FORMAT --------------------> */
251
252// var gazette = document.querySelectorAll("div.container-publications");
253// var contenuGazette = document.querySelectorAll("div.contenu-gazette");
254// var imgGazette = document.querySelectorAll("div.boucle-publications img");
255// var boucleGazette = document.querySelector("div.boucle-publications");
256
257// function functionGazette(g) {
258//     if (g.matches) {
259//         // If media query matches
260//         for (i = 0; i < gazette.length; i++) {
261//             gazette[i].style.display = "inline-grid";
262//             gazette[i].style.maxWidth = "17.9rem";
263//         }
264//         for (i = 0; i < gazette.length; i++) {
265//             imgGazette[i].classList.add("img-gazette");
266//             imgGazette[i].style.maxWidth = "100%";
267//         }
268//     } else {
269//         for (i = 0; i < gazette.length; i++) {
270//             gazette[i].style.display = "flex";
271//             gazette[i].style.maxWidth = "42.9rem";
272//         }
273//         for (i = 0; i < gazette.length; i++) {
274//             imgGazette[i].classList.remove("img-gazette");
275//             imgGazette[i].style.maxWidth = "20.2rem";
276//         }
277//     }
278// }
279
280// var g = window.matchMedia("(max-width: 360px)");
281// functionGazette(g); // Call listener function at run time
282// g.addListener(functionGazette); // Attach listener function on state changes
283
284// /* <---------------------------------------------------------------------------------> */
285
286// /* <-------------------- PAGE D'ACCUEIL - FOOTER RESEAUX SOCIAUX MARGIN DE COLUMN À ROW --------------------> */
287
288// var iconReseaux = document.getElementById("icon-reseaux");
289// var pointMenu = document.querySelector(
290//     "ul#menu-footer > li:last-of-type > span.point-menu"
291// );
292// var lastListFooter = document.querySelector("ul#menu-footer > li:last-of-type");
293
294// function functionReseaux(r) {
295//     if (r.matches) {
296//         // If media query matches
297//         if (iconReseaux != null) {
298//             iconReseaux.style.marginTop = "1.6rem";
299//         }
300//         if (pointMenu != null) {
301//             pointMenu.style.display = "none";
302//         }
303//         if (lastListFooter != null) {
304//             lastListFooter.style.marginRight = "2.1rem";
305//         }
306//     } else {
307//         if (iconReseaux != null) {
308//             iconReseaux.style.marginTop = "0";
309//         }
310//         if (pointMenu != null) {
311//             pointMenu.style.display = "inline-block";
312//         }
313//         if (lastListFooter != null) {
314//             lastListFooter.style.marginRight = "0";
315//         }
316//     }
317// }
318
319// var r = window.matchMedia("(max-width: 371px)");
320// functionReseaux(r); // Call listener function at run time
321// r.addListener(functionReseaux); // Attach listener function on state changes
322
323// /* <---------------------------------------------------------------------------------> */
324
325// /* <-------------------- TOUTES PAGES | Bloc de droite : taille variante selon taille écran --------------------> */
326
327// var blocDroite1 = document.querySelector(".bloc-droite1");
328
329// function functionBloc(b) {
330//     if (b.matches) {
331//         // If media query matches
332//         if (blocDroite1 != null) {
333//             blocDroite1.style.minWidth = "23rem";
334//         }
335//     } else {
336//         if (blocDroite1 != null) {
337//             blocDroite1.style.maxWidth = "31rem";
338//         }
339//     }
340// }
341
342// var b = window.matchMedia("(max-width: 412px)");
343// functionBloc(b); // Call listener function at run time
344// b.addListener(functionBloc); // Attach listener function on state changes
345
346// /* <---------------------------------------------------------------------------------> */
347
348// /* Fil d'ariane */
349// var arianepage = document.querySelector(".post-page");
350
351// $(arianepage).addClass("noanim");
352
353
354// /* <------------------------------------- MODIFS RGAA --------------------------------------------> */
355
356// /* Remplacement et rendement accessible des span généré par MaxMegaMenu */
357// $("#mega-menu-wrap-menu-principal span.mega-indicator").replaceWith(function () {
358//     var $button = $("<button/>", {
359//         html: $(this).html(),
360//         class: $(this).attr("class")
361//     });
362//     $button.attr("aria-expanded", "false");
363//     $button.attr("aria-haspopup", "false");
364//     return $button;
365// });
366// $("#mega-menu-wrap-menu-principal span.mega-toggle-label").replaceWith(function () {
367//     var $button = $("<button/>", {
368//         html: $(this).html(),
369//         class: $(this).attr("class")
370//     });
371//     $button.addClass("default-disabled");
372//     return $button;
373// });
374// $("#mega-menu-wrap-menu-principal span.mega-toggle-label-closed").replaceWith(function () {
375//     var $button = $("<button/>", {
376//         html: $(this).html(),
377//         class: $(this).attr("class")
378//     });
379//     $button.addClass("default-disabled");
380//     return $button;
381// });
382// $("#mega-menu-wrap-menu-principal span.mega-toggle-label-open").replaceWith(function () {
383//     var $button = $("<button/>", {
384//         html: $(this).html(),
385//         class: $(this).attr("class")
386//     });
387//     $button.addClass("default-disabled");
388//     return $button;
389// });
390
391// var megaToggleLabelButton = document.querySelector('.mega-menu-toggle');
392// var megaToggleLabelOpen = document.querySelector('.mega-toggle-label-open');
393// var megaToggleLabelClosed = document.querySelector('.mega-toggle-label-closed');
394
395// megaToggleLabelButton.addEventListener("click", function () {
396//     var isExpanded = document.querySelector('.mega-toggle-label').getAttribute('aria-expanded') === 'true';
397
398//     if (isExpanded) {
399//         megaToggleLabelOpen.setAttribute('tabindex', '-1');
400//         megaToggleLabelOpen.setAttribute('aria-hidden', 'true');
401//         megaToggleLabelClosed.removeAttribute('tabindex');
402//         megaToggleLabelClosed.setAttribute('aria-hidden', 'false');
403//         var menuPrincipalUl = document.querySelector('#mega-menu-menu-principal');
404//         var firstChildLi = menuPrincipalUl.querySelector('li:first-child');
405//         var firstChildLink = firstChildLi.querySelector('a.mega-menu-link');
406//         firstChildLink.focus();
407//     } else {
408//         megaToggleLabelClosed.setAttribute('tabindex', '-1');
409//         megaToggleLabelClosed.setAttribute('aria-hidden', 'true');
410//         megaToggleLabelOpen.removeAttribute('tabindex');
411//         megaToggleLabelOpen.setAttribute('aria-hidden', 'false');
412//     }
413// });
414
415
416
417
418// function checkMobileView() {
419//     var isMobile = ($("#mega-menu-wrap-menu-principal .mega-menu-toggle").
419css("display") !== "none");
420
421//     if (isMobile) {
422//         $("#mega-menu-wrap-menu-principal button.mega-indicator").removeAttr("aria-hidden");
423//         $("#mega-menu-wrap-menu-principal button.mega-indicator").removeAttr("tabindex");
424//     } else {
425//         $("#mega-menu-wrap-menu-principal button.mega-indicator").attr("tabindex", "-1");
426//         $("#mega-menu-wrap-menu-principal button.mega-indicator").attr("aria-hidden", "true");
427//         $("#mega-menu-wrap-menu-principal button.mega-indicator").on("focus", function () {
428//             $(this).next().focus(); // Déplace le focus vers l'élément suivant
429//         });
430//     }
431// }
432// $(document).ready(function () {
433//     checkMobileView();
434// });
435// $(window).resize(function () {
436//     checkMobileView();
437// });
438
439// /* Gestion des focus dans la modal de recherche */
440// $(document).ready(function () {
441//     $("#search-link").on('click', function () {
442//         var modal = $("#search-forms");
443//         var focusableElements = modal.find('input, button, select, textarea, a[href]').filter(':visible');
444//         var lastFocusableElementIndex = focusableElements.length - 1;
445
446//         focusableElements.on('keydown', function (e) {
447//             if (e.key === "Tab" || e.keyCode === 9) {
448//                 if (e.shiftKey) {
449//                     if ($(this).is(focusableElements.first())) {
450//                         e.preventDefault();
451//                         focusableElements[lastFocusableElementIndex].focus();
452//                     }
453//                 } else {
454//                     if ($(this).is(focusableElements[lastFocusableElementIndex])) {
455//                         e.preventDefault();
456//                         focusableElements[0].focus();
457//                     }
458//                 }
459//             }
460//         });
461//         focusableElements.first().focus();
462//         $(document).keydown(function (event) {
463//             if (event.keyCode === 27) { // Vérifie si la touche enfoncée est "Échap" (code 27)
464//                 $('#close-search-form').click(); // Déclenche un clic sur le bouton avec l'ID "close-search-form"
465//             }
466//         });
467//     });
468// });
469
470// // $(document).ready(function() {
471
472// // // Sélectionne toutes les div avec la classe wp-block-lazyblock-fichier-pdf
473// // const divsWithClass = document.querySelectorAll('div.wp-block-lazyblock-fichier-pdf');
474
475// // // Boucle sur chaque élément sélectionné
476// // divsWithClass.forEach((div) => {
477// //   // Crée un nouvel élément li
478// //   const li = document.createElement('li');
479// //   // Copie le contenu de la div dans le nouvel élément li
480// //   li.innerHTML = div.innerHTML;
481// //   // Remplace la div par le nouvel élément li dans le DOM
482// //   div.parentNode.replaceChild(li, div);
483// // });
484
485// // });
486
487
488
489// $(document).ready(function () {
490//     $("figure.wp-block-image > img + figcaption").each(function () {
491//         var captionText = $(this).text();
492//         $(this).parent("figure.wp-block-image").attr("role", "group").attr("aria-label", captionText);
493//     });
494//     $("figure.wp-block-table > table").each(function () {
495//         $(this).attr("role", "presentation");
496//     });
497// });

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.