PageSourceSearch

https://www.ville-passy-mont-blanc.fr/wp-content/themes/passy-mont-blanc/assets/js/theme-script.js?ver=6.9.4

js ville-passy-mont-blanc.fr collected 2026-10-02 08:11:06 UTC 11,053 bytes, 370 lines download raw bytes

1( function( $ ) {
2	
3	$('input,a,select,textarea,button').removeAttr('tabindex');
4
5	// protection des liens target = _blank
6	$("[target='_blank']").prop('rel','noopener');
7	
8	// ajoute (nouvelle fenêtre) au titre du lien
9	$("[target='_blank']").each( function( index ) {
10		var title = $(this).attr('title'); //undefined
11		//var alt = $(this).find('img').attr('alt');
12		var $this = $(this).clone();
13		if ( typeof(title) == 'undefined' ) {
14			title = 'nouvelle fenêtre';
15			//if ( alt != '' && alt !== 'undefined' ) title = alt + ' (nouvelle fenêtre)';
16		}
17		else {
18			title = title + ' (nouvelle fenêtre)';
19		}
20		$(this).attr( 'title', title );
21	} );
22	
23	
24	// résolution
25	var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0], x,
26		resolutionBreakPoint = 992, resolutionState = false, resizeTimer, accesRapideWidth;
27	
28	function resolutionCheck() {
29		x = w.innerWidth || e.clientWidth || g.clientWidth;
30		if (x < resolutionBreakPoint && resolutionState !== 'mobile') {
31			resolutionState = 'mobile';
32
33		} else if (x >= resolutionBreakPoint && resolutionState !== 'desktop') {
34			resolutionState = 'desktop';
35
36		}
37		
38		// scroll menu
39/*		$('#menu .scrollable').jScrollPane({
40			showArrows: false,
41			horizontalGutter: 30,
42			verticalGutter: 30
43		});*/
44	}
45	
46	resolutionCheck();
47
48	$(window).on('resize',function() {
49		clearTimeout(resizeTimer);
50		resizeTimer = setTimeout(function() { resolutionCheck(); }, 300);
51	});
52	
53	
54	// Menu
55	// https://github.com/bootstrapthemesco/bootstrap-4-multi-dropdown-navbar/blob/master/js/bootstrap-4-navbar.js
56/*	$( '.dropdown-menu [data-toggle=dropdown]' ).on( 'click', function ( e ) {
57        var $el = $( this );
58		
59        var $parent = $( this ).offsetParent( ".dropdown-menu" );
60        if ( !$( this ).next().hasClass( 'show' ) ) {
61            $( this ).parents( '.dropdown-menu' ).first().find( '.show' ).removeClass( "show" );
62        }
63        var $subMenu = $( this ).next( ".dropdown-menu" );
64		
65		$subMenu.toggleClass( 'show' );
66        
67        $( this ).parent( "li" ).toggleClass( 'show' );
68
69        $( this ).parents( 'li.menu-item.dropdown.show' ).on( 'hidden.bs.dropdown', function ( e ) {
70            $( '.dropdown-menu .show' ).removeClass( "show" );
71        } );
72        return false;
73		
74    } );*/
75
76//------------------ LIGHTBOX GALLERY ACF ----------------------------------------------
77
78var $lightbox = $('.lightbox'); // L'élément HTML
79
80// Ouvrir la lightbox
81$('.acf-gallery a').click(function(e) {
82    e.preventDefault(); // On empêche le changement de page
83    var url = $(this).attr('href'); // On récupère l'URL de l'image dans href
84
85    // On applique l'image en fond
86    $lightbox.css('background-image', 'url(' + url + ')'); 
87    $lightbox.fadeIn(); // Et on fait apparaitre la lightbox
88});
89
90// Fermer la lightbox
91$lightbox.click(function () {
92    $lightbox.fadeOut();
93});
94
95  
96//------------------ COOKIES ----------------------------------------------
97	
98	/* création/mise à jour d'un cookie */
99	var C6IcreateCookie = function(name,value,days) {
100		if (days) {
101			var date = new Date();
102			date.setTime(date.getTime()+(days*24*60*60*1000));
103			var expires = "; expires="+date.toGMTString();
104		}
105		else var expires = "";
106		document.cookie = name+"="+value+expires+"; path=/";
107	}
108	
109	/* lecture d'un cookie */
110	var C6IreadCookie = function(name) {
111		var nameEQ = name + "=";
112		var ca = document.cookie.split(';');
113		for(var i=0;i < ca.length;i++) {
114			var c = ca[i];
115			while (c.charAt(0)==' ') c = c.substring(1,c.length);
116			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
117		}
118		return null;
119	}
120	
121// ----------------- ACCESSIBILITE ---------------------//
122	// Zoom Texte
123
124	// load offset every page load
125	var offset = C6IreadCookie('textSize');
126	var contrast = C6IreadCookie('contrast');
127
128	if (offset !== '') {
129		$('html').css("font-size", parseInt(offset) + "px");
130	}
131
132
133	// function to resize text
134	function resizeText(num) {
135		var fontsize = $('html').css("font-size").replace(/[^-\d\.]/g, '');
136		offset = (+fontsize) + (+num);
137		$('html').css("font-size", parseInt(offset) + "px");
138		C6IcreateCookie('textSize', offset, 7);
139	}
140
141	// make the font bigger
142	$(".zoomIn").on('click',function() { resizeText(1); });
143
144	// make the font smaller
145	$(".zoomOut").on('click',function() { resizeText(-1); });
146	
147	
148	// Contrast handler
149	/* template_url est déclaré via wp_add_inline_script */
150	var contrast_stylesheet_path = c6i.template_url + "/style-contrast.css";
151
152	if (contrast) {
153		$('body').addClass('contrast');
154		$('head').append($("<link href='" + contrast_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
155		$('.contrast').attr('aria-pressed', true);
156	}
157
158	$('.contraste').on('click', function () {
159		if ($('body').hasClass('contrast')) {
160			$('#highContrastStylesheet').remove();
161			$('body').removeClass('contrast');
162			$(this).attr('aria-pressed', false);
163			C6IcreateCookie('contrast', "");
164			return false;
165		} else {
166			$('head').append($("<link href='" + contrast_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />"));
167			$('body').addClass('contrast');
168			$(this).attr('aria-pressed', true);
169			C6IcreateCookie('contrast', '1', 7);
170			return false;
171		}
172	});
173	
174
175	
176	//-------------------------- SLIDERS ------------------------------------------------------
177
178	function slick_on_mobile( slider, settings ){
179		$(window).on('load resize', function() {
180		  if ($(window).width() > 991) {
181			if (slider.hasClass('slick-initialized')) {
182			  slider.slick('unslick');
183			}
184			return
185		  }
186		  if (!slider.hasClass('slick-initialized')) {
187			return slider.slick(settings);
188		  }
189		});
190	};
191	
192	if ( $( "#slider-agenda-home" ).length > 0 && typeof(jQuery.fn.slick) != 'undefined' ) {
193		$("#slider-agenda-home").slick({
194			autoplay: false,
195			infinite: true,
196			slidesToShow: 3,
197			slidesToScroll: 1,
198			appendDots : '.dots-slider-agenda',
199			appendArrows : '.arrow-slider-agenda',
200			adaptiveHeight: false,
201			arrows: true,
202			dots: true,
203			draggable: false,
204			responsive: [
205				{ breakpoint: 990, settings: {slidesToShow: 2, dots: true, arrows: true } },
206				{ breakpoint: 767, settings: {slidesToShow: 1, dots: true, arrows: true } },
207			]
208        } );
209
210	}
211
212	if ( $( "#slider-rea-pro" ).length > 0 && typeof(jQuery.fn.slick) != 'undefined' ) {
213		$("#slider-rea-pro").slick({
214			centerMode: true,
215			infinite: true,
216			slidesToShow: 1,
217			slidesToScroll: 1,
218			arrows: true,
219			dots: true,
220        } );
221
222	}
223	
224	
225	  /* Slider partenaires pied de page */
226	if ( $( "#slider-partenaires" ).length > 0 && typeof(jQuery.fn.slick) != 'undefined' ) {
227		$("#slider-partenaires").slick({
228			mobileFirst: true,
229			autoplay: true,
230			infinite: true,
231			slidesToShow: 1,
232			variableWidth: true,
233			arrows: false,
234			dots: false,
235			responsive: [
236				{ breakpoint: 768, settings: { dots: false, arrows: true } },
237			]
238        } );
239	}
240
241	if ( $( ".wp-block-gallery" ).length > 0 && typeof(jQuery.fn.slick) != 'undefined' ) {
242		$(".wp-block-gallery").slick({
243			autoplay: false,
244			infinite: false,
245			slidesToShow: 1,
246			slidesToScroll: 1,
247			adaptiveHeight: true,
248			arrows: true, 
249			dots: true,
250			draggable: false
251        } );
252
253	}
254
255
256	/*--------------- FIXATION MENU AU SCROLL -----------------*/
257	$(window).on('scroll',function() {
258		if ( $(this).scrollTop() > 120 ) { 
259			$('#site-header').addClass('fixe');
260		}
261		else {
262			$('#site-header').removeClass('fixe');
263		}
264	});
265
266	/***----------------------------- SCROLL to top ----------------------------------------------------***/		
267		//Défilement
268	if ( $('#scroll-to-top').length ) {
269		var toppos = $(window).height();
270		$(window).on('scroll',function() {
271			if ( $(this).scrollTop() > ( toppos / 2 ) ) { 
272				$('#scroll-to-top').addClass('fixe');
273			}
274			else {
275				$('#scroll-to-top').removeClass('fixe');
276			}
277		});
278		// Clic
279		$('#scroll-to-top').on('click',function(){
280			$('html, body').animate({'scrollTop' : 0},600, 'swing');
281			return false;
282		});	
283	};
284	 
285
286	// ajoute l'image de fond
287	$("[data-bgimg]").each( function( i, el ) {
288		var url = $(this).data("bgimg");
289		if ( url ) {
290			$(this).css('background-image', 'url('+ url +')' );
291		}
292	});
293	
294	$('.custom-select').selectric({arrowButtonMarkup: '<i class="icon-down-open"></i>'});
295
296	$(document).on('shown.bs.dropdown', $('#menu-principal .dropdown'), function(e) {
297		$('body').addClass('menuopen');
298	});
299	$(document).on('hidden.bs.dropdown', $('#menu-principal .dropdown'), function(e) {
300		var opened = $('#menu-principal').find('.dropdown-menu.show');
301		if( opened.length < 1) $('body').removeClass('menuopen');
302	});
303	
304	// fermeture du flash info
305	$("#close-info").on('click', function() {
306		$(".flash-infos").fadeOut();
307		C6IcreateCookie('showinfos', '1', false);
308	})
309
310	//affiche une carte avec un marqueur ( annuaire /evenement )
311	if ( $( "#single-map" ).length > 0  ) {
312		
313		var $lat = $( "#single-map" ).data('lat'),
314		    $lng = $( "#single-map" ).data('lng');
315					
316		if ( $lat && $lng  ) {
317			
318			var map = L.map('single-map', { scrollWheelZoom: true }).setView([$lat, $lng], 12 );
319			
320			// Définit le fournisseur de carte (theme)
321			L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
322						maxZoom: 20,
323						attribution: '&copy; Openstreetmap France | &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
324					}
325			).addTo(map);
326			
327			var fsControl = L.control.fullscreen();
328			// add fullscreen control to the map
329			map.addControl(fsControl);
330					
331			// Initialise le marqueur
332			var fmarker = L.marker({'lat': $lat, 'lng': $lng}).addTo(map);
333		 	 		
334		}
335	}
336	
337	// modifie le formulaire searchandfilter
338	
339	var SFModifyButton = function() {
340		// modifie le bouton réinitialiser
341		$(".search-filter-reset").wrapInner('<span></span>');
342		$(".search-filter-reset span").prepend('<i class="icon-cw me-2"></i>');
343		// modifie le bouton rechercher
344		 $(".sf-field-submit").prepend('<button type="submit" name="_sf_submit"><span>Valider</span></button>');
345		 $(".sf-field-submit input").remove();
346	};	
347	
348	var SFCollapseClassLevel0 = function() {
349		$(".post-type-archive-carte-interactive").find(".sf-field-taxonomy-type-carte-interactive .sf-level-0 ul.children").parent().addClass('has-children');
350	}
351	
352	SFModifyButton();
353	SFCollapseClassLevel0();
354	
355	$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
356		SFModifyButton();
357		SFCollapseClassLevel0();
358			// $('<button><i class="icon-left-open"></i></button>').insertBefore(".post-type-archive-carte-interactive .sf-field-taxonomy-type-carte-interactive .sf-level-0 ul");
359	}); 
360	
361	// $('<button><i class="icon-left-open"></i></button>').insertBefore(".post-type-archive-carte-interactive .sf-field-taxonomy-type-carte-interactive .sf-level-0 ul");
362
363	// $(".post-type-archive-carte-interactive .sf-field-taxonomy-type-carte-interactive .sf-level-0").insertAfter();
364	
365})(jQuery);
366
367//const myDropdown = document.getElementById('myDropdown')
368//	myDropdown.addEventListener('show.bs.dropdown', event => {
369//  // do something...
370//})

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.