PageSourceSearch

https://felizconexito.com/wp-content/themes/Divi/js/custom.js?ver=2.5.6

js felizconexito.com collected 2026-10-07 15:06:40 UTC 34,525 bytes, 901 lines download raw bytes

1(function($){
2	var $et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ),
3		et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ),
4		et_is_ipad = navigator.userAgent.match( /iPad/ ),
5		$et_container = $( '.container' ),
6		et_container_width = $et_container.width(),
7		et_is_fixed_nav = $( 'body' ).hasClass( 'et_fixed_nav' ),
8		et_is_vertical_fixed_nav = $( 'body' ).hasClass( 'et_vertical_fixed' ),
9		et_is_rtl = $( 'body' ).hasClass( 'rtl' ),
10		et_hide_nav = $( 'body' ).hasClass( 'et_hide_nav' ),
11		et_header_style_left = $( 'body' ).hasClass( 'et_header_style_left' ),
12		et_vertical_navigation = $( 'body' ).hasClass( 'et_vertical_nav' ),
13		$top_header = $('#top-header'),
14		$main_header = $('#main-header'),
15		$main_container_wrapper = $( '#page-container' ),
16		$et_transparent_nav = $( '.et_transparent_nav' ),
17		$et_main_content_first_row = $( '#main-content .container:first-child' ),
18		$et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),
19		$et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1' ),
20		$et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),
21		$et_single_post = $( 'body.single-post' ),
22		$et_window = $(window),
23		etRecalculateOffset = false,
24		et_header_height,
25		et_header_modifier,
26		et_header_offset,
27		et_primary_header_top,
28		$et_vertical_nav = $('.et_vertical_nav'),
29		$et_header_style_split = $('.et_header_style_split'),
30		$et_top_navigation = $('#et-top-navigation'),
31		$logo = $('#logo'),
32		$et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:first-child' );
33
34	$(document).ready( function(){
35		var $et_top_menu = $( 'ul.nav' ),
36			$et_search_icon = $( '#et_search_icon' ),
37			et_parent_menu_longpress_limit = 300,
38			et_parent_menu_longpress_start,
39			et_parent_menu_click = true;
40
41		$et_top_menu.find( 'li' ).hover( function() {
42			if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) {
43				$(this).addClass( 'et-show-dropdown' );
44				$(this).removeClass( 'et-hover' ).addClass( 'et-hover' );
45			}
46		}, function() {
47			var $this_el = $(this);
48
49			$this_el.removeClass( 'et-show-dropdown' );
50
51			setTimeout( function() {
52				if ( ! $this_el.hasClass( 'et-show-dropdown' ) ) {
53					$this_el.removeClass( 'et-hover' );
54				}
55			}, 200 );
56		} );
57
58		// Dropdown menu adjustment for touch screen
59		$et_top_menu.find('.menu-item-has-children > a').on( 'touchstart', function(){
60			et_parent_menu_longpress_start = new Date().getTime();
61		} ).on( 'touchend', function(){
62			var et_parent_menu_longpress_end = new Date().getTime()
63			if ( et_parent_menu_longpress_end  >= et_parent_menu_longpress_start + et_parent_menu_longpress_limit ) {
64				et_parent_menu_click = true;
65			} else {
66				et_parent_menu_click = false;
67
68				// Close sub-menu if toggled
69				var $et_parent_menu = $(this).parent('li');
70				if ( $et_parent_menu.hasClass( 'et-hover') ) {
71					$et_parent_menu.trigger( 'mouseleave' );
72				} else {
73					$et_parent_menu.trigger( 'mouseenter' );
74				}
75			}
76			et_parent_menu_longpress_start = 0;
77		} ).click(function() {
78			if ( et_parent_menu_click ) {
79				return true;
80			}
81
82			return false;
83		} );
84
85		$et_top_menu.find( 'li.mega-menu' ).each(function(){
86			var $li_mega_menu           = $(this),
87				$li_mega_menu_item      = $li_mega_menu.children( 'ul' ).children( 'li' ),
88				li_mega_menu_item_count = $li_mega_menu_item.length;
89
90			if ( li_mega_menu_item_count < 4 ) {
91				$li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count );
92			}
93		});
94
95		if ( $et_header_style_split.length && $et_vertical_nav.length < 1 ) {
96			function et_header_menu_split(){
97				var $logo_container = $( '#main-header > .container > .logo_container' ),
98					$logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),
99					et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),
100					et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1;
101
102				if ( $et_window.width() > 980 && $logo_container.length ) {
103					$('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') );
104					$logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') );
105				}
106
107				if ( $et_window.width() <= 980 && $logo_container_splitted.length ) {
108					$logo_container_splitted.prependTo('#main-header > .container');
109					$('#main-header .centered-inline-logo-wrap').remove();
110				}
111			}
112			et_header_menu_split();
113
114			$(window).resize(function(){
115				et_header_menu_split();
116			});
117		}
118
119		if ( $('ul.et_disable_top_tier').length ) {
120			$("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#');
121		}
122
123		if ( $( '.et_vertical_nav' ).length ) {
124			if ( $( '#main-header' ).height() < $( '#et-top-navigation' ).height() ) {
125				$( '#main-header' ).height( $( '#et-top-navigation' ).height() + $( '#logo' ).height() + 100 );
126			}
127		}
128
129		window.et_calculate_header_values = function() {
130			var $top_header = $( '#top-header' ),
131				secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHe
131ight() : 0,
132				admin_bar_height     = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0;
133
134			et_header_height      = $( '#main-header' ).innerHeight() + secondary_nav_height,
135			et_header_modifier    = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56,
136			et_header_offset      = et_header_modifier + admin_bar_height;
137
138			et_primary_header_top = secondary_nav_height + admin_bar_height;
139		}
140
141		var $comment_form = $('#commentform');
142
143		et_pb_form_placeholders_init( $comment_form );
144
145		$comment_form.submit(function(){
146			et_pb_remove_placeholder_text( $comment_form );
147		});
148
149		et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' );
150
151		if ( $( '#et-secondary-nav' ).length ) {
152			$('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() );
153		}
154
155		function et_change_primary_nav_position( delay ) {
156			setTimeout( function() {
157				var $body = $('body'),
158					$wpadminbar = $( '#wpadminbar' ),
159					$top_header = $( '#top-header' ),
160					et_primary_header_top = 0;
161
162				if ( $wpadminbar.length ) {
163					et_primary_header_top += $wpadminbar.innerHeight();
164				}
165
166				if ( $top_header.length ) {
167					et_primary_header_top += $top_header.innerHeight();
168				}
169
170				if ( ! $body.hasClass( 'et_vertical_nav' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
171					$('#main-header').css( 'top', et_primary_header_top );
172				}
173			}, delay );
174		}
175
176		function et_hide_nav_transofrm( ) {
177			var $body = $( 'body' ),
178				$body_height = $( document ).height(),
179				$viewport_height = $( window ).height() + et_header_height + 200;
180
181			if ( $body.hasClass( 'et_hide_nav' ) ||  $body.hasClass( 'et_hide_nav_disabled' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
182				if ( $body_height > $viewport_height ) {
183					if ( $body.hasClass( 'et_hide_nav_disabled' ) ) {
184						$body.addClass( 'et_hide_nav' );
185						$body.removeClass( 'et_hide_nav_disabled' );
186					}
187					$('#main-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
188					$('#top-header').css( 'transform', 'translateY(-' + et_header_height +'px)' );
189				} else {
190					$('#main-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
191					$('#top-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } );
192					$body.removeClass( 'et_hide_nav' );
193					$body.addClass( 'et_hide_nav_disabled' );
194				}
195			}
196		}
197
198		function et_fix_page_container_position(){
199			var et_window_width     = $et_window.width(),
200				$top_header          = $( '#top-header' ),
201				secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0;
202
203			// Set data-height-onload for header if the page is loaded on large screen
204			// If the page is loaded from small screen, rely on data-height-onload printed on the markup,
205			// prevent window resizing issue from small to large
206			if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ){
207				$main_header.attr({ 'data-height-onload' : $main_header.height(), 'data-height-loaded' : true });
208			}
209
210			// Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)
211			if ( et_window_width <= 980 ) {
212				var header_height = $main_header.innerHeight() + secondary_nav_height - 1;
213
214				// If transparent is detected, #main-content .container's padding-top needs to be added to header_height
215				// And NOT a pagebuilder page
216				if ( $et_transparent_nav.length && ! $et_pb_first_row.length ) {
217					header_height += 58;
218				}
219			} else {
220
221				// Get header height from header attribute
222				var header_height = parseInt( $main_header.attr( 'data-height-onload' ) ) + secondary_nav_height;
223
224				// Non page builder page needs to be added by #main-content .container's fixed height
225				if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
226					header_height += 58;
227				}
228			}
229
230			// Specific adjustment required for transparent nav + not vertical nav
231			if ( $et_transparent_nav.length && ! $et_vertical_nav.length ){
232
233				// Add class for first row for custom section padding purpose
234				$et_pb_first_row.addClass( 'et_pb_section_first' );
235
236				// List of conditionals
237				var is_pb                            = $et_pb_first_row.length,
238					is_post_pb                       = is_pb && $et_single_post.length,
239					is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,
240					is_post_pb_full_layout_no_title  = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,
241					is_pb_fullwidth_section_first    = $et_pb_first_row.is( '.et_pb_fullwidth_section' ),
242					is_no_pb_mobile                  = et_window_width <= 980 && $et_main_content_first_row.length;
243
244				if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) {
245
246					/* Desktop / Mobile + Single Post */
247
248					/*
249					 * EXCEPT for fullwidth layout + fullwidth section ( at the first row ).
250					 * It is basically the same as page + fullwidth section with few quirk.
251					 * Instead of duplicating the conditional for each module, it'll be simpler to negate
252					 * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first
253					 */
254
255					// Remove main content's inline padding to styling to prevent looping padding-top calculation
256					$et_main_content_first_row.css({ 'paddingTop' : '' });
257
258					if ( et_window_width < 980 ) {
259						header_height += 40;
260					}
261
262					if ( is_pb_fullwidth_section_first ) {
263						// If the first section is fullwidth, restore the padding-top modified area at first section
264						$et_pb_first_row.css({
265							'paddingTop' : '0',
266						});
267					}
268
269					if ( is_post_pb_full_layout_has_title ) {
270
271						// Add header height to post meta wrapper as padding top
272						$et_main_content_first_row_meta_wrapper.css({
273							'paddingTop' : header_height
274						});
275
276					} else if ( is_post_pb_full_layout_no_title ) {
277
278						$et_pb_first_row.css({
279							'paddingTop' : header_height
280						});
281
282					} else {
283
284						// Add header height to first row content as padding top
285						$et_main_content_first_row.css({
286							'paddingTop' : header_height
287						});
288
289					}
290
291				} else if ( is_pb_fullwidth_section_first ){
292
293					/* Desktop / Mobile + Pagebuilder + Fullwidth Section */
294
295					var $et_pb_first_row_first_module = $et_pb_first_row.children( '.et_pb_module:first' );
296
297					// Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row,
298					// Remove the added height at line 2656
299					if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980 ) {
300						header_height = header_height - 58;
301					}
302
303					if ( $et_pb_first_row_first_module.is( '.et_pb_slider' ) ) {
304
305						/* Desktop / Mobile + Pagebuilder + Fullwidth slider */
306
307						var $et_pb_first_row_first_module_slide_image 		= $et_pb_first_row_first_module.find( '.et_pb_slide_image' ),
308							$et_pb_first_row_first_module_slide 				= $et_pb_first_row_first_module.find( '.et_pb_slide' ),
309							$et_pb_first_row_first_module_slide_container 	= $et_pb_first_row_first_module.find( '.et_pb_slide .et_pb_container' ),
310							et_pb_slide_image_margin_top 		= 0 - ( parseInt( $et_pb_first_row_first_module_slide_image.height() ) / 2 ),
311							et_pb_slide_container_height 		= 0,
312							$et_pb_first_row_first_module_slider_arrow 		= $et_pb_first_row_first_module.find( '.et-pb-slider-arrows a'),
313							et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height();
314
315						// Adding padding top to each slide so the transparency become useful
316						$et_pb_first_row_first_module_slide.css({
317							'paddingTop' : header_height,
318						});
319
320						// delete container's min-height
321						$et_pb_first_row_first_module_slide_container.css({
322							'min-height' : ''
323						});
324
325						// Adjusting slider's image, considering additional top padding of slideshow
326						$et_pb_first_row_first_module_slide_image.css({
327							'marginTop' : et_pb_slide_image_margin_top
328						});
329
330						// Adjusting slider's arrow, considering additional top padding of slideshow
331						$et_pb_first_row_first_module_slider_arrow.css({
332							'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) )
333						});
334
335						// Looping the slide and get the highest height of slide
336						et_pb_first_row_slide_container_height_new = 0
337
338						$et_pb_first_row_first_module.find( '.et_pb_slide' ).each( function(){
339							var $et_pb_first_row_first_module_slide_item = $(this),
340								$et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module_slide_item.find( '.et_pb_container' );
341
342							// Make sure that the slide is visible to calculate correct height
343							$et_pb_first_row_first_module_slide_item.show();
344
345							// Remove existing inline css to make sure that it calculates the height
346							$et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' });
347
348							var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHe
348ight();
349
350							if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){
351								et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height;
352							}
353
354							// Hide the slide back if it isn't active slide
355							if ( $et_pb_first_row_first_module_slide_item.is( ':not(".et-pb-active-slide")' ) ){
356								$et_pb_first_row_first_module_slide_item.hide();
357							}
358						});
359
360						// Setting appropriate min-height, considering additional top padding of slideshow
361						$et_pb_first_row_first_module_slide_container.css({
362							'min-height' : et_pb_first_row_slide_container_height_new
363						});
364
365					} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_header' ) ) {
366
367						/* Desktop / Mobile + Pagebuilder + Fullwidth header */
368
369						// Remove existing inline stylesheet to prevent looping padding
370						$et_pb_first_row_first_module.removeAttr( 'style' );
371
372						// Get paddingTop from stylesheet
373						var et_pb_first_row_first_module_fullwidth_header_padding_top = parseInt( $et_pb_first_row_first_module.css( 'paddingTop' ) );
374
375						// Implement stylesheet's padding-top + header_height
376						$et_pb_first_row_first_module.css({
377							'paddingTop' : ( header_height + et_pb_first_row_first_module_fullwidth_header_padding_top )
378						} );
379
380					} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_portfolio' ) ) {
381
382						/* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */
383
384						$et_pb_first_row_first_module.css({ 'paddingTop' : header_height });
385
386					} else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) {
387
388						/* Desktop / Mobile + Pagebuilder + Fullwidth Map */
389
390						var $et_pb_first_row_map = $et_pb_first_row_first_module.find( '.et_pb_map' );
391
392						// Remove existing inline height to prevent looping height calculation
393						$et_pb_first_row_map.css({ 'height' : '' });
394
395						// Implement map height + header height
396						$et_pb_first_row_first_module.find('.et_pb_map').css({
397							'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) )
398						});
399
400						// Adding specific class to mark the map as first row section element
401						$et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' );
402
403					} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) {
404
405						/* Desktop / Mobile + Pagebuilder + Fullwidth Menu */
406						$et_pb_first_row_first_module.css({ 'marginTop' : header_height });
407
408					} else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) {
409
410						/* Desktop / Mobile + Pagebuilder + Fullwidth code */
411
412						var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module;
413
414						$et_pb_first_row_first_module_code.css({ 'paddingTop' : '' });
415
416						var et_pb_first_row_first_module_code_padding_top = parseInt( $et_pb_first_row_first_module_code.css( 'paddingTop' ) );
417
418						$et_pb_first_row_first_module_code.css({
419							'paddingTop' : header_height + et_pb_first_row_first_module_code_padding_top
420						});
421
422					} else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) {
423
424						/* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */
425
426						var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module;
427
428						$et_pb_first_row_first_module_title.css({
429							'paddingTop' : header_height + 50
430						});
431					}
432
433				} else if ( is_pb ) {
434
435					/* Desktop / Mobile + Pagebuilder + Regular section */
436
437					// Remove first row's inline padding top styling to prevent looping padding-top calculation
438					$et_pb_first_row.css({ 'paddingTop' : '' });
439
440					// Pagebuilder ignores #main-content .container's fixed height and uses its row's padding
441					// Anticipate the use of custom section padding.
442					et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) );
443
444					// Implementing padding-top + header_height
445					$et_pb_first_row.css({
446						'paddingTop' : et_pb_first_row_padding_top
447					});
448
449				} else if ( is_no_pb_mobile ) {
450
451					// Mobile + not pagebuilder
452					$et_main_content_first_row.css({
453						'paddingTop' : header_height
454					});
455
456				} else {
457
458					$('#main-content .container:first-child').css({
459						'paddingTop' : header_height
460					});
461
462				}
463
464				// Set #page-container's padding-top to zero after inline styling first row's content has been added
465				if ( ! $('#et_fix_page_container_position').length ){
466					$( '<style />', {
467						'id' : 'et_fix_page_container_position',
468						'text' : '#page-container{ padding-top: 0 !important;}'
469					}).appendTo('head');
470				}
471
472			} else if( et_is_fixed_nav ) {
473
474				$main_container_wrapper.css( 'paddingTop', header_height );
475
476			}
477
478			et_change_primary_nav_position( 0 );
479		}
480
481		$( window ).resize( function(){
482			var window_width                = $et_window.width(),
483				et_container_css_width      = $et_container.css( 'width' ),
484				et_container_width_in_pixel = ( typeof et_container_css_width !== 'undefined' ) ? et_container_css_width.substr( -1, 1 ) !== '%' : '',
485				et_container_actual_width   = ( et_container_width_in_pixel ) ? $et_container.width() : ( ( $et_container.width() / 100 ) * window_width ), // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly
486				containerWidthChanged       = et_container_width !== et_container_actual_width;
487
488			if ( et_is_fixed_nav && containerWidthChanged ) {
489				if ( typeof update_page_container_position != 'undefined' ){
490					clearTimeout( update_page_container_position );
491				}
492
493				var update_page_container_position = setTimeout( function() {
494					et_fix_page_container_position();
495					if ( typeof et_fix_fullscreen_section === 'function' ) {
496						et_fix_fullscreen_section();
497					}
498				}, 200 );
499			}
500
501			if ( et_hide_nav ) {
502				et_hide_nav_transofrm();
503			}
504
505			if ( $( '#wpadminbar' ).length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 ) {
506				et_calculate_header_values();
507
508				et_change_primary_nav_position( 0 );
509			}
510
511			et_set_search_form_css();
512		} );
513
514		$( window ).ready( function(){
515			if ( $.fn.fitVids ) {
516				$( '#main-content' ).fitVids( { customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"} );
517			}
518		} );
519
520		$( window ).load( function(){
521			if ( et_is_fixed_nav ) {
522				et_calculate_header_values();
523			}
524
525			et_fix_page_container_position();
526
527			if ( et_header_style_left && !et_vertical_navigation) {
528				$logo_width = $( '#logo' ).width();
529				if ( et_is_rtl ) {
530					$et_top_navigation.css( 'padding-right', $logo_width + 30 );
531				} else {
532					$et_top_navigation.css( 'padding-left', $logo_width + 30 );
533				}
534			}
535
536			if ( $('p.demo_store').length ) {
537				$('#footer-bottom').css('margin-bottom' , $('p.demo_store').innerHeight());
538			}
539
540			if ( $.fn.waypoint ) {
541				if ( et_is_vertical_fixed_nav ) {
542					var $waypoint_selector = $('#main-content');
543
544					$waypoint_selector.waypoint( {
545						handler : function( direction ) {
546							et_fix_logo_transition();
547
548							if ( direction === 'down' ) {
549								$('#main-header').addClass( 'et-fixed-header' );
550							} else {
551								$('#main-header').removeClass( 'et-fixed-header' );
552							}
553						}
554					} );
555				}
556
557				if ( et_is_fixed_nav ) {
558
559					if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_pb_first_row.length ){
560
561						// Fullscreen section at the first row requires specific adjustment
562						if ( $et_pb_first_row.is( '.et_pb_fullwidth_section' ) ){
563							var $waypoint_selector = $et_pb_first_row.children('.et_pb_module');
564						} else {
565							var $waypoint_selector = $et_pb_first_row.find('.et_pb_row');
566						}
567					} else if ( $et_transparent_nav.length && ! $et_vertical_nav.length && $et_main_content_first_row.length ) {
568						var $waypoint_selector = $('#content-area');
569					} else {
570						var $waypoint_selector = $('#main-content');
571					}
572
573					$waypoint_selector.waypoint( {
574						offset: function() {
575							if ( etRecalculateOffset ) {
576								setTimeout( function() {
577									et_calculate_header_values();
578								}, 200 );
579
580								etRecalculateOffset = false;
581							}
582							if ( et_hide_nav ) {
583								return et_header_offset - et_header_height - 200;
584							} else {
585
586								// Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height
587								var waypoint_selector_offset = $waypoint_selector.offset();
588
589								if ( waypoint_selector_offset.top < et_header_offset ) {
590									et_header_offset = 0 - ( et_header_offset - waypoint_selector_offset.top );
591								}
592
593								return et_header_offset;
594							}
595						},
596						handler : function( direction ) {
597							et_fix_logo_transition();
598
599							if ( direction === 'down' ) {
600								$main_header.addClass( 'et-fixed-header' );
601								$main_container_wrapper.addClass ( 'et-animated-content' );
602								$top_header.addClass( 'et-fixed-header' );
603
604								if ( ! et_hide_nav && ! $et_transparent_nav.length && ! $( '.mobile_menu_bar' ).is(':visible') ) {
605									var secondary_nav_height = $top_header.height(),
606										et_is_vertical_nav = $( 'body' ).hasClass( 'et_vertical_nav' ),
607										$clone_header,
608										clone_header_height,
609										fix_padding;
610
611									$clone_header = $main_header.clone().addClass( 'et-fixed-header, et_header_clone' ).css( { 'transition': 'none', 'display' : 'none' } );
612
613									clone_header_height = $clone_header.prependTo( 'body' ).height();
614
615									// Vertical nav doesn't need #page-container margin-top adjustment
616									if ( ! et_is_vertical_nav ) {
617										fix_padding = parseInt( $main_container_wrapper.css( 'padding-top' ) ) - clone_header_height - secondary_nav_height + 1 ;
618
619										$main_container_wrapper.css( 'margin-top', -fix_padding );
620									}
621
622									$( '.et_header_clone' ).remove();
623								}
624
625							} else {
626								$main_header.removeClass( 'et-fixed-header' );
627								$top_header.removeClass( 'et-fixed-header' );
628								$main_container_wrapper.css( 'margin-top', '-1px' );
629							}
630							setTimeout( function() {
631								et_set_search_form_css();
632							}, 400 );
633						}
634					} );
635				}
636
637				if ( et_hide_nav ) {
638					et_hide_nav_transofrm();
639				}
640			}
641		} );
642
643		$( 'a[href*=#]:not([href=#])' ).click( function() {
644			var $this_link = $( this ),
645				disable_scroll = ( $this_link.closest( '.woocommerce-tabs' ).length && $this_link.closest( '.tabs' ).length ) || $this_link.closest( '.eab-shortcode_calendar-navigation-link' ).length;
646
647			if ( ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) && ! disable_scroll ) {
648				var target = $( this.hash );
649				target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' );
650				if ( target.length ) {
651
652					et_pb_smooth_scroll( target, false, 800 );
653
654					if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
655						setTimeout(function(){
656							et_pb_smooth_scroll( target, false, 40, 'linear' );
657						}, 780 );
658					}
659
660					return false;
661				}
662			}
663		});
664
665		if ( $( '.et_pb_section' ).length > 1 && $( '.et_pb_side_nav_page' ).length ) {
666			var $i=0;
667
668			$( '#main-content' ).append( '<ul class="et_pb_side_nav"></ul>' );
669
670			$( '.et_pb_section' ).each( function(){
671				if ( $( this ).height() > 0 ) {
672					$active_class = $i == 0 ? 'active' : '';
673					$( '.et_pb_side_nav' ).append( '<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + $i + '" class= "' + $active_class + '">' + $i + '</a></li>' );
674					$( this ).addClass( 'et_pb_scroll_' + $i );
675					$i++;
676				}
677			});
678
679			$side_nav_offset = ( $i * 20 + 40 ) / 2;
680			$( 'ul.et_pb_side_nav' ).css( 'marginTop', '-' + parseInt( $side_nav_offset) + 'px' );
681			$( '.et_pb_side_nav' ).addClass( 'et-visible' );
682
683
684			$( '.et_pb_side_nav a' ).click( function(){
685				$top_section =  ( $( this ).text() == "0" ) ? true : false;
686				$target = $( '.et_pb_scroll_' + $( this ).text() );
687
688				et_pb_smooth_scroll( $target, $top_section, 800);
689
690				if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) {
691					setTimeout(function(){
692						 et_pb_smooth_scroll( $target, $top_section, 200);
693					},500);
694				}
695
696				return false;
697			});
698
699			$( window ).scroll( function(){
700
701				$add_offset = ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) ? 20 : -90;
702
703				if ( $ ( '#wpadminbar' ).length && $( window ).width() > 600 ) {
704					$add_offset += $( '#wpadminbar' ).outerHeight();
705				}
706
707				$side_offset = ( $( 'body' ).hasClass( 'et_vertical_nav' ) ) ? $( '#top-header' ).height() + $add_offset + 60 : $( '#top-header' ).height() + $( '#main-header' ).height() + $add_offset;
708
709				for ( var $i = 0; $i <= $( '.side_nav_item a' ).length - 1; $i++ ) {
710					 if ( $( window ).scrollTop() + $( window ).height() == $( document ).height() ) {
711						$last = $( '.side_nav_item a' ).length - 1;
712						$( '.side_nav_item a' ).removeClass( 'active' );
713						$( 'a#side_nav_item_id_' + $last ).addClass( 'active' );
714					 } else {
715						if ( $( this ).scrollTop() >= $( '.et_pb_scroll_' + $i ).offset().top - $side_offset ) {
716							$( '.side_nav_item a' ).removeClass( 'active' );
717							$( 'a#side_nav_item_id_' + $i ).addClass( 'active' );
718						}
719					}
720				}
721			});
722		}
723
724		if ( $('.et_pb_scroll_top').length ) {
725			$(window).scroll(function(){
726				if ($(this).scrollTop() > 800) {
727					$('.et_pb_scroll_top').show().removeClass( 'et-hidden' ).addClass( 'et-visible' );
728				} else {
729					$('.et_pb_scroll_top').removeClass( 'et-visible' ).addClass( 'et-hidden' );
730				}
731			});
732
733			//Click event to scroll to top
734			$('.et_pb_scroll_top').click(function(){
735				$('html, body').animate({scrollTop : 0},800);
736			});
737		}
738
739		if ( $( '.comment-reply-link' ).length ) {
740			$( '.comment-reply-link' ).addClass( 'et_pb_button' );
741		}
742
743		$( '#et_top_search' ).click( function() {
744			var $search_container = $( '.et_search_form_container' );
745
746			$( '.et_menu_container' ).removeClass( 'et_pb_menu_visible' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_menu_hidden');
747			$search_container.removeClass( 'et_pb_search_form_hidden' ).removeClass( 'et_pb_no_animation' ).addClass('et_pb_search_visible');
748			setTimeout( function() {
749				$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
750				$search_container.addClass( 'et_pb_no_animation' );
751			}, 1000);
752			$search_container.find( 'input' ).focus();
753
754			et_set_search_form_css();
755		});
756
757		function et_hide_search() {
758			$( '.et_menu_container' ).removeClass('et_pb_menu_hidden').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_menu_visible' );
759			$( '.et_search_form_container' ).removeClass('et_pb_search_visible').removeClass( 'et_pb_no_animation' ).addClass( 'et_pb_search_form_hidden' );
760			setTimeout( function() {
761				$( '.et_menu_container' ).addClass( 'et_pb_no_animation' );
762				$( '.et_search_form_container' ).addClass( 'et_pb_no_animation' );
763			}, 1000);
764		}
765
766		function et_set_search_form_css() {
767			var $search_container = $( '.et_search_form_container' );
768			var $body = $( 'body' );
769			if ( $search_container.hasClass( 'et_pb_search_visible' ) ) {
770				var header_height = $( '#main-header' ).innerHeight(),
771					menu_width = $( '#top-menu' ).width(),
772					font_size = $( '#top-menu li a' ).css( 'font-size' );
773				$search_container.css( { 'height' : header_height + 'px' } );
774				$search_container.find( 'input' ).css( 'font-size', font_size );
775				if ( ! $body.hasClass( 'et_header_style_left' ) ) {
776					$search_container.css( 'max-width', menu_width + 60 );
777				} else {
778					$search_container.find( 'form' ).css( 'max-width', menu_width + 60 );
779				}
780			}
781		}
782
783		$( '.et_close_search_field' ).click( function() {
784			et_hide_search();
785		});
786
787		$( document ).mouseup( function(e) {
788			var $header = $( '#main-header' );
789			if ( $( '.et_menu_container' ).hasClass('et_pb_menu_hidden') ) {
790				if ( ! $header.is( e.target ) && $header.has( e.target ).length === 0 )	{
791					et_hide_search();
792				}
793			}
794		});
795
796		// Detect actual logo dimension, used for tricky fixed navigation transition
797		function et_define_logo_dimension() {
798			var $logo = $('#logo'),
799				logo_src = $logo.attr( 'src' ),
800				is_svg = logo_src.substr( -3, 3 ) === 'svg' ? true : false,
801				$logo_wrap,
802				logo_width,
803				logo_height;
804
805			// Append invisible wrapper at the bottom of the page
806			$('body').append( $('<div />', {
807				'id' : 'et-define-logo-wrap',
808				'style' : 'position: fixed; bottom: 0; opacity: 0;'
809			}));
810
811			// Define logo wrap
812			$logo_wrap = $('#et-define-logo-wrap');
813
814			if( is_svg ) {
815				$logo_wrap.addClass( 'svg-logo' );
816			}
817
818			// Clone logo to invisible wrapper
819			$logo_wrap.html( $logo.clone().css({ 'display' : 'block' }).removeAttr( 'id' ) );
820
821			// Get dimension
822			logo_width = $logo_wrap.find('img').width();
823			logo_height = $logo_wrap.find('img').height();
824
825			// Add data attribute to $logo
826			$logo.attr({
827				'data-actual-width' : logo_width,
828				'data-actual-height' : logo_height
829			});
830
831			// Destroy invisible wrapper
832			$logo_wrap.remove();
833
834			// Init logo transition onload
835			et_fix_logo_transition( true );
836		}
837
838		if ( $('#logo').length ) {
839			et_define_logo_dimension();
840		}
841
842		// Set width for adsense in footer widget
843		$('.footer-widget').each(function(){
844			var $footer_widget = $(this),
845				footer_widget_width = $footer_widget.width(),
846				$adsense_ins = $footer_widget.find( '.widget_adsensewidget ins' );
847
848			if ( $adsense_ins.length ) {
849				$adsense_ins.width( footer_widget_width );
850			}
851		});
852	} );
853
854	// Fixing logo size transition in tricky header style
855	function et_fix_logo_transition( is_onload ) {
856		var $body                = $( 'body' ),
857			$logo                = $( '#logo' ),
858			logo_actual_width    = parseInt( $logo.attr( 'data-actual-width' ) ),
859			logo_actual_height   = parseInt( $logo.attr( 'data-actual-height' ) ),
860			logo_height_percentage = parseInt( $logo.attr( 'data-height-percentage' ) ),
861			$top_nav             = $( '#et-top-navigation' ),
862			top_nav_height       = parseInt( $top_nav.attr( 'data-height' ) ),
863			top_nav_fixed_height = parseInt( $top_nav.attr( 'data-fixed-height' ) ),
864			$main_header          = $('#main-header'),
865			is_header_split      = $body.hasClass( 'et_header_style_split' ),
866			is_fixed_nav         = $main_header.hasClass( 'et-fixed-header' ),
867			is_vertical_nav      = $body.hasClass( 'et_vertical_nav' ),
868			is_hide_primary_logo = $body.hasClass( 'et_hide_primary_logo' ),
869			is_hide_fixed_logo   = $body.hasClass( 'et_hide_fixed_logo' ),
870			is_onload            = typeof is_onload === 'undefined' ? false : is_onload,
871			logo_height_base     = is_fixed_nav ? top_nav_height : top_nav_fixed_height,
872			logo_wrapper_width,
873			logo_wrapper_height;
874
875		// Fix for inline centered logo in horizontal nav
876		if ( is_header_split && ! is_vertical_nav ) {
877			// On page load, logo_height_base should be top_nav_height
878			if ( is_onload ) {
879				logo_height_base = top_nav_height;
880			}
881
882			// Calculate logo wrapper height
883			logo_wrapper_height = ( logo_height_base * ( logo_height_percentage / 100 ) + 22 );
884
885			// Calculate logo wrapper width
886			logo_wrapper_width = logo_actual_width * (  logo_wrapper_height / logo_actual_height  );
887
888			// Override logo wrapper width to 0 if it is hidden
889			if ( is_hide_primary_logo && ( is_fixed_nav || is_onload ) ) {
890				logo_wrapper_width = 0;
891			}
892
893			if ( is_hide_fixed_logo && ! is_fixed_nav && ! is_onload ) {
894				logo_wrapper_width = 0;
895			}
896
897 			// Set fixed width for logo wrapper to force correct dimension
898			$( '.et_header_style_split .centered-inline-logo-wrap' ).css( { 'width' : logo_wrapper_width } );
899		}
900	}
901})(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.