PageSourceSearch

https://www.telakka.eu/wp-content/themes/auberge/assets/js/scripts-global.js?ver=3.0.2

js telakka.eu collected 2026-09-26 01:13:11 UTC 9,017 bytes, 487 lines download raw bytes

1/**
2 * Theme frontend scripts
3 *
4 * @package    Auberge
5 * @copyright  WebMan Design, Oliver Juhas
6 *
7 * @since    1.0
8 * @version  2.7.4
9 *
10 * Contents:
11 *
12 *  10) Basics
13 *  20) Site header
14 *  30) Banner
15 *  40) Posts
16 *  50) Site footer
17 * 100) Others
18 */
19
20( function( $ ) {
21
22	'use strict';
23
24
25
26
27
28	/**
29	 * 10) Basics
30	 */
31
32		var
33			$wmIsRtl = ( 'rtl' === $( 'html' ).attr( 'dir' ) );
34
35
36
37		/**
38		 * Tell CSS that JS is enabled...
39		 */
40
41			$( '.no-js' )
42				.removeClass( 'no-js' );
43
44
45
46		/**
47		 * Fixing Recent Comments widget multiple appearances
48		 */
49
50			$( '.widget_recent_comments ul' )
51				.attr( 'id', '' );
52
53
54
55		/**
56		 * Back to top buttons
57		 */
58
59			if ( 1280 < window.innerWidth ) {
60
61				$( '.back-to-top' )
62					.on( 'click', function( e ) {
63
64						// Processing
65
66							e.preventDefault();
67
68							$( 'html, body' )
69								.animate( {
70									scrollTop: 0
71								}, 600 );
72
73					} );
74
75			}
76
77
78
79
80
81	/**
82	 * 20) Site header
83	 */
84
85		/**
86		 * Sticky header
87		 */
88
89			$( window )
90				.on( 'scroll', function() {
91
92					// Helper variables
93
94						var
95							$documentScrollTop = $( document ).scrollTop(),
96							$headerHeight      = $( '#masthead' ).outerHeight();
97
98
99					// Processing
100
101						if ( $documentScrollTop >= ( 3 * $headerHeight ) ) {
102
103							$( 'body' )
104								.removeClass( 'hide-sticky-header' )
105								.addClass( 'sticky-header' );
106
107						} else if ( $documentScrollTop < ( 3 * $headerHeight ) && $documentScrollTop > ( 1 * $headerHeight ) ) {
108
109							$( 'body.sticky-header' )
110								.removeClass( 'sticky-header' )
111								.addClass( 'hide-sticky-header' );
112
113						} else {
114
115							$( 'body' )
116								.removeClass( 'sticky-header hide-sticky-header' );
117
118						}
119
120				} );
121
122
123
124		/**
125		 * Header search form
126		 */
127
128			$( '#search-toggle' )
129				.on( 'click', function( e ) {
130
131					// Processing
132
133						e.preventDefault();
134
135						$( this )
136							.parent()
137								.toggleClass( 'active' )
138								.find( '.search-field' )
139									.focus();
140
141				} );
142
143
144
145
146
147	/**
148	 * 30) Banner
149	 */
150
151		if ( $().slick ) {
152			$( '#site-banner.enable-slider .site-banner-inner' )
153				.on( 'init', function( event, slick ) {
154
155					// Processing
156
157						$( '.slider-nav-next' )
158							.before( $( '.slider-nav-prev' ) );
159
160				} )
161				.slick( {
162					'adaptiveHeight' : true,
163					'autoplay'       : true,
164					'autoplaySpeed'  : ( ! $( '#site-banner' ).data( 'speed' ) ) ? ( 5400 ) : ( $( '#site-banner' ).data( 'speed' ) ),
165					'cssEase'        : 'ease-in-out',
166					'dots'           : true,
167					'easing'         : 'easeInOutBack',
168					'fade'           : true,
169					'pauseOnHover'   : true,
170					'slide'          : 'article',
171					'speed'          : 600,
172					'swipeToSlide'   : true,
173					'prevArrow'      : '<div class="slider-nav slider-nav-prev"><button class="slick-prev"><span class="genericons-neue"></span></button></div>',
174					'nextArrow'      : '<div class="slider-nav slider-nav-next"><button class="slick-next"><span class="genericons-neue"></span></button></div>',
175					'rtl'            : $wmIsRtl
176				} );
177		}
178
179
180
181
182
183	/**
184	 * 40) Posts
185	 */
186
187		/**
188		 * Masonry layout
189		 */
190
191			if ( $().masonry ) {
192
193				/**
194				 * Posts list
195				 */
196
197					var
198						$postsContainers = $( '.posts' );
199
200					$postsContainers
201						.imagesLoaded( function() {
202
203							// Processing
204
205								$postsContainers
206									.masonry( {
207										itemSelector    : '.entry',
208										percentPosition : true,
209										isOriginLeft    : ! $wmIsRtl
210									} );
211
212						} );
213
214					setTimeout( function() {
215
216						$postsContainers
217							.masonry( 'reload' );
218
219					}, 600 );
220
221
222
223				/**
224				 * [gallery] shortcode Masonry layout
225				 */
226
227					var
228						$galleryContainers = $( '.gallery' );
229
230					$galleryContainers
231						.imagesLoaded( function() {
232
233							// Processing
234
235								$galleryContainers
236									.masonry( {
237										itemSelector    : '.gallery-item',
238										percentPosition : true,
239										isOriginLeft    : ! $wmIsRtl
240									} );
241
242						} );
243
244			}
245
246
247
248
249
250	/**
251	 * 50) Site footer
252	 */
253
254		/**
255		 * Masonry footer widgets
256		 */
257
258			if (
259				$().masonry
260				&& 3 < $( '#footer-widgets .widget' ).length
261			) {
262
263				var
264					$footerWidgets = $( '#footer-widgets-container' );
265
266				$footerWidgets
267					.imagesLoaded( function() {
268
269						// Processing
270
271							$footerWidgets
272								.masonry( {
273									itemSelector    : '.widget',
274									percentPosition : true,
275									isOriginLeft    : ! $wmIsRtl
276								} );
277
278					} );
279
280			}
281
282
283
284
285
286	/**
287	 * 100) Others
288	 */
289
290		/**
291		 * Sidebar mobile toggle
292		 */
293
294			// Disable sidebar toggle on wider screens
295
296				$( window )
297					.on( 'resize orientationchange', function( e ) {
298
299						// Processing
300
301							if ( 880 < window.innerWidth ) {
302
303								$( '#toggle-mobile-sidebar' )
304									.attr( 'aria-expanded', 'true' )
305									.siblings( '.widget' )
306										.show();
307
308							}
309
310					} );
311
312			// Clicking the toggle sidebar widgets button
313
314				$( '#toggle-mobile-sidebar' )
315					.on( 'click', function( e ) {
316
317						// Processing
318
319							e.preventDefault();
320
321							var
322								$this                 = $( this ),
323								mobileSidebarExpanded = $this.attr( 'aria-expanded' );
324
325							if ( 'false' == mobileSidebarExpanded ) {
326								mobileSidebarExpanded = 'true';
327							} else {
328								mobileSidebarExpanded = 'false';
329							}
330
331							$this
332								.attr( 'aria-expanded', mobileSidebarExpanded )
333								.siblings( '.widget' )
334									.slideToggle();
335
336					} );
337
338
339
340		/**
341		 * Food menu groups navigation
342		 */
343
344		 	var
345		 		$aubergeFoodMenuGroupHeaders = $( '.items-list .menu-group-header' ).length;
346
347			if ( 1 < $aubergeFoodMenuGroupHeaders ) {
348
349				var
350					$menuGroups = [];
351
352				// Set class on items list
353
354					$( '.items-list' )
355						.addClass( 'menu-group-count-' + $aubergeFoodMenuGroupHeaders );
356
357				// Set menu groups IDS
358
359					$( '.menu-group-header' )
360						.each( function( index, val ) {
361
362							// Helper variables
363
364								var
365									$this      = $( this ),
366									$thisTitle = $this.find( '> .menu-group-title' ).text(),
367									$thisID    = $this.attr( 'id' );
368
369
370							// Processing
371
372								$menuGroups[ $thisID ] = $thisTitle;
373
374								$this
375									.append( '<a href="#menu-group-nav" class="menu-group-nav-link">' + $scriptsInline.text_menu_group_nav + '</a>' )
376									.parent()
377										.addClass( $thisID );
378
379						} );
380
381				// Create a navigation
382
383					$( '<div class="menu-group-nav-container"><ul id="menu-group-nav" class="menu-group-nav"></ul></div>' )
384						.prependTo( '.items-list' );
385
386					for ( var $menuGroupID in $menuGroups ) {
387					// @link  http://stackoverflow.com/questions/921789/how-to-loop-through-javascript-object-literal-with-objects-as-members
388
389						if ( $menuGroups.hasOwnProperty( $menuGroupID ) ) {
390
391							$( '<li class="goto-' + $menuGroupID.replace( /(\r\n|\n|\r)/gm, '' ) + '"><a href="#' + $menuGroupID.replace( /(\r\n|\n|\r)/gm, '' ) + '">' + $menuGroups[ $menuGroupID ].replace( /(\r\n|\n|\r)/gm, '' ) + '</a></li>' )
392								.appendTo( '#menu-group-nav' );
393
394						}
395
396					}
397
398				// Make navigation sticky once scrolled to it
399
400					$( '#page' )
401						.imagesLoaded( function() {
402
403							// Helper variables
404
405								var
406									$menuGroupNav    = $( '#menu-group-nav' ),
407									$menuGroupNavTop = $menuGroupNav.offset().top;
408
409
410							// Processing
411
412								$menuGroupNav
413									.parent()
414									.css( { 'height' : $menuGroupNav.outerHeight() } );
415
416								$( window )
417									.scroll( function() {
418
419										// Processing
420
421											if ( $( document ).scrollTop() > ( $menuGroupNavTop - $( '#masthead' ).outerHeight() ) ) {
422
423												$( 'body' )
424													.addClass( 'sticky-menu-group-nav' );
425
426											} else {
427
428												$( 'body' )
429													.removeClass( 'sticky-menu-group-nav' );
430
431											}
432
433									} );
434
435						} );
436
437			}
438
439
440
441		/**
442		 * Jetpack Infinite Scroll posts loading
443		 *
444		 * @link  http://wptheming.com/2013/04/jetpack-infinite-scroll-masonry/
445		 */
446
447			$( document.body )
448				.on( 'post-load', function() {
449
450					// Processing
451
452						/**
453						 * Masonry posts and footer widgets
454						 */
455
456							if ( $().masonry ) {
457
458								var
459									$postsContainers = $( '.posts' );
460
461								$postsContainers
462									.imagesLoaded( function() {
463
464										$postsContainers
465											.masonry( 'reload' );
466
467										setTimeout( function() {
468
469											$postsContainers
470												.masonry( 'reload' );
471
472											$( '#footer-widgets-container' )
473												.masonry( 'reload' );
474
475										}, 600 );
476
477									} );
478
479							}
480
481				} );
482
483
484
485
486
487} )( 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.