PageSourceSearch

https://www.mairie-dietwiller.fr/wp-content/themes/novacity-saas/assets/js/theme.js?ver=1784100259

js mairie-dietwiller.fr collected 2026-10-02 21:46:08 UTC 5,273 bytes, 190 lines download raw bytes

1( function ( $ ) {
2	'use strict';
3
4	$( '.article-content' ).find( 'a[href^="#"]' ).each( function ( index, el ) {
5
6		var target = $( el ).attr('href' );
7
8		if ( $( '.article-content' ).find( target ).length > 0 ) {
9			$( el ).on( 'click', function ( event ) {
10				event.preventDefault();
11
12				var navHeight = $( '#navigation' ).outerHeight(),
13					top = $( target ).offset().top - navHeight - 20;
14
15				$( 'html, body' ).stop().animate({
16					scrollTop: top
17				}, 500 );
18			});
19
20		}
21	});
22
23	$( '[data-toggle="scroll-to"]' ).on( 'click', function ( event ) {
24		event.preventDefault();
25		var $this = $( this ), to;
26		if ( $this.attr( 'href' ) != undefined ) {
27			to = $this.attr( 'href' );
28		} else if ( $this.data( 'target' ) != undefined ) {
29			if ( $this.data( 'target' ) == 'next' ) {
30				to = $this.closest( 'section' ).next();
31			} else {
32				to = $this.data( 'target' );
33			}
34		} else {
35			return false;
36		}
37		var navHeight = $( '#navigation' ).outerHeight(),
38			top = $( to ).offset().top - navHeight - 20;
39		$( 'html, body' ).stop().animate({
40			scrollTop: top
41		}, 500 );
42	} );
43
44	// Bootstrap Tooltips initialize
45	$( '[data-toggle="tooltip"]' ).each( function ( index, el ) {
46		var params = {
47			container: '.layout-container',
48		};
49		var newParams = $(el).data();
50	    delete newParams.ride;
51	    delete newParams.toggle;
52		$.each( newParams, function ( index, val ) {
53			params[ index ] = newParams[ index ];
54		});
55		$( el ).tooltip( params );
56	} );
57
58
59	// Chained select
60	$( '[data-chained-select]' ).each( function ( index, el ) {
61		var $parent = $(el),
62			$child = $( $parent.data( 'chained-select' ) ),
63			$selected,
64			$child_options = $child.clone(),
65			$child_default = $child_options.find( 'option' ).eq( 0 ).clone()
66
67		if ( $parent.val() != '' ) {
68			$selected = $parent.find( 'option:selected' )
69			$child
70				.removeAttr( 'disabled' )
71				.html( $child_default.clone() )
72				.show()
73				.append( $child_options.clone().find( '[data-parent-id="' + $selected.data( 'id' ) + '"]' ) )
74		} else {
75			$child
76				.html( $child_default.clone() )
77				.attr( 'disabled', 'disabled' )
78				.hide()
79		}
80
81		$parent.on( 'change', function ( event ) {
82			$selected = $parent.find( 'option:selected' )
83			if ( $parent.val() != '' ) {
84				$child
85					.removeAttr( 'disabled' )
86					.html( $child_default.clone() )
87					.show()
88					.append( $child_options.clone().find( '[data-parent-id="' + $selected.data( 'id' ) + '"]' ) )
89			} else {
90				$child
91					.html( $child_default.clone() )
92					.attr( 'disabled', 'disabled' )
93					.hide()
94			}
95		});
96	} );
97
98	/*
99	* Permet d'éviter de remonter en haut de la page lors de l'ouverture du offcanvas
100	*/
101	// $('[data-toggle="offcanvas"]').on('click', function(event) {
102	//     event.preventDefault();
103	// });
104
105
106	// Set the sharer
107	$( '[data-sharer]' ).on( 'click', function ( event ) {
108		event.preventDefault();
109
110		var $this = $( this ),
111        	leftPosition = ( window.screen.width / 2 ) - ( ( width / 2 ) + 10 ),
112        	topPosition = ( window.screen.height / 2 ) - ( ( height / 2 ) + 50 ),
113        	width = 526,
114        	height = 350,
115        	windowFeatures = 'status=no,height=' + height + ',width=' + width + ',resizable=yes,left=' + leftPosition + ',top=' + topPosition + ',screenX=' + leftPosition + ',screenY=' + topPosition + ',toolbar=no,menubar=no,scrollbars=no,location=no,directories=no',
116        	t = document.title;
117
118        window.open( $this.attr( 'href' ), 'sharer', windowFeatures );
119
120        return false;
121
122	} );
123
124
125	// Sommaire
126	// if ( $(".page-content-summary h2").length ) {
127	// 	$(".page-content-summary .page-intro")
128	// 		.before('<div class="page-nav"><nav class="nav flex-column" id="nav-summary"></nav></div>');
129	// 	$(".page-content-summary h2")
130	// 		.each(
131	// 			function ( i ) {
132	// 				var current = $( this );
133	// 				var slug = convertToSlug( current.text() );
134	// 				current.attr("id", slug );
135	// 				$("#nav-summary")
136	// 					.append("<a href='#"+slug+"' class='nav-link' title='" + current.text() + "'>" + 
137	// 				current.html() + "</a>");
138	// 			}
139	// 		)
140	// 			.promise()
141	// 			.done(
142	// 				function () {
143	// 					//
144	// 				}
145	// 			);
146	// 	$( 'body' )
147	// 		.scrollspy({
148	// 			target: '#nav-summary',
149	// 			offset: 50
150	// 		} );
151	// }
152
153	/*
154	 * Permet de scroller jusqu'au bloc comarquage au chargement de la page
155	 *
156	 * @since 1.6.0
157	 */
158	$( function () {
159		var queryString = window.location.search
160		var urlParams = new URLSearchParams( queryString );
161		if ( urlParams.size && urlParams.get( 'xml' ) ) {
162			if ( document.getElementById( 'comarquage' ) ) {
163				var xscrollTop = document.getElementById( 'comarquage' ).offsetTop + 100;
164				window.scrollTo( 0, xscrollTop );
165			}
166		}
167	});
168
169	/*
170	 * Detect active language if Google Translate is actived
171	 *
172	 * @since 1.6.0
173	 */
174	function setActiveLanguage( lang ) {
175	 	var list = $( '#nova-translate' );
176	 	list.find('a').removeClass('active')
177	 	if ( lang ) {
178	 		list.find('[onclick^="doGTranslate(\'fr|' + lang + '"]').addClass('active')
179	 	} else {
180	 		list.find('[onclick^="doGTranslate(\'fr|fr"]').addClass('active')
181	 	}
182	}
183	if ( $('#nova-translate').length ) {
184		$( '#google_translate_element2' ).on( 'change', function ( event ) {
185			setActiveLanguage( GTranslateGetCurrentLang() )
186		}).change()
187	}
188
189
190} )( jQuery );

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.