PageSourceSearch

https://www.hirondelle.org/wp-content/themes/hirondelle/assets/js/template.js?ver=1790282858

js hirondelle.org collected 2026-09-24 20:49:46 UTC 14,696 bytes, 582 lines download raw bytes

1window.addEventListener('load', function() {
2    // Récupère le hash de l'URL sans le symbole '#'
3    const hash = window.location.hash.substring(1);
4
5    // Crée un objet URLSearchParams pour extraire les paramètres
6    const params = new URLSearchParams(hash);
7
8    // Vérifie si le paramètre "openDetail" est présent
9    if (params.has('openDetail')) {
10        const elementId = params.get('openDetail');
11        
12        // Sélectionne l'élément avec la classe dynamique "detail-[elementId]"
13        const element = document.querySelector(`.detail-${elementId}`);
14
15        // Si l'élément existe, ajoute l'attribut "open" et scrolle jusqu'à lui
16        if (element) {
17            element.setAttribute("open", "");
18            element.scrollIntoView({ behavior: 'smooth', block: 'start' });
19        } else {
20            console.warn(`Élément avec la classe "detail-${elementId}" introuvable.`);
21        }
22    }
23	
24	/*
25	 * Back to top
26	 */
27	let backToTopButton = document.getElementById("back-to-top");
28	window.onscroll = function () {
29		scrollFunction();
30	};
31	function scrollFunction() {
32		const header = document.querySelector(".header");
33		const headerHeight = header.offsetHeight;
34		if (
35			document.body.scrollTop > headerHeight ||
36			document.documentElement.scrollTop > headerHeight
37		) {
38			backToTopButton.classList.remove('d-none');
39		} else {
40			backToTopButton.classList.add('d-none');
41		}
42	}
43	backToTopButton.addEventListener("click", backToTop);
44	function backToTop() {
45		document.body.scrollTop = 0;
46		document.documentElement.scrollTop = 0;
47	}
48	
49	/*
50	 * Inscription aux newsletters
51	 */
52	jQuery(document).on('click', '[name^="group\[17625\]"]', function(evt) {
53        jQuery("#newsletterchoices").val(jQuery('.input-group--newsletters input:checked').map(function() {
54            return this.value;
55        }).get().join(','));
56        return true;
57    });
58});
59
60jQuery(function()
61{
62	var menuIsLocked = false;
63	if (jQuery('body').hasClass('home')) {
64		jQuery(window).on('scroll', function(event) {
65			// event.preventDefault();
66			if (jQuery(window).scrollTop() > 10 && jQuery('body').hasClass('navbar-is-fixed-top') == false ) {
67				jQuery('body').addClass('navbar-is-fixed-top');
68			}
69			else if (jQuery(window).scrollTop() <= 10 && jQuery('body').hasClass('navbar-is-fixed-top') == true ) {
70				jQuery('body').removeClass('navbar-is-fixed-top');
71			}
72		});
73	}
74	
75	if (jQuery('.js-inTheFieldSlider').length > 0) {
76		jQuery('.js-inTheFieldSlider').slick({
77			dots: true,
78			infinite: true,
79			speed: 300,
80			slidesToShow: 4,
81			slidesToScroll: 1,
82			// variableWidth: true,
83			customPaging: function(slider, i) {
84				return jQuery('<span class="slick-dot" />').text(i + 1);
85			},
86			responsive: [
87				{
88				  breakpoint: 1024,
89				  settings: {
90					slidesToShow: 3,
91					slidesToScroll: 3,
92					infinite: true,
93					dots: true
94				  }
95				},
96				{
97				  breakpoint: 600,
98				  settings: {
99					slidesToShow: 2,
100					slidesToScroll: 2
101				  }
102				},
103				{
104				  breakpoint: 480,
105				  settings: {
106					slidesToShow: 1,
107					slidesToScroll: 1
108				  }
109				}
110				// You can unslick at a given breakpoint now by adding:
111				// settings: "unslick"
112				// instead of a settings object
113			]
114		});
115	}
116	
117	/*
118	 * Ajustement des légendes dans les images ferrées dans l'article
119	 */
120	jQuery(".articleText figure:has(img[width]) figcaption").each(function(){
121		jQuery(this).width(jQuery(this).parents("figure").eq(0).find("img").width());
122	})
123	
124	
125	if (jQuery('.count-up').length > 0) {
126		const counterUp = window.counterUp.default
127		jQuery('.count-up').each(function(){
128			
129			counterUp( jQuery(this)[0], {
130				duration: 5000,
131				delay: 16,
132			} )
133			
134		});
135	}
136	
137	/*
138	 * Cookies
139	 */
140	/*
141	if (!jQuery.cookie("site-cookie-accept"))
142	{
143		var cookiesText = 'En poursuivant votre navigation sur ce site, vous acceptez l\'utilisation de cookies. <button class="CookieNotification-close js-closeCookieNotification jiButton">OK</button> <a href="/politique-de-confidentialite" class="CookieNotification-link jiButton">En savoir plus</a>';
144		var messageContainer = jQuery(
145			'<div class="CookieNotification">' +
146				'<span class="CookieNotification-text">' + cookiesText + '</span>' +
147			'</div>'
148		);
149
150		messageContainer.on("click", ".js-closeCookieNotification", function()
151		{
152			jQuery.cookie("site-cookie-accept", "1", { expires: 365, path: "/" });
153			messageContainer.remove();
154		});
155
156		jQuery("body").prepend(messageContainer);
157	}
158	*/
159	
160	/*
161	 * Search
162	 */
163	var searchOverlay = jQuery(".SiteHeader-search", this);
164
165	jQuery(document).on("click", ".js-toggleSearchOverlay, .js-showSearchOverlay, .js-hideSearchOverlay", function(event)
166	{
167		event.preventDefault();
168
169		var element = jQuery(this);
170
171		if (element.hasClass("js-showSearchOverlay") || (element.hasClass("js-toggleSearchOverlay") && !searchOverlay.hasClass("is-visible")))
172		{
173			showOverlay(searchOverlay, {
174				show: function()
175				{
176					jQuery(".js-searchQueryField", searchOverlay).focus();
177				}
178			});
179		}
180		else if (element.hasClass("js-hideSearchOverlay"))
181		{
182			hideOverlay(searchOverlay);
183		}
184	});
185	
186	// 
187	jQuery('.js-pagination').each(function(index, listElement) {
188		// console.log('uuuuuuuuuuu', jQuery(listElement).attr('id'));
189		var monkeyList = new List('toto', {
190		  page: 9,
191		  pagination: true
192		});
193	});
194	
195});
196
197(function()
198{
199/******************************************************************************
200 * Overlay
201 *****************************************************************************/
202	var baseZIndex = 100000000 + 1000;	//$baseOverlayZIndex
203	var zIndexStep = 10;
204
205	var elements = {};
206	var cursorIndex = 0;
207
208	var overlay;
209
210	function showOverlay(element, parameters)
211	{
212		var elementIndex;
213		element = jQuery(element);
214
215		if (element.length)
216		{
217			// Recherche de l'élément dans la pile
218			var i = 0;
219			while ((i < cursorIndex) && (elementIndex === undefined))
220			{
221				if (elements[i] == element)
222				{
223					elementIndex = i;
224				}
225
226				++i;
227			}
228
229			if (typeof(parameters) !== "object")
230			{
231				parameters = {};
232			}
233
234			// Si l'élément existait déjà, il est retiré de la pile car il va y être remis à sa nouvelle place
235			if (elementIndex !== undefined)
236			{
237				parameters = jQuery.extend(elements[i].parameters, parameters);
238			}
239
240			// Il n'y a besoin de replacer l'élément que s'il n'existait pas ou n'était pas déjà à la bonne place
241			if ((elementIndex === undefined) || (elementIndex != cursorIndex - 1))
242			{
243				delete elements[elementIndex];
244
245				elementIndex = cursorIndex;
246				++cursorIndex;
247			}
248
249			// L'élément est ajouté à la pile
250			elements[elementIndex] = {
251				element: element,
252				parameters: parameters
253			};
254
255			var elementZIndex = baseZIndex + elementIndex * zIndexStep;
256
257			setOverlayZIndex(elementZIndex);
258			element.css("z-index", elementZIndex + 1);
259			element.addClass("is-visible");
260
261			if (typeof(parameters.show) === "function")
262			{
263				parameters.show(element, elementZIndex, elementIndex);
264			}
265		}
266		
267		jQuery(".t3-wrapper").css('z-index', 'inherit');
268	}
269
270	function hideOverlay(element, parameters)
271	{
272		var hasHidden = false;
273
274		var elementIndex;
275		if (element === undefined)
276		{
277			var i = cursorIndex;
278
279			while (i-- && (elementIndex === undefined))
280			{
281				if (elements[i])
282				{
283					elementIndex = i;
284				}
285			}
286		}
287		else
288		{
289			var i = cursorIndex;
290			element = jQuery(element);
291
292			while (i-- && (elementIndex === undefined))
293			{
294				if (elements[i] && (elements[i].element.get(0) == element.get(0)))
295				{
296					elementIndex = i;
297				}
298			}
299		}
300
301		if (elementIndex !== undefined)
302		{
303			if (typeof(parameters) !== "object")
304			{
305				parameters = {};
306			}
307			jQuery.extend(elements[elementIndex].parameters, parameters);
308
309			var hideStopped = false;
310
311			if (typeof(elements[elementIndex].parameters.hide) === "function")
312			{
313				hideStopped = (elements[elementIndex].parameters.hide(element, elementIndex) === false);
314			}
315
316			if (!hideStopped)
317			{
318				elements[elementIndex].element.removeClass("is-visible").css("z-index", "");
319				delete elements[elementIndex];
320
321				var nextElementIndex;
322
323				var i = cursorIndex;
324
325				while (i-- && (nextElementIndex === undefined))
326				{
327					if (elements[i])
328					{
329						nextElementIndex = i;
330					}
331				}
332
333				if (nextElementIndex === undefined)
334				{
335					cursorIndex = 0;
336					overlay.remove();
337					jQuery("body").css("overflow", "");
338				}
339				else
340				{
341					cursorIndex = nextElementIndex + 1;
342
343					setOverlayZIndex(baseZIndex + nextElementIndex * zIndexStep);
344				}
345			}
346
347			hasHidden = true;
348		}
349		jQuery(".t3-wrapper").css('z-index', '99');
350
351		return hasHidden;
352	}
353
354	function setOverlayZIndex(zIndex)
355	{
356		overlay = jQuery("#overlay");
357
358		if (!overlay.length)
359		{
360			overlay = jQuery('<div id="overlay" class="Overlay"></div>').appendTo("body");
361			jQuery("body").css("overflow", "hidden");
362		}
363
364		overlay.css("z-index", zIndex);
365		overlay.addClass("is-visible");
366	}
367
368	jQuery(document).on(
369		"show hide",
370		".js-overlay",
371		function(event, parameters)
372		{
373			switch (event.type)
374			{
375				case "show":
376					showOverlay(this, parameters);
377					break;
378				case "hide":
379					hideOverlay(this, parameters);
380					break;
381			}
382		}
383	);
384
385	jQuery(document).on(
386		"keydown",
387		function(event)
388		{
389			if ((event.keyCode == 27) && hideOverlay())
390			{
391				event.preventDefault();
392				event.stopPropagation();
393			}
394		}
395	);
396
397	window.showOverlay = showOverlay;
398	window.hideOverlay = hideOverlay;
399
400})();
401
402/*
403 * jQuery.cookie
404 */
405jQuery.cookie=function(d,e,b){if(arguments.length>1&&String(e)!=="[object Object]"){b=jQuery.extend({},b);if(e===null||e===undefined){b.expires=-1}if(typeof b.expires==="number"){var g=b.expires,c=b.expires=new Date();c.setDate(c.getDate()+g)}e=String(e);return(document.cookie=[encodeURIComponent(d),"=",b.raw?e:encodeURIComponent(e),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join(""))}b=e||{};var a,f=b.raw?function(h){return h}:decodeURIComponent;return(a=new RegExp("(?:^|; )"+encodeURIComponent(d)+"=([^;]*)").exec(document.cookie))?f(a[1]):null};
406
407var Base64 = {
408	// private property
409	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
410
411	// public method for encoding
412	encode : function (input) {
413		var output = "";
414		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
415		var i = 0;
416
417		input = Base64._utf8_encode(input);
418
419		while (i < input.length) {
420
421			chr1 = input.charCodeAt(i++);
422			chr2 = input.charCodeAt(i++);
423			chr3 = input.charCodeAt(i++);
424
425			enc1 = chr1 >> 2;
426			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
427			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
428			enc4 = chr3 & 63;
429
430			if (isNaN(chr2)) {
431				enc3 = enc4 = 64;
432			} else if (isNaN(chr3)) {
433				enc4 = 64;
434			}
435
436			output = output +
437			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
438			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
439
440		}
441
442		return output;
443	},
444
445	// public method for decoding
446	decode : function (input) {
447		var output = "";
448		var chr1, chr2, chr3;
449		var enc1, enc2, enc3, enc4;
450		var i = 0;
451
452		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
453
454		while (i < input.length) {
455
456			enc1 = this._keyStr.indexOf(input.charAt(i++));
457			enc2 = this._keyStr.indexOf(input.charAt(i++));
458			enc3 = this._keyStr.indexOf(input.charAt(i++));
459			enc4 = this._keyStr.indexOf(input.charAt(i++));
460
461			chr1 = (enc1 << 2) | (enc2 >> 4);
462			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
463			chr3 = ((enc3 & 3) << 6) | enc4;
464
465			output = output + String.fromCharCode(chr1);
466
467			if (enc3 != 64) {
468				output = output + String.fromCharCode(chr2);
469			}
470			if (enc4 != 64) {
471				output = output + String.fromCharCode(chr3);
472			}
473
474		}
475
476		output = Base64._utf8_decode(output);
477
478		return output;
479
480	},
481
482	isEncoded: function(string)
483	{
484		return (new RegExp("^[" + this._keyStr + "]+$", "g")).test(string)
485	},
486
487	// private method for UTF-8 encoding
488	_utf8_encode : function (string) {
489		string = string.replace(/\r\n/g,"\n");
490		var utftext = "";
491
492		for (var n = 0; n < string.length; n++) {
493
494			var c = string.charCodeAt(n);
495
496			if (c < 128) {
497				utftext += String.fromCharCode(c);
498			}
499			else if((c > 127) && (c < 2048)) {
500				utftext += String.fromCharCode((c >> 6) | 192);
501				utftext += String.fromCharCode((c & 63) | 128);
502			}
503			else {
504				utftext += String.fromCharCode((c >> 12) | 224);
505				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
506				utftext += String.fromCharCode((c & 63) | 128);
507			}
508
509		}
510
511		return utftext;
512	},
513
514	// private method for UTF-8 decoding
515	_utf8_decode : function (utftext) {
516		var string = "";
517		var i = 0;
518		var c = c1 = c2 = 0;
519
520		while ( i < utftext.length ) {
521
522			c = utftext.charCodeAt(i);
523
524			if (c < 128) {
525				string += String.fromCharCode(c);
526				i++;
527			}
528			else if((c > 191) && (c < 224)) {
529				c2 = utftext.charCodeAt(i+1);
530				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
531				i += 2;
532			}
533			else {
534				c2 = utftext.charCodeAt(i+1);
535				c3 = utftext.charCodeAt(i+2);
536				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
537				i += 3;
538			}
539
540		}
541
542		return string;
543	}
544};
545
546// FORMULAIRE DE CONTACT : Ajoute l'objet dans le champ caché pour le reçevoir en mail
547
548document.addEventListener('DOMContentLoaded', function() {
549
550    const select = document.querySelector('.form-select');
551	
552	if (!select) return;
553	
554    const hidden = document.getElementById('objet-cache-mail');
555	const options = select?.querySelectorAll('option');
556
557	const queryString = window.location.search;
558	const urlParams = new URLSearchParams(queryString);
559
560	const object = urlParams.get('object');
561
562	options?.forEach(option => {
563		
564		if(option.value == object) {
565			select.value = option.value;
566			console.log('Option sélectionnée :', option.value);
567		}
568	});
569
570    function updateHidden() {
571        const value = select?.value;
572        // Séparer par "|" et garder la partie gauche
573        const text = value.split('|')[0];
574        hidden.value = text;
575    }
576
577    // Initialisation au chargement
578    updateHidden();
579
580    // Mettre à jour à chaque changement
581    select.addEventListener('change', updateHidden);
582});

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.