PageSourceSearch

https://www.alhambra.org/blog/wp-content/themes/Divi/includes/buil…tend-builder-global-functions.js?ver=3.0.44

js alhambra.org collected 2026-10-02 10:45:35 UTC 8,343 bytes, 241 lines download raw bytes

1(function($){
2	window.et_pb_smooth_scroll = function( $target, $top_section, speed, easing ) {
3		var $window_width = $( window ).width();
4
5		if ( $( 'body' ).hasClass( 'et_fixed_nav' ) && $window_width > 980 ) {
6			$menu_offset = $( '#top-header' ).outerHeight() + $( '#main-header' ).outerHeight() - 1;
7		} else {
8			$menu_offset = -1;
9		}
10
11		if ( $ ('#wpadminbar').length && $window_width > 600 ) {
12			$menu_offset += $( '#wpadminbar' ).outerHeight();
13		}
14
15		//fix sidenav scroll to top
16		if ( $top_section ) {
17			$scroll_position = 0;
18		} else {
19			$scroll_position = $target.offset().top - $menu_offset;
20		}
21
22		// set swing (animate's scrollTop default) as default value
23		if( typeof easing === 'undefined' ){
24			easing = 'swing';
25		}
26
27		$( 'html, body' ).animate( { scrollTop :  $scroll_position }, speed, easing );
28	}
29
30	window.et_fix_video_wmode = function( video_wrapper ) {
31		$( video_wrapper ).each( function() {
32			if ( $(this).find( 'iframe' ).length ) {
33				var $this_el = $(this).find( 'iframe' ),
34					src_attr = $this_el.attr('src'),
35					wmode_character = src_attr.indexOf( '?' ) == -1 ? '?' : '&',
36					this_src = src_attr + wmode_character + 'wmode=opaque';
37
38				$this_el.attr('src', this_src);
39			}
40		} );
41	}
42
43	window.et_pb_form_placeholders_init = function( $form ) {
44		$form.find('input:text, input[type="email"], input[type="url"], textarea').each(function(index,domEle){
45			var $et_current_input = jQuery(domEle),
46				$et_comment_label = $et_current_input.siblings('label'),
47				et_comment_label_value = $et_current_input.siblings('label').text();
48			if ( $et_comment_label.length ) {
49				$et_comment_label.hide();
50				if ( $et_current_input.siblings('span.required') ) {
51					et_comment_label_value += $et_current_input.siblings('span.required').text();
52					$et_current_input.siblings('span.required').hide();
53				}
54				$et_current_input.val(et_comment_label_value);
55			}
56		}).bind('focus',function(){
57			var et_label_text = jQuery(this).siblings('label').text();
58			if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
59			if (jQuery(this).val() === et_label_text) jQuery(this).val("");
60		}).bind('blur',function(){
61			var et_label_text = jQuery(this).siblings('label').text();
62			if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text();
63			if (jQuery(this).val() === "") jQuery(this).val( et_label_text );
64		});
65	}
66
67	window.et_duplicate_menu = function( menu, append_to, menu_id, menu_class, menu_click_event ){
68		append_to.each( function() {
69			var $this_menu = $(this),
70				$cloned_nav;
71
72			// make this function work with existing menus, without cloning
73			if ( '' !== menu ) {
74				menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( $this_menu );
75			}
76
77			$cloned_nav = $this_menu.find('> ul');
78			$cloned_nav.find('.menu_slide').remove();
79			$cloned_nav.find('li:first').addClass('et_first_mobile_item');
80
81			$cloned_nav.find( 'a' ).on( 'click', function(){
82				$(this).parents( '.et_mobile_menu' ).siblings( '.mobile_menu_bar' ).trigger( 'click' );
83			} );
84
85			if ( 'no_click_event' !== menu_click_event ) {
86				$this_menu.on( 'click', '.mobile_menu_bar', function(){
87					if ( $this_menu.hasClass('closed') ){
88						$this_menu.removeClass( 'closed' ).addClass( 'opened' );
89						$cloned_nav.stop().slideDown( 500 );
90					} else {
91						$this_menu.removeClass( 'opened' ).addClass( 'closed' );
92						$cloned_nav.stop().slideUp( 500 );
93					}
94					return false;
95				} );
96			}
97		} );
98
99		$('#mobile_menu .centered-inline-logo-wrap').remove();
100	}
101
102	// remove placeholder text before form submission
103	window.et_pb_remove_placeholder_text = function( $form ) {
104		$form.find('input:text, textarea').each(function(index,domEle){
105			var $et_current_input = jQuery(domEle),
106				$et_label = $et_current_input.siblings('label'),
107				et_label_value = $et_current_input.siblings('label').text();
108
109			if ( $et_label.length && $et_label.is(':hidden') ) {
110				if ( $et_label.text() == $et_current_input.val() )
111					$et_current_input.val( '' );
112			}
113		});
114	}
115
116	window.et_fix_fullscreen_section = function() {
117		var $et_window = $(window);
118
119		$( 'section.et_pb_fullscreen' ).each( function(){
120			var $this_section = $( this );
121
122			$.proxy( et_calc_fullscreen_section, $this_section )();
123
124			$et_window.on( 'resize', $.proxy( et_calc_fullscreen_section, $this_section ) );
125		});
126	}
127
128	window.et_bar_counters_init = function( $bar_item ) {
129		if ( ! $bar_item.length ) {
130			return;
131		}
132
133		var $bar_container      = $bar_item.closest( '.et_pb_counter_container' ),
134			bar_item_width      = $bar_item.attr( 'data-width' ),
135			bar_item_padding    = Math.ceil( parseFloat( $bar_item.css('paddingLeft') ) ) + Math.
135ceil( parseFloat( $bar_item.css('paddingRight') ) ),
136			$bar_item_text      = $bar_item.children( '.et_pb_counter_amount_number' ),
137			calculated_width    = ( $bar_container.width() - $bar_item_text.innerWidth() ) / 100 * parseFloat( bar_item_width ),
138			bar_item_text_width = calculated_width + $bar_item_text.innerWidth();
139
140		$bar_item.css({
141			'width' : bar_item_text_width
142		});
143	}
144
145	window.et_fix_pricing_currency_position = function( $pricing_table ) {
146		var $all_pricing_tables = typeof $pricing_table !== 'undefined' ? $pricing_table : $( '.et_pb_pricing_table' );
147
148		if ( ! $all_pricing_tables.length ) {
149			return;
150		}
151
152		$all_pricing_tables.each( function() {
153			var $this_table = $( this ),
154				$price_container = $this_table.find( '.et_pb_et_price' ),
155				$currency = $price_container.length ? $price_container.find( '.et_pb_dollar_sign' ) : false,
156				$price = $price_container.length ? $price_container.find( '.et_pb_sum' ) : false;
157
158			if ( ! $currency || ! $price ) {
159				return;
160			}
161
162			// adjust the margin of currency sign to make sure it doesn't overflow the price
163			$currency.css( { 'marginLeft' : - $currency.width() + 'px' } );
164		});
165	}
166
167	window.et_pb_set_responsive_grid = function( $grid_items, $single_item_selector ) {
168		setTimeout( function() {
169			var container_width = $grid_items.innerWidth(),
170				item_width = $grid_items.find( $single_item_selector ).outerWidth( true ),
171				last_item_margin = item_width - $grid_items.find( $single_item_selector ).outerWidth(),
172				columns_count = Math.round( ( container_width + last_item_margin ) / item_width ),
173				counter = 1,
174				first_in_row = 1;
175
176			$grid_items.find( $single_item_selector ).removeClass( 'last_in_row first_in_row' );
177			$grid_items.find( $single_item_selector ).each( function() {
178				var $this_el = $( this );
179
180				if ( ! $this_el.hasClass( 'inactive' ) ) {
181					if ( first_in_row === counter ) {
182						$this_el.addClass( 'first_in_row' );
183					}
184
185					if ( 0 === counter % columns_count ) {
186						$this_el.addClass( 'last_in_row' );
187						first_in_row = counter + 1;
188					}
189					counter++;
190				}
191			});
192		}, 1 ); // need this timeout to make sure all the css applied before calculating sizes
193	};
194
195	window.et_pb_set_tabs_height = function( $tabs_module ) {
196		if ( typeof $tabs_module === 'undefined' ) {
197			$tabs_module = $( '.et_pb_tabs' );
198		}
199
200		if ( ! $tabs_module.length ) {
201			return;
202		}
203
204		$tabs_module.each( function() {
205			var $tab_controls = $( this ).find( '.et_pb_tabs_controls' );
206			var $all_tabs = $tab_controls.find( 'li' );
207			var max_height = 0;
208			var small_columns      = '.et_pb_column_1_3, .et_pb_column_1_4, .et_pb_column_3_8';
209			var in_small_column    = $( this ).parents( small_columns ).length > 0;
210			var on_small_screen    = parseFloat( $( window ).width() ) < 768;
211			var vertically_stacked = in_small_column || on_small_screen;
212
213			if ( vertically_stacked ) {
214				$( this ).addClass( 'et_pb_tabs_vertically_stacked' );
215			}
216
217			// determine the height of the tallest tab
218			if ( $all_tabs.length ) {
219				// remove the height attribute if it was added to calculate the height correctly
220				$tab_controls.removeAttr( 'style' );
221
222				$all_tabs.each( function() {
223					var tab_height = $( this ).outerHeight();
224
225					if ( vertically_stacked ) {
226						return;
227					}
228
229					if ( tab_height > max_height ) {
230						max_height = tab_height;
231					}
232				});
233			}
234
235			if ( 0 !== max_height ) {
236				// set the height of tabs container based on the height of the tallest tab
237				$tab_controls.css( 'min-height', max_height );
238			}
239		});
240	}
241})(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.