PageSourceSearch

https://peegeen.com/wp-content/themes/infinite/js/script-core.js?ver=1.0.0

js peegeen.com collected 2026-10-03 02:38:18 UTC 42,280 bytes, 1,344 lines download raw bytes

1(function($){
2	"use strict";
3
4	var infinite_display = 'desktop';
5	if( typeof(window.matchMedia) == 'function' ){
6		$(window).on('resize infinite-set-display', function(){
7			if( window.matchMedia('(max-width: 419px)').matches ){
8				infinite_display = 'mobile-portrait';
9			}else if( window.matchMedia('(max-width: 767px)').matches ){
10				infinite_display = 'mobile-landscape'
11			}else if( window.matchMedia('(max-width: 959px)').matches ){
12				infinite_display = 'tablet'
13			}else{
14				infinite_display = 'desktop';
15			}
16		});
17		$(window).trigger('infinite-set-display');
18	}else{
19		$(window).on('resize infinite-set-display', function(){
20			if( $(window).innerWidth() <= 419 ){
21				infinite_display = 'mobile-portrait';
22			}else if( $(window).innerWidth() <= 767 ){
23				infinite_display = 'mobile-landscape'
24			}else if( $(window).innerWidth() <= 959 ){
25				infinite_display = 'tablet'
26			}else{
27				infinite_display = 'desktop';
28			}
29		});
30		$(window).trigger('infinite-set-display');
31	}
32
33	// ref : http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
34	// ensure 1 is fired
35	var infinite_debounce = function(func, threshold, execAsap){
36		
37		var timeout;
38
39		return function debounced(){
40			
41			var obj = this, args = arguments;
42			
43			function delayed(){
44				if( !execAsap ){
45					func.apply(obj, args);
46				}
47				timeout = null;
48			};
49
50			if( timeout ){
51				clearTimeout(timeout);
52			}else if( execAsap ){
53				func.apply(obj, args);
54			}
55			timeout = setTimeout(delayed, threshold);
56		};
57	}	
58	
59	// reduce the event occurance
60	var infinite_throttling = function(func, threshold){
61		
62		var timeout;
63
64		return function throttled(){
65			var obj = this, args = arguments;
66			
67			function delayed(){
68				func.apply(obj, args);
69				timeout = null;
70			};
71
72			if( !timeout ){
73				timeout = setTimeout(delayed, threshold);
74			}
75		};
76	}	
77
78	/////////////////////////
79	// menu handle function
80	/////////////////////////
81	var infinite_sf_menu = function( menu ){
82
83		if( menu.length == 0 ) return;
84
85		this.main_menu = menu;
86
87		this.slide_bar = this.main_menu.children('.infinite-navigation-slide-bar');
88		this.slide_bar_val = { width: 0, left: 0 };
89		this.slide_bar_offset = '15';
90		if( this.slide_bar.attr('data-size-offset') ){
91			this.slide_bar_offset = parseInt(this.slide_bar.attr('data-size-offset'));
92		}
93
94		this.slide_bar_width = 0;
95		if( this.slide_bar.attr('data-width') ){
96			this.slide_bar_width = parseInt(this.slide_bar.attr('data-width'));
97		}
98
99		this.current_menu = this.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a');
100		
101		this.init();
102		
103	} // infinite_sf_menu
104
105	infinite_sf_menu.prototype = {
106		
107		init: function(){
108			
109			var t = this;
110			
111			// sf menu mod
112			t.sf_menu_mod();
113			
114			// init superfish menu
115			if(typeof($.fn.superfish) == 'function'){
116				t.main_menu.superfish({ delay: 400, speed: 'fast' });	
117				
118				t.sf_menu_position();
119				$(window).resize(infinite_debounce(function(){
120					t.sf_menu_position();
121				}, 300));
122			}
123			
124			// init the slidebar
125			if( t.slide_bar.length > 0 ){
126				t.init_slidebar();
127			}
128			
129		}, // init
130		
131		sf_menu_mod: function(){
132			
133			// create the mega menu script
134			this.main_menu.find('.sf-mega > ul').each(function(){	
135				var mega_content = $('<div></div>');
136				var mega_row = $('<div class="sf-mega-section-wrap" ></div>');
137				var mega_column_size = 0;
138				
139				$(this).children('li').each(function(){
140					var column_size = parseInt($(this).attr('data-size'));
141					if( mega_column_size + column_size  <= 60 ){
142						mega_column_size += column_size;
143					}else{	
144						mega_column_size = column_size;
145						mega_content.append(mega_row);
146						mega_row = $('<div class="sf-mega-section-wrap" ></div>');
147					}
148					
149					mega_row.append( $('<div class="sf-mega-section" ></div>')
150						.addClass('infinite-column-' + column_size)
151						.html( $('<div class="sf-mega-section-inner" ></div>')
152							.addClass($(this).attr('class'))
153							.attr('id', $(this).attr('id'))
154							.html($(this).html())
155						)
156					);
157				});
158				
159				mega_content.append(mega_row);
160				$(this).replaceWith(mega_content.html());
161			});
162			
163		}, // sf_menu_mod
164		
165		sf_menu_position: function(){
166
167			if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
168
169			// submenu of normal menu
170			var body_wrapper = $('.infinite-body-wrapper');
171			var sub_normal_menu = this.main_menu.find('.sf-menu > li.infinite-normal-menu .sub-menu');
172			
173			sub_normal_menu.css({display: 'block'}
173).removeClass('sub-menu-right sub-menu-left');
174			sub_normal_menu.each(function(){
175				if( $(this).offset().left + $(this).width() > body_wrapper.outerWidth() ){
176					$(this).addClass('sub-menu-right');
177				}else if( $(this).offset().left < 0 ){
178					$(this).addClass('sub-menu-left');
179				}
180			});
181			sub_normal_menu.css({display: 'none'});
182			
183			// submenu of mega menu
184			this.main_menu.find('.sf-menu > li.infinite-mega-menu .sf-mega').each(function(){
185				if( !$(this).hasClass('sf-mega-full') ){
186					
187					$(this).css({ display: 'block' });
188					
189					// set the position
190					$(this).css({ right: '', 'margin-left': -(($(this).width() - $(this).parent().outerWidth()) / 2) });
191					
192					// if exceed the screen
193					if( $(this).offset().left < 0  ){
194						$(this).css({ left: 0, 'margin-left': '' });
195					}else if( $(this).offset().left + $(this).width() > $(window).width() ){
196						$(this).css({ right: 0, 'margin-left': '' });
197					}
198					
199					$(this).css({ display: 'none' });
200				}
201				
202			});
203			
204		}, // sf_menu_position
205		
206		init_slidebar: function(){
207			
208			var t = this;
209			
210			t.init_slidebar_pos();
211			$(window).on('load', function(){ t.init_slidebar_pos(); });
212			
213			// animate slidebar 
214			t.main_menu.children('.sf-menu').children('li').on({
215				mouseenter: function(){
216					var nav_element = $(this).children('a');
217
218					if( nav_element.length > 0 ){
219
220						if( t.slide_bar_width > 0 ){
221							var sbw = t.slide_bar_width;
222							if( t.slide_bar.hasClass('infinite-left') ){
223								var sbl = nav_element.position().left - t.slide_bar_offset;
224							}else{
225								var sbl = nav_element.position().left + ((nav_element.outerWidth() - sbw)/2) - t.slide_bar_offset;
226							}
227						}else{
228							var sbw = nav_element.outerWidth() + (2 * t.slide_bar_offset);
229							var sbl = nav_element.position().left - t.slide_bar_offset;
230						}
231
232						t.slide_bar.animate({ width: sbw, left: sbl }, { queue: false, duration: 250 });
233					}
234				}, 
235				mouseleave: function(){
236					t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 });
237				}
238			});
239			
240			// window resize event
241			$(window).on('resize', function(){ t.init_slidebar_pos(); });
242			$(window).on('infinite-navigation-slider-bar-init', function(){ 
243				t.current_menu = t.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a');
244				t.animate_slidebar_pos(); 
245			});
246			$(window).on('infinite-navigation-slider-bar-animate', function(){ t.animate_slidebar_pos(); });
247			
248		}, // init_slidebar
249		
250		init_slidebar_pos: function(){
251
252			if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
253
254			var t = this;
255
256			if( t.current_menu.length > 0 ){
257				if( t.slide_bar_width > 0 ){
258					var sbw = t.slide_bar_width;
259					if( t.slide_bar.hasClass('infinite-left') ){
260						var sbl = t.current_menu.position().left - t.slide_bar_offset;
261					}else{
262						var sbl = t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset;
263					}
264				}else{
265					var sbw = t.current_menu.outerWidth() + (2 * t.slide_bar_offset);
266					var sbl = t.current_menu.position().left - t.slide_bar_offset;
267				}
268				t.slide_bar_val = { width: sbw, left: sbl };
269			}else{
270				t.slide_bar_val = { width: 0 }
271
272				var first_child =  t.main_menu.children('ul').children('li:first-child');
273				if( typeof(first_child.position()) != 'undefined' ){
274					t.slide_bar_val.left = first_child.position().left;
275				}else{
276					t.slide_bar_val.left = 0;
277				}
278			}
279			t.slide_bar.css({ width: t.slide_bar_val.width, left: t.slide_bar_val.left, display: 'block' });
280
281		}, // set_slidebar_pos	
282		animate_slidebar_pos: function(){
283
284			if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
285
286			var t = this;
287
288			if( t.current_menu.length > 0 ){
289				if( t.slide_bar_width > 0 ){
290					var sbw = t.slide_bar_width;
291					if( t.slide_bar.hasClass('infinite-left') ){
292						var sbl = t.current_menu.position().left - t.slide_bar_offset;
293					}else{
294						var sbl = t.current_menu.position().left + ((t.current_menu.outerWidth() - sbw)/2) - t.slide_bar_offset ;
295					}
296				}else{
297					var sbw = t.current_menu.outerWidth() + (2 * t.slide_bar_offset);
298					var sbl = t.current_menu.position().left - t.slide_bar_offset;
299				}
300				t.slide_bar_val = { width: sbw, left: sbl };
301			}else{
302				t.slide_bar_val = { width: 0 }
303
304				var first_child =  t.main_menu.children('ul').children('li:first-child');
305				if( typeof(first_child.position()) != 'undefined' ){
306					t.slide_bar_val.left = first_child.position().left;
307				}else{
308					t.slide_bar_val.left = 0;
309				}
310			}
311			t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 });
312
313		} // set_slidebar_pos
314		
315	}; // infinite_sf_menu.prototype
316	
317	/////////////////////////
318	// mobile menu
319	/////////////////////////
320	$.fn.infinite_mobile_menu = function( args ){
321		
322		var menu_button = $(this).siblings('.infinite-mm-menu-button');
323
324		if( typeof(Mmenu) != 'undefined' ){
325
326			// remove blank link for submenu
327			$(this).find('a[href="#"]').each(function(){
328				var content = $(this).html();
329				$('<span class="infinite-mm-menu-blank" ></span>').html(content).insertBefore($(this));
330				$(this).remove();
331			});
332
333			// activate mmenu
334			var menu = new Mmenu($(this).get(0), {
335				navbar: { 
336					title: '<span class="mmenu-custom-close" ></span>'
337				},
338				offCanvas: {
339					position: $(this).attr('data-slide')
340				}
341			}, {
342                offCanvas: {
343                    page: {
344                        selector: ".infinite-body-outer-wrapper"
345                    }
346                }
347            });
348
349			var menu_api = menu.API;
350
351			// open close action
352			menu_button.on('click', function(){
353				menu_api.open();
354			});
355			$(this).find('a').not('.mm-btn').on('click', function(){
356				menu_api.close();
357			});
358			$(this).find('.mmenu-custom-close').on('click', function(){
359				menu_api.close();
360			});
361
362			// add class active to button
363			menu_api.bind('open:after', function($panel){
364				menu_button.addClass('infinite-active');
365			});
366			menu_api.bind('close:after', function($panel){
367				menu_button.removeClass('infinite-active');
368			});
369		}
370		
371	}	
372
373	/////////////////////////
374	// overlay menu
375	/////////////////////////
376	var infinite_overlay_menu = function( menu ){
377
378		this.menu = menu;
379		this.menu_button = menu.children('.infinite-overlay-menu-icon');
380		this.menu_content = menu.children('.infinite-overlay-menu-content');
381		this.menu_close = this.menu_content.children('.infinite-overlay-menu-close');
382
383		this.init();
384	}
385	infinite_overlay_menu.prototype = {
386		
387		init: function(){
388
389			var t = this;
390
391			// add transition delay for each menu
392			var delay_count = 0;
393			t.menu_content.appendTo('body');
394			t.menu_content.find('ul.menu > li').each(function(){
395				$(this).css('transition-delay', (delay_count * 150) + 'ms');
396
397				delay_count++;
398			});
399
400			// bind the menu button
401			t.menu_button.on('click', function(){
402				$(this).addClass('infinite-active');
403
404				t.menu_content.fadeIn(200, function(){
405					$(this).addClass('infinite-active');
406				});
407
408				return false;
409			});
410
411			// bind the menu close button
412			t.menu_close.on('click', function(){
413				t.menu_button.removeClass('infinite-active');
414
415				t.menu_content.fadeOut(400, function(){
416					$(this).removeClass('infinite-active');
417				});
418				t.menu_content.find('.sub-menu').slideUp(200).removeClass('infinite-active');
419
420				return false;
421			});
422
423			// menu item click
424			t.menu_content.find('a').on('click', function(e){ 
425				var sub_menu = $(this).siblings('.sub-menu');
426				if( sub_menu.length > 0 ){
427					if( !sub_menu.hasClass('infinite-active') ){
428						var prev_active = sub_menu.closest('li').siblings().find('.sub-menu.infinite-active');
429						if( prev_active.length > 0 ){
430							prev_active.removeClass('infinite-active').slideUp(150);
431							sub_menu.delay(150).slideDown(400, 'easeOutQuart').addClass('infinite-active');
432						}else{
433							sub_menu.slideDown(400, 'easeOutQuart').addClass('infinite-active');
434						}
435
436						$(this).addClass('infinite-no-preload');
437						return false;
438					}else if( $(this).attr('href') == '#' ){
439						sub_menu.removeClass('infinite-active').slideUp(150);
440					}else{
441						$(this).removeClass('infinite-no-preload');
442					}
443				}else{
444					t.menu_close.trigger('click');
445				}
446			});
447
448		}
449
450	}; // infinite_overlay_menu.prototype
451
452	/////////////////////////
453	// header side navigation
454	/////////////////////////
455	var infinite_header_side_nav = function( side_nav ){
456
457		if( side_nav.length == 0 ) return;
458
459		this.prev_scroll = 0;
460
461		this.side_nav = side_nav;
462		this.side_nav_content = side_nav.children();
463
464		this.init();
465
466	} // infinite_header_side_nav
467
468	infinite_header_side_nav.prototype = {
469
470		init: function(){
471
472			var t = this;
473
474			t.init_nav_bar_element();
475
476			$(window).resize(function(){ 
477				t.init_nav_bar_element();
478			});
479			
480			$(window).scroll(function(){
481
482				if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
483
484				// if content longer than screen height
485				if( t.side_nav.hasClass('infinite-allow-slide') ){
486
487					var admin_bar_height = parseInt($('html').css('margin-top'));
488					var scroll_down = ($(window).scrollTop() > t.prev_scroll);
489					t.prev_scroll = $(window).scrollTop();
490
491					// if scroll down
492					if( scroll_down ){
493
494						if( !t.side_nav.hasClass('infinite-fix-bottom') ){
495							if( t.side_nav.hasClass('infinite-fix-top') ){
496								t.side_nav.css('top', t.side_nav.offset().top);
497								t.side_nav.removeClass('infinite-fix-top');
498
499							}else if( $(window).height() + $(window).scrollTop() > t.side_nav_content.offset().top + t.side_nav_content.outerHeight() ){ 
500								if( !t.side_nav.hasClass('infinite-fix-bottom') ){
501									t.side_nav.addClass('infinite-fix-bottom');
502									t.side_nav.css('top', '');
503								}
504							}
505						}
506
507					// if scroll up
508					}else{
509
510						if( !t.side_nav.hasClass('infinite-fix-top') ){
511							if( t.side_nav.hasClass('infinite-fix-bottom') ){
512								var top_pos = $(window).scrollTop() + ($(window).height() - admin_bar_height) - t.side_nav_content.outerHeight();
513								t.side_nav.css('top', top_pos);
514								t.side_nav.removeClass('infinite-fix-bottom');
515
516							}else if( $(window).scrollTop() + admin_bar_height < t.side_nav_content.offset().top ){ 
517								if( !t.side_nav.hasClass('infinite-fix-top') ){
518									t.side_nav.addClass('infinite-fix-top');
519									t.side_nav.css('top', '');
520								}
521							}
522						}
523					
524					}
525
526				}
527			});
528
529		},
530
531		init_nav_bar_element: function(){
532
533			if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
534
535			var t = this;
536			var middle_pos = t.side_nav_content.children('.infinite-pos-middle').addClass('infinite-active');
537			var bottom_pos = t.side_nav_content.children('.infinite-pos-bottom').addClass('infinite-active');
538
539			// remove all additional space
540			t.side_nav_content.children('.infinite-pre-spaces').remove();
541
542			// add class depends on the screen size/content
543			if( $(window).height() < t.side_nav_content.height() ){
544				t.side_nav.addClass('infinite-allow-slide');
545			}else{
546				t.side_nav.removeClass('infinite-allow-slide infinite-fix-top infinite-fix-bottom').css('top', '');
547
548				// set the middle position
549				if( t.side_nav.hasClass('infinite-style-middle') ){
550					middle_pos.each(function(){
551						var top_padding = parseInt($(this).css('padding-top'));
552						var prespace = ((t.side_nav.height() - (t.side_nav_content.height() - top_padding)) / 2) - top_padding;
553
554						if( prespace > 0 ){
555							$('<div class="infinite-pre-spaces" ></div>').css('height', prespace).insertBefore($(this));
556						}
557					});
558				}
559
560				// set the bottom position
561				bottom_pos.each(function(){
562					var prespace = t.side_nav.height() - t.side_nav_content.height();
563
564					if( prespace > 0 ){
565						$('<div class="infinite-pre-spaces" ></div>').css('height', prespace).insertBefore($(this));
566					}
567				});
568
569			}
570		}
571
572	}; // infinite_sf_menu.prototype
573
574	/////////////////////////
575	// anchoring
576	/////////////////////////	
577
578	var infinite_anchor = function(){
579
580		this.anchor_link = $('a[href*="#"]').not('[href="#"]').filter(function(){
581
582			// for mm-menu plugin
583			if( $(this).is('.infinite-mm-menu-button, .mm-btn, .mm-blocker, .mm-next, .mm-prev, .mm-title, .gdlr-core-ilightbox') ){
584				return false;
585			}
586
587			// for google review plugin
588			if( $(this).is('') ){
589				return false;
590			}
591
592			// for additional plugins
593			if( $(this).is('#cancel-comment-reply-link, .comment-reply-link, .fbx-btn-transition, .ti-header') ){
594				return false;
595			}else if( $(this).parent('.clearButton').length ){
596				return false;
597			}
598
599			// for woocommerce
600			if( $(this).parent('.description_tab, .reviews_tab').length || $(this).not('[class^="infinite"]').closest('.woocommerce').length ){
601				if( !$(this).closest('.menu-item').length ){
602					return false;
603				}
604			}
605
606
607
608			return true;
609		});
610
611		if( this.anchor_link.length || window.location.hash.length ){
612			this.menu_anchor = $('#infinite-main-menu, #infinite-bullet-anchor');
613			this.home_anchor = this.menu_anchor.find('ul.sf-menu > li.current-menu-item > a, ul.sf-menu > li.current-menu-ancestor > a, .infinite-bullet-anchor-link.current-menu-item');
614
615			this.init();
616		}
617	}
618	infinite_anchor.prototype = {
619
620		init: function(){
621
622			var t = this;
623
624			t.animate_anchor();
625			t.scroll_section();
626
627			// init bullet anchor height
628			t.menu_anchor.filter('#infinite-bullet-anchor').each(function(){
629				$(this).css('margin-top', - t.menu_anchor.height() / 2).addClass('infinite-init');
630			});
631
632			// initialize if the page hash exists
633			// wait for all element to initialize ( eg. flexslider )
634			var url_hash = window.location.hash;
635			if( url_hash ){
636				setTimeout(function(){
637
638					var current_menu = t.menu_anchor.find('a[href*="' + url_hash + '"]');
639					if( !current_menu.is('.current-menu-item, .current-menu-ancestor') ){
640						current_menu.addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
641
642						$(window).trigger('infinite-navigation-slider-bar-init');
643					}
644
645					t.scroll_to(url_hash, false, 300);
646				}, 500);
647			}
648	
649		},
650
651		animate_anchor: function(){
652
653			var t = this;
654
655			// home anchor
656			t.home_anchor.on('click', function(){
657
658				if( window.location.href == this.href ){
659					$('html, body').animate({ scrollTop: 0 }, { duration: 1500, easing: 'easeOutQuart' });
660					return false;
661				}
662				
663			});
664
665			// normal anchor
666			t.anchor_link.on('click', function() {
667				if( location.hostname == this.hostname && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') ){
668					if( $(this).closest('#infinite-main-menu').length ){
669						$(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item');
670						$(window).trigger('infinite-navigation-slider-bar-init');
671					}
672					return t.scroll_to(this.hash, true);
673				}
674			});
675
676		}, // animate anchor
677
678		scroll_to: function( hash, redirect, duration ){
679
680			// start scrolling
681			if( hash == '#infinite-top-anchor' ){
682				var scroll_position = 0;
683			}else{
684				
685				var target = $(hash);
686
687				if( target.length ){
688					var scroll_position = target.offset().top;
689				}
690			}
691
692			if( typeof(scroll_position) != 'undefined' ){
693
694				// offset for wordpress admin bar
695				scroll_position = scroll_position - parseInt($('html').css('margin-top'));
696
697				// offset for fixed nav bar
698				if( infinite_display == 'mobile-portrait' || infinite_display == 'mobile-landscape' ){
699					scroll_position = scroll_position - 75;
700				}else if( typeof(window.infinite_anchor_offset) != 'undefined' && !isNaN(window.infinite_anchor_offset) ){
701					scroll_position = scroll_position - parseInt(window.infinite_anchor_offset);
702				}
703
704				if( scroll_position < 0 ) scroll_position = 0;
705
706				$(window).trigger('infinite-anchor-animate');
707				$('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false });
708
709				return false;
710
711			}else if( redirect ){
712
713				window.location.href = $('body').attr('data-home-url') + hash;
714
715				return false;
716			}
717
718		}, // scroll to
719
720		scroll_section: function(){
721
722			var t = this;
723
724			// have anchor in anchor menu
725			var menu_link_anchor = this.menu_anchor.find('a[href*="#"]').not('[href="#"]');
726			if( !menu_link_anchor.length ){ return; }
727
728			// get anchor section
729			var home_anchor_section = $('#infinite-page-wrapper');
730			// var anchor_section = home_anchor_section.find('div[id], section[id]');
731			var anchor_section = home_anchor_section.find('[id]').filter(function(){
732				var hashId = $(this).attr('id');
733				if( menu_link_anchor.filter('a[href*="#' + hashId + '"]').length ){
734					return true;
735				}
736				return false;
737			});
738			if( !anchor_section.length ){ return; }
739
740			// add data for faster query
741			menu_link_anchor.each(function(){
742				if( $(this).closest('.sub-menu').length == 0 && $(this.hash).length ){
743					$(this).attr('data-anchor', this.hash);
744				}
745			});
746
747			// check section on scroll event
748			$(window).scroll(function(){
749
750				if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
751				
752				if( t.home_anchor.length && $(window).scrollTop() <= home_anchor_section.offset().top ){
753
754					t.home_anchor.each(function(){
755						if( $(this).hasClass('infinite-bullet-anchor-link') ){
756							$(this).addClass('current-menu-item').siblings().removeClass('current-menu-item');
757							$(this).parent('.infinite-bullet-anchor').attr('data-anchor-section', 'infinite-home');
758						}else if( !$(this).parent('.current-menu-item, .current-menu-ancestor').length ){
759							$(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
760							$(window).trigger('infinite-navigation-slider-bar-init');
761						}			
762					});
763
764				}else{
765					var section_position = $(window).scrollTop() + ($(window).height() / 2);
766
767					anchor_section.each(function(){
768						if( $(this).css('display') == 'none' ) return;
769						
770						var top_offset_pos = $(this).offset().top;
771
772						if( (section_position > top_offset_pos) && (section_position <  top_offset_pos + $(this).outerHeight()) ){
773							var section_id = $(this).attr('id');
774							menu_link_anchor.filter('[data-anchor="#' +  section_id + '"]').each(function(){
775								if( $(this).hasClass('infinite-bullet-anchor-link') ){
776									$(this).addClass('current-menu-item').siblings().removeClass('current-menu-item');
777									$(this).parent('.infinite-bullet-anchor').attr('data-anchor-section', section_id);
778								}else if( $(this).parent('li.menu-item').length && !$(this).parent('li.menu-item').is('.current-menu-item, .current-menu-ancestor') ){
779									$(this).parent('li.menu-item').addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
780									$(window).trigger('infinite-navigation-slider-bar-init');
781								}
782							});
783							
784							return false;
785						}
786
787					});
788				}
789
790			});
791
792		} // scroll section
793
794	};
795
796	var infinite_sticky_navigation = function(){
797
798		var t = this;
799
800		// get navigation
801		t.sticky_nav = $('.infinite-with-sticky-navigation .infinite-sticky-navigation');
802		t.mobile_menu = $('#infinite-mobile-header');
803
804		// set the anchor offset
805		if( t.sticky_nav.hasClass('infinite-sticky-navigation-height') ){
806			window.infinite_anchor_offset = t.sticky_nav.outerHeight();
807			$(window).resize(function(){
808				window.infinite_anchor_offset = t.sticky_nav.outerHeight();
809			});
810		}else if( t.sticky_nav.attr('data-navigation-offset') ){
811			window.infinite_anchor_offset = parseInt(t.sticky_nav.attr('data-navigation-offset'));
812		}else if( t.sticky_nav.length ){
813			window.infinite_anchor_offset = 75;
814		}
815
816		// init the sticky navigation
817		if( t.sticky_nav.length ){
818			t.init(); 
819		}
820
821		if( t.mobile_menu.hasClass('infinite-sticky-mobile-navigation') ){
822			t.style_mobile_slide();
823			$(window).trigger('infinite-set-sticky-mobile-navigation'); 
824		}
825
826	}
827	infinite_sticky_navigation.prototype = {
828		
829		init: function(){
830
831			var t = this;
832
833			if( t.sticky_nav.hasClass('infinite-style-fixed') ){
834				t.style_fixed();
835			}else if( t.sticky_nav.hasClass('infinite-style-slide') ){
836				t.style_slide();
837			}
838
839			$(window).trigger('infinite-set-sticky-navigation'); 
840		},
841
842		style_fixed: function(){
843
844			var t = this;
845			var placeholder = $('<div class="infinite-sticky-menu-placeholder" ></div>');
846
847			$(window).on('scroll infinite-set-sticky-navigation', function(){
848
849				if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ) return;
850
851				var page_offset = parseInt($('html').css('margin-top'));
852
853				if( !t.sticky_nav.hasClass('infinite-fixed-navigation') ){
854
855					if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top ){
856						if( !t.sticky_nav.hasClass('infinite-without-placeholder') ){
857							placeholder.height(t.sticky_nav.outerHeight());
858						}
859						placeholder.insertAfter(t.sticky_nav);
860						$('body').append(t.sticky_nav);
861						t.sticky_nav.addClass('infinite-fixed-navigation');
862						
863						setTimeout(function(){ t.sticky_nav.addClass('infinite-animate-fixed-navigation'); }, 10);	
864						setTimeout(function(){ 
865							t.sticky_nav.css('height', ''); 
866							$(window).trigger('infinite-navigation-slider-bar-animate');
867						}, 200);
868					}
869				}else{
870
871					if( $(window).scrollTop() + page_offset <= placeholder.offset().top ){
872						if( !t.sticky_nav.hasClass('infinite-without-placeholder') ){
873							t.sticky_nav.height(placeholder.height());
874						}
875						t.sticky_nav.insertBefore(placeholder);
876						t.sticky_nav.removeClass('infinite-fixed-navigation');
877						placeholder.remove();
878
879						setTimeout(function(){ t.sticky_nav.removeClass('infinite-animate-fixed-navigation'); }, 10);	
880						setTimeout(function(){ 
881							t.sticky_nav.css('height', ''); 
882							$(window).trigger('infinite-navigation-slider-bar-animate');
883						}, 200);
884					}
885				}
886			});
887
888		}, // style_fixed
889
890		style_slide: function(){
891
892			var t = this;
893			var placeholder = $('<div class="infinite-sticky-menu-placeholder" ></div>');
894
895			$(window).on('scroll infinite-set-sticky-navigation', function(){
896
897				if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ){ return; }
898
899				var page_offset = parseInt($('html').css('margin-top'));
900
901				if( !t.sticky_nav.hasClass('infinite-fixed-navigation') ){
902
903					if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top + t.sticky_nav.outerHeight() + 200 ){
904						
905						if( !t.sticky_nav.hasClass('infinite-without-placeholder') ){
906							placeholder.height(t.sticky_nav.outerHeight());
907						}
908						placeholder.insertAfter(t.sticky_nav);
909						t.sticky_nav.css('display', 'none');
910
911						$('body').append(t.sticky_nav);
912						t.sticky_nav.addClass('infinite-fixed-navigation infinite-animate-fixed-navigation');
913						t.sticky_nav.slideDown(200);
914						$(window).trigger('infinite-navigation-slider-bar-animate');
915					}
916				}else{
917
918					if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){
919						var clone = t.sticky_nav.clone();
920						clone.insertAfter(t.sticky_nav);
921						clone.slideUp(200, function(){ $(this).remove(); });
922
923						t.sticky_nav.insertBefore(placeholder);
924						placeholder.remove();
925						t.sticky_nav.removeClass('infinite-fixed-navigation infinite-animate-fixed-navigation');
926						t.sticky_nav.css('display', 'block');
927
928						$(window).trigger('infinite-navigation-slider-bar-animate');
929					}
930				}
931			});
932
933		}, // style_slide		
934
935		style_mobile_slide: function(){
936
937			var t = this;
938			var placeholder = $('<div class="infinite-sticky-mobile-placeholder" ></div>');
939
940			$(window).on('scroll infinite-set-sticky-mobile-navigation', function(){
941
942				if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' || infinite_display == 'tablet' ){
943
944					var page_offset = parseInt($('html').css('margin-top'));
945
946					if( !t.mobile_menu.hasClass('infinite-fixed-navigation') ){
947						if( $(window).scrollTop() + page_offset > t.mobile_menu.offset().top + t.mobile_menu.outerHeight() + 200 ){
948							placeholder.height(t.mobile_menu.outerHeight()).insertAfter(t.mobile_menu);
949							$('body').append(t.mobile_menu);
950							t.mobile_menu.addClass('infinite-fixed-navigation');
951							t.mobile_menu.css('display', 'none').slideDown(200);
952						}
953					}else{
954						if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){
955							var clone = t.mobile_menu.clone();
956							clone.insertAfter(t.mobile_menu);
957							clone.slideUp(200, function(){ $(this).remove(); });
958
959							t.mobile_menu.insertBefore(placeholder);
960							placeholder.remove();
961							t.mobile_menu.removeClass('infinite-fixed-navigation');
962							t.mobile_menu.css('display', 'block');
963						}
964					}
965				}
966
967			});
968
969		}, // style_slide
970
971	};
972
973	var infinite_font_resize = function(){
974
975		this.heading_font = $('h1, h2, h3, h4, h5, h6');
976
977		this.init();
978
979	}
980	infinite_font_resize.prototype = {
981
982		init: function(){
983
984			var t = this;
985
986			t.resize();
987			$(window).on('resize', infinite_throttling(function(){
988				t.resize();
989			}, 100));
990
991		},
992
993		resize: function(){
994			
995			var t = this;
996
997			if( infinite_display == 'mobile-landscape' || infinite_display == 'mobile-portrait' ){
998
999				t.heading_font.each(function(){
1000					if( parseInt($(this).css('font-size')) > 40 ){
1001						if( !$(this).attr('data-orig-font') ){
1002							$(this).attr('data-orig-font', $(this).css('font-size')); 
1003						}
1004
1005						$(this).css('font-size', '40px');
1006					}
1007				});
1008
1009			// return font to normal
1010			}else{
1011
1012				t.heading_font.filter('[data-orig-font]').each(function(){
1013					$(this).css('font-size', $(this).attr('data-orig-font'));
1014				});
1015
1016			}
1017		}
1018
1019	};
1020
1021	// tourmaster lightbox
1022	function infinite_lightbox( content ){
1023
1024		var lightbox_wrap = $('<div class="infinite-lightbox-wrapper" ></div>').hide();
1025		var lightbox_content_wrap = $('<div class="infinite-lightbox-content-cell" ></div>');
1026		lightbox_wrap.append(lightbox_content_wrap);
1027		lightbox_content_wrap.wrap($('<div class="infinite-lightbox-content-row" ></div>'));
1028
1029		lightbox_content_wrap.append(content);
1030
1031		var scrollPos = $(window).scrollTop();
1032		$('html').addClass('infinite-lightbox-on');
1033		$('body').append(lightbox_wrap);
1034		lightbox_wrap.fadeIn(300);
1035
1036		// do a lightbox action
1037		lightbox_wrap.on('click', '.infinite-lightbox-close', function(){
1038			$('html').removeClass('infinite-lightbox-on');
1039			$(window).scrollTop(scrollPos);
1040			lightbox_wrap.fadeOut(300, function(){
1041				$(this).remove();
1042			});
1043		});
1044
1045	} // infinite_lightbox
1046
1047	////////////////////////////////
1048	// starting running the script
1049	////////////////////////////////
1050	$(document).ready(function(){
1051	
1052		// resize font on mobile
1053		new infinite_font_resize();
1054
1055		// init main navigation menu
1056		$('#infinite-main-menu, #infinite-right-menu, #infinite-mobile-menu, #infinite-top-bar-menu').each(function(){
1057			if( $(this).children('nav').hasClass('ubermenu') ) return;
1058			
1059			if( $(this).hasClass('infinite-overlay-menu') ){
1060				new infinite_overlay_menu( $(this) );
1061			}else if( $(this).hasClass('infinite-mm-menu-wrap') ){
1062				$(this).infinite_mobile_menu();
1063			}else{
1064				new infinite_sf_menu( $(this) );
1065			}
1066		});
1067
1068		$('#infinite-top-search, #infinite-mobile-top-search').each(function(){
1069
1070			var search_wrap = $(this).siblings('.infinite-top-search-wrap');
1071			search_wrap.appendTo('body');
1072
1073			// bind click button
1074			$(this).on('click', function(){
1075				search_wrap.fadeIn(200, function(){
1076					$(this).addClass('infinite-active');
1077				});
1078			});
1079
1080			// bind close button
1081			search_wrap.find('.infinite-top-search-close').on('click', function(){
1082				search_wrap.fadeOut(200, function(){
1083					$(this).addClass('infinite-active');
1084				});
1085			});
1086
1087			// bind search button
1088			search_wrap.find('.search-submit').on('click', function(){
1089				if( search_wrap.find('.search-field').val().length == 0 ){
1090					return false;
1091				}
1092			});
1093		});
1094
1095		$('#infinite-main-menu-cart, #infinite-mobile-menu-cart').each(function(){
1096			
1097			$(this).on({
1098				mouseenter: function(){
1099					$(this).addClass('infinite-active infinite-animating');
1100				}, 
1101				mouseleave: function(){
1102					var menu_cart = $(this);
1103					menu_cart.removeClass('infinite-active');
1104					setTimeout(function(){
1105						menu_cart.removeClass('infinite-animating');
1106					}, 400)
1107				}
1108			});
1109		});
1110
1111		// woocommerce top bar cart
1112		if( typeof(wc_add_to_cart_params) != 'undefined' ){
1113			$('body').on('added_to_cart', function(){
1114				$.ajax({
1115					type: 'POST',
1116					url: wc_add_to_cart_params.ajax_url,
1117					data: { 'action': 'top_bar_woocommerce_cart' },
1118					dataType: 'json',
1119					error: function(jqXHR, textStatus, errorThrown){
1120						console.log(jqXHR, textStatus, errorThrown);
1121					},
1122					success: function(data){
1123						if( typeof(data['count']) != 'undefined' ){
1124							$('.infinite-top-cart-count').replaceWith(data['count']);
1125						}
1126						if( typeof(data['title']) != 'undefined' ){
1127							$('.infinite-top-cart-title').replaceWith(data['title']);
1128						}
1129						if( typeof(data['cart-items']) != 'undefined' ){
1130							$('.infinite-top-cart-item-wrap').replaceWith(data['cart-items']);
1131						}
1132					}
1133				});
1134			});
1135		}
1136		
1137
1138		// infinite
1139		$('#infinite-dropdown-infinite-flag').hover(function(){
1140			$(this).children('.infinite-dropdown-infinite-list').fadeIn(200);
1141		}, function(){
1142			$(this).children('.infinite-dropdown-infinite-list').fadeOut(200);
1143		});
1144
1145		// additional space for header transparent
1146		$('.infinite-header-boxed-wrap, .infinite-header-background-transparent, .infinite-navigation-bar-wrap.infinite-style-transparent').each(function(){
1147			var header_transparent = $(this);
1148			var header_transparent_sub = $('.infinite-header-transparent-substitute');
1149
1150			header_transparent_sub.height(header_transparent.outerHeight());
1151			$(window).on('load resize', function(){
1152				header_transparent_sub.height(header_transparent.outerHeight());
1153			});
1154		});
1155
1156		// full screen for 404 not found
1157		$('body.error404, body.search-no-results').each(function(){
1158
1159			var wrap = $(this).find('#infinite-full-no-header-wrap');
1160			var body_wrap_offset = parseInt($(this).children('.infinite-body-outer-wrapper').children('.infinite-body-wrapper').css('margin-bottom'));
1161			
1162			var padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2;
1163			if( padding > 0 ){
1164				wrap.css({ 'padding-top': padding, 'padding-bottom': padding });
1165			}
1166
1167			$(window).on('load resize', function(){
1168				wrap.css({ 'padding-top': 0, 'padding-bottom': 0 });
1169				padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2;
1170				if( padding > 0 ){
1171					wrap.css({ 'padding-top': padding, 'padding-bottom': padding });
1172				}
1173			});
1174		});
1175
1176		// back to top button
1177		var back_to_top = $('#infinite-footer-back-to-top-button');
1178		if( back_to_top.length ){ 
1179			$(window).on('scroll', function(){
1180				if( $(window).scrollTop() > 300 ){
1181					back_to_top.addClass('infinite-scrolled');
1182				}else{
1183					back_to_top.removeClass('infinite-scrolled');
1184				}
1185			});
1186		}
1187
1188		// page preload
1189		$('body').children('#infinite-page-preload').each(function(){
1190			var page_preload = $(this);
1191			var animation_time = parseInt(page_preload.attr('data-animation-time'));
1192			
1193			$('a[href]').not('[href^="tel:"], [href^="mailto:"], [href^="#"], [href^="mailto:"], [target="_blank"], .gdlr-core-js, .strip, .sf-with-ul, .remove, .ajax_add_to_cart, .comment-reply-link').on('click', function(e){
1194				if( e.which != 1 || $(this).hasClass('infinite-no-preload') || e.ctrlKey || e.metaKey ) return;
1195				
1196				if( $(this).closest('.modula').length ) return;
1197
1198				if( $(this).prop("hash") && $($(this).prop("hash")).length ) return;
1199				
1200				if( window.location.href != this.href ){
1201					page_preload.addClass('infinite-out').fadeIn(animation_time);
1202				}
1203			});
1204			
1205			$(window).on('load', function(){
1206				page_preload.fadeOut(animation_time);
1207			});
1208		});
1209
1210		// single nav style 2 sync height
1211		$('body.infinite-blog-style-2 .infinite-single-nav-area').each(function(){
1212			var max_height;
1213			var single_nav_2 = $(this).children();
1214
1215			max_height = 0;
1216			single_nav_2.css('min-height', '0px');
1217			single_nav_2.each(function(){
1218				if( max_height < $(this).outerHeight() ){
1219					max_height = $(this).outerHeight();
1220				}
1221			});
1222			single_nav_2.css('min-height', max_height);
1223
1224			$(window).resize(function(){
1225				max_height = 0;
1226				single_nav_2.css('min-height', '0px');
1227				single_nav_2.each(function(){
1228					if( max_height < $(this).outerHeight() ){
1229						max_height = $(this).outerHeight();
1230					}
1231				});
1232				single_nav_2.css('min-height', max_height);
1233			});
1234		});
1235
1236		// lightbox popup
1237		$('[data-infinite-lb]').click(function(){
1238			var lb_content = $(this).siblings('[data-infinite-lb-id="' + $(this).attr('data-infinite-lb') + '"]');
1239			infinite_lightbox(lb_content.clone());
1240		});
1241
1242		// float social
1243		$('#infinite-float-social').each(function(){
1244			var float_social_item = $(this);
1245			var pb_body = $('.gdlr-core-page-builder-body');
1246
1247			var footer = $('footer');
1248			var content_area = $('.infinite-page-wrapper');
1249			var content_offset = 0;
1250			content_offset += parseInt($('html').css('margin-top'));
1251
1252			$(window).on('scroll float-social', function(){
1253
1254				
1255				// display
1256				if( float_social_item.hasClass('infinite-display-after-title') ){
1257					var blog_offset = 0;
1258					content_area.children('.infinite-blog-title-wrap').each(function(){ blog_offset = $(this).outerHeight(); });
1259
1260					if( float_social_item.offset().top >= content_area.offset().top + blog_offset - content_offset ){
1261						float_social_item.animate({'opacity': 1}, {duration: 100, queue: false});
1262					}else{
1263						float_social_item.animate({'opacity': 0}, {duration: 100, queue: false});
1264					}
1265				}
1266
1267				// section
1268				var section = '';
1269				var fs_pos = $(window).scrollTop() + $(window).height() / 2; 
1270
1271				if( fs_pos > footer.offset().top ){
1272					section = 'footer';
1273				}else{
1274					pb_body.children().each(function(){
1275						if( !$(this).attr('data-float-social') ) return;
1276
1277						if( fs_pos > $(this).offset().top && fs_pos <  $(this).offset().top + $(this).outerHeight() ){
1278							section = $(this).attr('data-float-social');
1279						}
1280					});
1281				}
1282
1283				float_social_item.attr('data-section', section);
1284			});
1285			$(window).on('load', function(){
1286				$(window).trigger('float-social');
1287			});
1288		});
1289
1290		// side content menu
1291		$('#infinite-side-content-menu').each(function(){
1292
1293			var side_content_menu = $(this);
1294			var menu_button = $('.infinite-side-content-menu-button');
1295			menu_button.on('click', function(){
1296				side_content_menu.fadeIn(300);
1297				side_content_menu.addClass('infinite-active');
1298			});
1299			side_content_menu.on('click', '.infinite-side-content-menu-close', function(){
1300				side_content_menu.removeClass('infinite-active');
1301				side_content_menu.fadeOut(300);
1302			});
1303
1304		});
1305		
1306	});
1307
1308	// fix back button for preload
1309	$(window).on('pageshow', function(event) {
1310        $('body').children('#infinite-page-preload').each(function(){
1311			$(this).fadeOut(400);
1312		});
1313	});
1314
1315	$(window).on('load', function(){
1316
1317		// fixed footer
1318		$('#infinite-fixed-footer').each(function(){
1319			var fixed_footer = $(this);
1320			var placeholder = $('<div class="infinite-fixed-footer-placeholder" ></div>');
1321
1322			placeholder.insertBefore(fixed_footer);
1323			placeholder.height(fixed_footer.outerHeight());
1324			$('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); // for safari
1325			$(window).resize(function(){ 
1326				placeholder.height(fixed_footer.outerHeight()); 
1327				$('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top')));
1328			});
1329		});
1330
1331		// side navigation bar
1332		new infinite_header_side_nav( $('#infinite-header-side-nav') );
1333
1334		// sticky navigation
1335		new infinite_sticky_navigation();
1336
1337		// anchoring
1338		new infinite_anchor();
1339
1340		// update woocommerce data
1341		$('body').not('.woocommerce-cart, .woocommerce-checkout').trigger('added_to_cart');
1342	});
1343
1344})(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.