PageSourceSearch

https://www.merceariavencedora.com/home/wp-content/themes/auberge/assets/js/scripts-global.js?ver=2.5.3

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