PageSourceSearch

https://www.mairieeygalieres.com/wp-content/themes/eygalieres/js/scripts.js

js mairieeygalieres.com collected 2026-10-02 18:13:03 UTC 9,584 bytes, 345 lines download raw bytes

1jQuery(function($) {
2
3	// Menu Site
4	// -------------------------------------------------------------------
5	
6
7	// Séparer les li en 3 ul de chaque sub-menwidth:158pxu
8	$('.sub-menu').each(function(){
9		var count_li = $(this).children('ul.bloc-menu-left').children('li').length;
10		var trois_count_li = count_li/3;
11
12		for (i = count_li-1; i > (Math.ceil(trois_count_li)-1); i--) {
13			$(this).children('ul.bloc-menu-middle').prepend($(this).children('ul.bloc-menu-left').children('li').eq(i));
14		};
15
16		var count_li_first = $(this).children('ul.bloc-menu-left').children('li').length;
17		var count_li_deux = $(this).children('ul.bloc-menu-middle').children('li').length;
18		if(count_li_deux == 2){
19			count_li_deux = 2;
20			count_li_first = 1;
21		}
22		for (i = count_li_deux-1; i > count_li_first-1; i--) {
23			$(this).children('ul.bloc-menu-right').prepend($(this).children('ul.bloc-menu-middle').children('li').eq(i));
24		}
25	});
26
27	// Menu responsive
28
29	( function() {
30		var container, button, menu;
31
32		container = document.getElementById( 'header' );
33		if ( ! container ) {
34			return;
35		}
36
37		button = container.getElementsByTagName( 'button' )[0];
38		if ( 'undefined' === typeof button ) {
39			return;
40		}
41
42		menu = container.getElementsByClassName( 'menu__nav__list' )[0];
43
44		// Hide menu toggle button if menu is empty and return early.
45		if ( 'undefined' === typeof menu ) {
46			button.style.display = 'none';
47			return;
48		}
49
50		menu.setAttribute( 'aria-expanded', 'false' );
51
52		if ( -1 === menu.className.indexOf( 'nav-menu' ) ) {
53			menu.className += ' nav-menu';
54		}
55
56		button.onclick = function() {
57			if ( -1 !== menu.className.indexOf( 'toggled' ) )
58				menu.className = menu.className.replace( ' toggled', '' );
59			else
60				menu.className += ' toggled';
61		};
62	} )();
63
64
65
66	$('header .menu__nav__list li.menu-item-has-children').click(function () {
67		if ( $( "#menu-menu-principal" ).hasClass( "toggled" ) ) {
68	        /*$('header .main-menu li ul').addClass('sub-menu');*/
69
70	            var sameLi = false;
71	            if ($(this).hasClass('active')) sameLi = true;
72	            $(this).parent().find('> li').removeClass('active');
73	            if (!sameLi) $(this).toggleClass('active');	        	
74
75		}
76	});
77
78	// -------------------------------------------------------------------------
79	// Menu : passe en position: fixed;
80	// -------------------------------------------------------------------------
81
82	const headerHeight = document.getElementById('header').offsetHeight;
83	
84	if ( window.innerWidth >= 960 ) {
85		const selecteursScrollClass = ['#header', '.bottom__header', '.front-page'];
86		window.addEventListener('scroll', () => {
87			if (window.scrollY > headerHeight) {
88				selecteursScrollClass.forEach(selecteur => {
89					document.querySelector(selecteur).classList.add('sticky-nav');
90				});
91			} else {
92				selecteursScrollClass.forEach(selecteur => {
93					document.querySelector(selecteur).classList.remove('sticky-nav');
94				});
95			}
96		});
97	}
98
99	// Recherche
100     		
101
102 	$(window).bind('keydown', function(event) {
103 		if(event.keyCode == 27) {
104 			$('.search').css('display', 'none');
105 			$('.search').removeClass('ouvert');
106 		}
107 	});
108
109 	$('.c-search-form_open').click(function(){
110 	    $('body').addClass('has-search-main-open');
111 	    if($(window).width() > 1240) {
112 	    	$( ".c-search-form input" ).focus();
113 		}
114 	});
115 	$('.c-search-form_close').click(function(){
116 	    $('body').removeClass('has-search-main-open');
117 	});
118
119 	
120
121 	$('.c-search-form_wrap input').blur(function () {
122 	var value_input = $(this).val();
123 		if(value_input == '' || value_input == $(this).attr("placeholder")){
124 		  $('.recherche-autocompletion form .ui-autocomplete').css('display','none');
125 		} else{
126 			$('.recherche-autocompletion form .ui-autocomplete').css('display','block');
127 		}
128 	});
129
130 	$('.c-search-form_wrap input').on('keyup', function(event) {
131 		var value_input = $(this).val();
132
133 		if(value_input == '' || value_input == $(this).attr("placeholder")){
134 		    $('.c-search-main_container').css('padding-top','15.625vw');
135 		    $('.recherche-autocompletion form .ui-autocomplete').css('display','none');
136 		}
137 	});
138 	
139 	$('.c-search-main').height(window.innerHeight + 'px');
140
141	// -------------------------------------------------------------------------
142	// Modifs site
143	// -------------------------------------------------------------------------
144
145	function eventFire(el, etype){
146		if (el.fireEvent) {
147			el.fireEvent('on' + etype);
148		} else {
149			var evObj = document.createEvent('Events');
150			evObj.initEvent(etype, true, false);
151			el.dispatchEvent(evObj);
152		}
153	}
154
155
156		$('header .menu .utilitaires-header li:not(.tools__facebook):not(.tools__home) a').click(function(){
157			var el = $('header .utilitaires-accessibar-div');
158			if($(this).parent().hasClass('traduction-icon')){
159				if(el.hasClass('hover-utilitaire')){
160					el.removeClass('hover-utilitaire');
161				} else {
162					el.removeClass('hover-accessibar');
163					el.removeClass('hover-profil');
164					el.addClass('hover-utilitaire');
165				}
166			} else if($(this).parent().hasClass('accessibar-icon')){
167				eventFire(document.getElementById('uci_link'), 'click');
168			} else if($(this).parent().hasClass('profil-icon')){
169				if(el.hasClass('hover-profil')){
170					el.removeClass('hover-profil');
171				} else {
172					el.addClass('hover-profil');
173					el.removeClass('hover-accessibar');
174					el.removeClass('hover-utilitaire');
175				}
176			}
177
178			return false;
179		})
180		$('header li.traduction-icon > a').click(function(){
181			$("#google_translate_element .skiptranslate .goog-te-gadget-simple").trigger('click');
182			return false;
183		})
184
185
186	$( ".panel-toggle" ).click(function() {
187	  $(".panel").toggleClass("fullpanel");
188	});
189
190
191	// -------------------------------------------------------------------------
192
193	// Remontage formulaire
194	// -------------------------------------------------------------------------
195
196	$(document).ready(function(){
197		var error_form = $('.validation_error');
198		var position_msg ;
199			if(error_form.length > 0){
200				console.log('new-remontage');
201				position_msg = error_form.offset().top - 200;
202				$('html, body').animate({
203	                    scrollTop: position_msg
204	                }, 1000);
205			}
206	})
207
208	/*==================================================
209    		Sliders Homepage
210	==================================================*/
211
212		/*==============================
213			Slider ALU
214		==============================*/
215		if ( $('body').hasClass('home') ) {
216			$('.a-la-une .a-la-une-image').carouFredSel({
217				responsive: true,
218				width: '100%',
219				circular: true,
220				//auto: 3000,
221				direction: "left",
222				items : 1,
223				auto: {
224					play : true,
225					//duration: 3000,
226					easing: 'quadratic'
227					},
228				scroll: {
229					items: 1,
230					pauseOnHover: true,
231					fx: 'crossfade',
232					easing : "quadratic"
233					},
234				prev: {
235					button: '.nav-une__arrow--prev',
236					key: 'left'
237					},
238				next: {
239					button: '.nav-une__arrow--next',
240					key: 'right'
241				},
242			});
243
244			if ($(".a-la-une-medias").hasClass('a-la-une-video')){
245				$('.nav-une').css('display',"none");
246			}
247
248			$('.events__list').carouFredSel({
249				responsive: true,
250				width: '100%',
251				circular: true,
252				auto: 12000,
253				items: {
254	    			visible : 3,
255	    			width: "270px",
256	    		},
257				auto: {
258					play : true,
259					duration: 2000,
260					easing: 'quadratic'
261				},
262				scroll: {
263					items: 1,
264					pauseOnHover: true,
265					// fx: 'crossfade',
266					fx: 'scroll',
267					easing : "quadratic"
268				},
269				prev: {
270					button: '.events__nav__arrow--prev',
271					key: 'left'
272				},
273				next: {
274					button: '.events__nav__arrow--next',
275					key: 'right'
276				},
277			});
278		}
279
280	/*==================================================
281		Iframe responsive
282	==================================================*/
283	$(function() {
284		var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com'], object, embed"),
285		 $fluidEl = $("figure");
286 
287		 $allVideos.each(function() {
288			 $(this)
289			 .attr('data-aspectRatio', this.height / this.width)
290			 .removeAttr('height')
291			 .removeAttr('width');
292		 });
293	 });
294    
295    
296    	/*==================================================
297		Accessibar navigation clavier	
298	==================================================*/ 
299	$('#accessi-sitemap, #accessi-form input, #accessi-form button, #accessi-content').focus(function() {
300		$('#accessibilite').css({height : 'auto', padding : '10px', opacity : '1' })
301	})
302
303
304	$('#accessi-sitemap, #accessi-form input, #accessi-form button, #accessi-content').focusout(function() {
305		$('#accessibilite').css({height : '0', padding : '0', opacity : '0' })
306	}) 
307
308	$('#accessi-content').click(function(e) {
309		$("#breadcrumbs").focus(); 
310		$('html,body').animate({scrollTop: $('#breadcrumbs').offset().top - 100},'slow');
311	});
312
313
314	/*==================================================
315		Bouton Haut de la page
316	==================================================*/
317	if ( $(window).width() > 480 ) {
318		$('.scroll-top').click(function() {
319			$('html,body').animate({scrollTop: 0}, 'slow');
320		});
321
322		$(window).scroll(function(){
323			if($(window).scrollTop()<100){
324				$('.scroll-top').fadeOut();
325			}
326			
327			else{
328				$('.scroll-top').fadeIn();
329			}
330		});
331	}
332
333	/*==================================================
334		Formulaires de propositions
335	==================================================*/
336	if($(window).width() >= 1260)	heightProp = 0;
337	else if($(window).width() >= 940 && $(window).width() < 1260)	heightProp = 0;
338	else if($(window).width() >= 580 && $(window).width() < 940)	heightProp = 0;
339	else if($(window).width() < 580)	heightProp = 0;
340
341
342});
343
344
345

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.