PageSourceSearch

https://www.ladominelais.fr/wp-content/themes/la-dominelais/js/scripts.js

js ladominelais.fr collected 2026-10-02 21:21:26 UTC 8,937 bytes, 346 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	// Recherche
79     		
80
81 	$(window).bind('keydown', function(event) {
82 		if(event.keyCode == 27) {
83 			$('.search').css('display', 'none');
84 			$('.search').removeClass('ouvert');
85 		}
86 	});
87
88 	$('.c-search-form_open').click(function(){
89 	    $('body').addClass('has-search-main-open');
90 	    if($(window).width() > 1240) {
91 	    	$( ".c-search-form input" ).focus();
92 		}
93 	});
94 	$('.c-search-form_close').click(function(){
95 	    $('body').removeClass('has-search-main-open');
96 	});
97
98 	
99
100 	$('.c-search-form_wrap input').blur(function () {
101 	var value_input = $(this).val();
102 		if(value_input == '' || value_input == $(this).attr("placeholder")){
103 		  $('.recherche-autocompletion form .ui-autocomplete').css('display','none');
104 		} else{
105 			$('.recherche-autocompletion form .ui-autocomplete').css('display','block');
106 		}
107 	});
108
109 	$('.c-search-form_wrap input').on('keyup', function(event) {
110 		var value_input = $(this).val();
111
112 		if(value_input == '' || value_input == $(this).attr("placeholder")){
113 		    $('.c-search-main_container').css('padding-top','15.625vw');
114 		    $('.recherche-autocompletion form .ui-autocomplete').css('display','none');
115 		}
116 	});
117 	
118 	$('.c-search-main').height(window.innerHeight + 'px');
119
120	// -------------------------------------------------------------------------
121	// Modifs site
122	// -------------------------------------------------------------------------
123
124	function eventFire(el, etype){
125		if (el.fireEvent) {
126			el.fireEvent('on' + etype);
127		} else {
128			var evObj = document.createEvent('Events');
129			evObj.initEvent(etype, true, false);
130			el.dispatchEvent(evObj);
131		}
132	}
133
134	$(document).ready(function(){
135		$('header .utilitaires-header li a').click(function(){
136			var el = $('header .utilitaires-accessibar-div');
137			if($(this).parent().hasClass('traduction-icon')){
138				if(el.hasClass('hover-utilitaire')){
139					el.removeClass('hover-utilitaire');
140				} else {
141					el.removeClass('hover-accessibar');
142					el.removeClass('hover-profil');
143					el.addClass('hover-utilitaire');
144				}
145			} else if($(this).parent().hasClass('accessibar-icon')){
146				eventFire(document.getElementById('uci_link'), 'click');
147			} else if($(this).parent().hasClass('profil-icon')){
148				if(el.hasClass('hover-profil')){
149					el.removeClass('hover-profil');
150				} else {
151					el.addClass('hover-profil');
152					el.removeClass('hover-accessibar');
153					el.removeClass('hover-utilitaire');
154				}
155			}
156
157			return false;
158		})
159		$('header li.traduction-icon > a').click(function(){
160			$("#google_translate_element .skiptranslate .goog-te-gadget-simple").trigger('click');
161			return false;
162		})
163	})
164
165	$(document).ready(function(){
166		
167		$(window).scroll(function(){
168
169			var position = $(window).scrollTop();
170
171			if($(window).width() > 943){
172			  if(position >= 100){
173					$('header#header').addClass('fixed');
174			  		$('#wrapper').addClass('fixed');
175				}
176				else{
177					$('header#header').removeClass('fixed');
178			  		$('#wrapper').removeClass('fixed');
179				}
180			}	
181		});
182	});
183
184
185
186	// -------------------------------------------------------------------------
187
188	// Remontage formulaire
189	// -------------------------------------------------------------------------
190
191	$(document).ready(function(){
192		var error_form = $('.validation_error');
193		var position_msg ;
194			if(error_form.length > 0){
195				console.log('new-remontage');
196				position_msg = error_form.offset().top - 200;
197				$('html, body').animate({
198	                    scrollTop: position_msg
199	                }, 1000);
200			}
201	})
202
203	// Scripts slider
204	// ----------------------------------------------------------------
205
206	if($('body').hasClass('home')){
207		$('#a-la-une .a-la-une-image').carouFredSel({
208			responsive: true,
209			width: '100%',
210			height: 430,
211			circular: true,
212			auto: 8000, //20000
213			direction: "left",
214			items: {
215				minimum : 2,
216				visible : 1
217			},
218			scroll: {
219				items: 1,
220				fx: "scroll",
221				duration: 1000,
222				easing : "quadratic"
223			},
224			prev: {
225			    button: '#a-la-une .nav-prev',
226			    key: 'left'
227			},
228			next: {
229				button: '#a-la-une .nav-suiv',
230				key: 'right'
231			},
232		});
233
234		$('#a-la-une .nav-suiv').click(function() { 
235			$('#a-la-une .a-la-une-image .a-la-une-item').trigger('next'); 
236		});
237
238		$('#a-la-une .nav-prev').click(function() { 
239			$('#a-la-une .a-la-une-image .a-la-une-item').trigger('prev'); 
240		});
241
242		$(".front-page .wrapper-actualites").carouFredSel({
243			responsive: true,
244			width: 670,
245			height: 420,
246			circular: true,
247			auto: 10000,
248			items: {
249				visible: 1
250			},
251			scroll: {
252				fx: "crossfade",
253				easing : "cubic",
254				duration: 1000,
255				onBefore : function(data){
256					$(this).trigger("currentPosition", function( pos ) {
257						$('.wrapper-liste-actualites li').removeClass('selected');
258						$('.wrapper-liste-actualites li').eq(pos).addClass('selected');
259					});
260				}
261			},
262		});
263
264		$('.wrapper-liste-actualites li').click(function(){
265			var slideNum = $(this).data('slide');
266			$('.wrapper-actualites').trigger('slideTo', slideNum);
267		});
268
269		$(".front-page ul.wrapper-evt").carouFredSel({
270			responsive: true,
271			width: 470,
272			height: 420,
273			circular: true,
274			direction: 'up',
275			auto: false,
276			items: {
277				visible: 2,
278				minimum: 3,
279				width:"470px",
280				height:"195px"
281			},
282			prev: {
283			    button: ".front-page .pagination-agenda a.prev",
284			    key: "left"
285			},
286			next: {
287				button: ".front-page .pagination-agenda a.next",
288				key: "right"
289			},
290			scroll: {
291				fx: "directscroll",
292				easing : "quadratic",
293				duration: 800 //800
294			},
295		});
296	}
297
298	// Responsive Iframe Videos
299
300	$(function() {
301
302	    var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='//www.youtube.com'], object, embed"),
303	    $fluidEl = $("figure");
304
305		$allVideos.each(function() {
306
307		  $(this)
308		    // jQuery .data does not work on object/embed elements
309		    .attr('data-aspectRatio', this.height / this.width)
310		    .removeAttr('height')
311		    .removeAttr('width');
312
313		});
314	});
315
316	 // Modif html Home
317
318	// Bouton top (haut de page)
319	// ----------------------------------------------------------------
320
321	if($(window).width() > 480){
322		$('.scroll-top').click(function() {
323			$('html,body').animate({scrollTop: 0}, 'slow');
324		});
325
326		$(window).scroll(function(){
327			if($(window).scrollTop()<100){
328				$('.scroll-top').fadeOut();
329			}else{
330				$('.scroll-top').fadeIn();
331			}
332		});
333	}
334
335	// Variable global pour les propositions de publication
336	// ----------------------------------------------------------------
337	if($(window).width() >= 1260)	heightProp = 0;
338	else if($(window).width() >= 940 && $(window).width() < 1260)	heightProp = 0;
339	else if($(window).width() >= 580 && $(window).width() < 940)	heightProp = 0;
340	else if($(window).width() < 580)	heightProp = 414;
341
342
343});
344
345
346

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.