PageSourceSearch

https://warsawinstitute.org/wp-content/themes/Divi/includes/builde…tend-builder-global-functions.js?ver=4.8.25

js warsawinstitute.org collected 2026-10-02 03:02:23 UTC 8,378 bytes, 243 lines download raw bytes

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