PageSourceSearch

https://www.onesoftball.com/wp-content/plugins/bloom/js/custom.js?ver=1.3.10

js onesoftball.com collected 2026-10-04 05:42:44 UTC 26,019 bytes, 653 lines download raw bytes

1(function($){
2	$(document).ready(function() {
3		var $locked_containers = [];
4
5		$( '.et_bloom_make_form_visible' ).removeAttr( 'style' );
6
7		$( '.et_bloom_custom_html_form input[type="radio"], .et_bloom_custom_html_form input[type="checkbox"]' ).uniform();
8
9		$( 'body' ).on( 'click', 'span.et_bloom_close_button', function(){
10			perform_popup_closing( $( this ).closest( '.et_bloom_optin' ) );
11
12			return false;
13		});
14
15		function toggle_checkbox(element, value) {
16			$(element).children('i').toggleClass('et_bloom_icon et_bloom_icon_check');
17		}
18
19		$('body .et_bloom_custom_field_checkbox input[type=checkbox]:checked').each(function() {
20			toggle_checkbox($(this).next('label'));
21		});
22
23		$('body').on('click', '.et_bloom_custom_field_checkbox label', function() {
24			toggle_checkbox(this);
25		});
26
27		function perform_popup_closing( $popup_container ) {
28			$popup_container.addClass( 'et_bloom_exit_animation' );
29
30			setTimeout( function() {
31				if ( $popup_container.hasClass( 'et_bloom_trigger_click' ) ) {
32					$popup_container.removeClass( 'et_bloom_visible et_bloom_animated et_bloom_exit_animation' );
33				} else {
34					$popup_container.remove();
35				}
36			}, 400 );
37
38			$( 'body' ).removeClass( 'et_bloom_popup_active' );
39
40		}
41
42		function update_stats_table( type, $this_button ) {
43			// do not update stats if visitor logged in
44			if ( 'logged' === bloomSettings.is_user_logged_in ) {
45				return;
46			}
47
48			var $optin_id = typeof $this_button.data( 'current_optin_id' ) !== 'undefined' ? $this_button.data( 'current_optin_id' ) : $this_button.data( 'optin_id' ),
49				$page_id = $this_button.data( 'page_id' ),
50				$list_id = $this_button.data( 'list_id' );
51
52			var cookie = 'et_bloom_optin_'.concat( $optin_id, '_', $list_id, '_', type );
53
54			if ( cookieExists( cookie ) ) {
55				return;
56			}
57
58			$stats_data = JSON.stringify({ 'type' : type, 'optin_id' : $optin_id, 'page_id' : $page_id, 'list_id' : $list_id });
59
60			$.ajax({
61				type: 'POST',
62				url: bloomSettings.ajaxurl,
63				data: {
64					action : 'bloom_handle_stats_adding',
65					stats_data_array : $stats_data,
66					update_stats_nonce : bloomSettings.stats_nonce
67				}
68			}).done( function() {
69				set_cookie( 365, cookie.concat( '=true' ) );
70			});
71		}
72
73		function setCookieExpire( days ) {
74			var ms = days*24*60*60*1000;
75
76			var date = new Date();
77			date.setTime( date.getTime() + ms );
78
79			return "; expires=" + date.toUTCString();
80		}
81
82		function checkCookieValue( cookieName, value ) {
83			return parseCookies()[cookieName] == value;
84		}
85
86		function cookieExists( cookie_name ) {
87			return 'undefined' !== typeof parseCookies()[cookie_name];
88		}
89
90		function parseCookies() {
91			var cookies = document.cookie.split( '; ' );
92
93			var ret = {};
94			for ( var i = cookies.length - 1; i >= 0; i-- ) {
95			  var el = cookies[i].split( '=' );
96			  ret[el[0]] = el[1];
97			}
98			return ret;
99		}
100
101		function set_cookie( $expire, $cookie_content ) {
102			var $cookie_content = '' == $cookie_content ? 'etBloomCookie=true' : $cookie_content;
103			cookieExpire = setCookieExpire( $expire );
104			document.cookie = $cookie_content + cookieExpire + "; path=/";
105		}
106
107		function get_url_parameter( param_name ) {
108			var page_url = window.location.search.substring(1);
109			var url_variables = page_url.split('&');
110			for ( var i = 0; i < url_variables.length; i++ ) {
111					var curr_param_name = url_variables[i].split( '=' );
112				if ( curr_param_name[0] == param_name ) {
113					return curr_param_name[1];
114				}
115			}
116		}
117
118		//separate function for the setTimeout to make it work properly within the loop.
119		function make_popup_visible( $popup, $delay, $cookie_exp, $cookie_content ){
120			if ( ! $popup.hasClass( 'et_bloom_visible' ) ) {
121				setTimeout( function() {
122					$popup.addClass( 'et_bloom_visible et_bloom_animated' );
123					$stats_data_container = 0 != $popup.find( '.et_bloom_custom_html_form' ).length ? $popup.find( '.et_bloom_custom_html_form' ) : $popup.find( '.et_bloom_submit_subscription' );
124					update_stats_table( 'imp', $stats_data_container );
125
126					if ( '' != $cookie_exp ) {
127						set_cookie( $cookie_exp, $cookie_content );
128					}
129
130					if ( $( '.et_bloom_resize' ).length ) {
131						$( '.et_bloom_resize.et_bloom_visible' ).each( function() {
132							define_popup_position( $( this ), true, 0 );
133						});
134					}
135
136					display_image( $popup );
137
138				}, $delay );
139			}
140		}
141
142		function display_image( $popup ) {
143			setTimeout( function() {
144				$popup.find( '.et_bloom_image' ).addClass( 'et_bloom_visible_image' );
145			}, 500 );
146		}
147
148		function auto_popup( $current_popup_auto, $delay ) {
149			var $data_holder = $current_popup_auto.find( '.et_bloom_custom_html_form' ).length ? $current_popup_auto.find( '.et_bloom_custom_html_form' ) : $current_popup_auto.find( '.et_bloom_submit_subscription' ),
150				page_id = $data_holder.data( 'page_id' ),
151				optin_id = $data_holder.data( 'optin_id' ),
152				list_id = $data_holder.data( 'list_id' );
153
154			if ( ! $current_popup_auto.hasClass( 'et_bloom_animated' ) ) {
155				var $cookies_expire_auto = $current_popup_auto.data( 'cookie_duration' ) ? $current_popup_auto.data( 'cookie_duration' ) : false,
156					$already_subscribed = checkCookieValue( 'et_bloom_subscribed_to_' + optin_id + list_id, 'true' );
157
158				if ( ( ( false !== $cookies_expire_auto && ! checkCookieValue( 'etBloomCookie_' + optin_id, 'true' ) ) || false == $cookies_expire_auto ) && ! $already_subscribed ) {
159					if ( false !== $cookies_expire_auto ) {
160						make_popup_visible ( $current_popup_auto, $delay, $cookies_expire_auto, 'etBloomCookie_' + optin_id + '=true' );
161					} else {
162						make_popup_visible ( $current_popup_auto, $delay, '', '' );
163					}
164				}
165			}
166		}
167
168		function scroll_trigger( $current_popup_bottom, is_bottom_trigger ) {
169			var triggered = 0,
170				$data_holder = $current_popup_bottom.find( '.et_bloom_custom_html_form' ).length ? $current_popup_bottom.find( '.et_bloom_custom_html_form' ) : $current_popup_bottom.find( '.et_bloom_submit_subscription' ),
171				page_id = $data_holder.data( 'page_id' ),
172				optin_id = $data_holder.data( 'optin_id' );
173				list_id = $data_holder.data( 'list_id' );
174
175			if ( ! $current_popup_bottom.hasClass( 'et_bloom_animated' ) ) {
176				var	cookies_expire_bottom = $current_popup_bottom.data( 'cookie_duration' ) ? $current_popup_bottom.data( 'cookie_duration' ) : false,
177					$already_subscribed = checkCookieValue( 'et_bloom_subscribed_to_' + optin_id + list_id, 'true' );
178
179				if ( true == is_bottom_trigger ) {
180					var scroll_trigger = $( '.et_bloom_bottom_trigger' ).length ? $( '.et_bloom_bottom_trigger' ).offset().top : $( document ).height() - 500;
181				} else {
182					var scroll_pos = $current_popup_bottom.data( 'scroll_pos' ) > 100 ? 100 : $current_popup_bottom.data( 'scroll_pos' ),
183						scroll_trigger = 100 == scroll_pos ? $( document ).height() - 50 : $( document ).height() * scroll_pos / 100;
184				}
185
186				$( window ).scroll( function(){
187					if ( ( ( false !== cookies_expire_bottom && ! checkCookieValue( 'etBloomCookie_' + optin_id, 'true' ) ) || false == cookies_expire_bottom ) && ! $already_subscribed ) {
188						if( $( window ).scrollTop() + $( window ).height() > scroll_trigger ) {
189							if ( 0 == triggered ) {
190								if ( false !== cookies_expire_bottom ) {
191									make_popup_visible ( $current_popup_bottom, 0, cookies_expire_bottom, 'etBloomCookie_' + optin_id + '=true' );
192								} else {
193									make_popup_visible ( $current_popup_bottom, 0, '', '' );
194								}
195
196								triggered++;
197							}
198						}
199					}
200				});
201			}
202		}
203
204		$.fn.isInViewport = function() {
205			var elementTop     = $( this ).offset().top;
206			var elementBottom  = elementTop + $( this ).outerHeight();
207			var viewportTop    = $( window ).scrollTop();
208			var viewportBottom = viewportTop + $( window ).height();
209
210			return elementBottom > viewportTop && elementTop < viewportBottom;
211		};
212
213		var $inline_optins = $( '.et_bloom_inline_form .et_bloom_submit_subscription, .et_bloom_widget_content .et_bloom_submit_subscription, .et_bloom_custom_html_form' );
214
215		if ( $inline_optins.length > 0 ) {
216			var imp_recorded_count = 0;
217
218			$(window).on( 'scroll.et_bloom_impressions', function() {
219				$inline_optins.each( function() {
220					if ( ! $(this).hasClass( 'et_bloom_impression_recorded' ) && $(this).isInViewport() ) {
221						$( this ).addClass( 'et_bloom_impression_recorded' );
222
223						imp_recorded_count++;
224
225						update_stats_table( 'imp', $(this) );
226					}
227				} );
228
229				if ( imp_recorded_count >= $inline_optins.length ) {
230					$(window).off( 'scroll.et_bloom_impressions' );
231				}
232			} );
233		}
234
235		 if( $( '.et_bloom_auto_popup' ).length ) {
236			$( '.et_bloom_auto_popup:not(.et_bloom_visible)' ).each( function() {
237				var this_el = $( this ),
238					delay = '' !== this_el.data( 'delay' ) ? this_el.data( 'delay' ) * 1000 : 0;
239				auto_popup( this_el, delay );
240			});
241		 }
242
243		if( $( '.et_bloom_trigger_bottom' ).length ) {
244
245			$( '.et_bloom_trigger_bottom:not(.et_bloom_visible)' ).each( function(){
246				scroll_trigger( $( this ), true );
247			});
248
249		}
250
251		if( $( '.et_bloom_scroll' ).length ) {
252
253			$( '.et_bloom_scroll:not(.et_bloom_visible)' ).each( function(){
254				scroll_trigger( $( this ), false );
255			});
256		}
257
258		if ( $( '.et_bloom_trigger_click' ).length ) {
259			$( '.et_bloom_trigger_click:not(.et_bloom_visible)' ).each( function() {
260				var $this_el = $( this ),
261					selector = $this_el.attr( 'data-trigger_click' );
262
263				if ( typeof selector !== 'undefined' ) {
264					$( 'body' ).on( 'click', selector, function() {
265						make_popup_visible ( $this_el, 0, '', '' );
266						return false;
267					});
268				}
269			});
270		}
271
272		if( $( '.et_bloom_trigger_idle' ).length ) {
273			$( '.et_bloom_trigger_idle:not(.et_bloom_visible)' ).each( function() {
274				var $this_el = $( this ),
275					$data_holder = $this_el.find( '.et_bloom_custom_html_form' ).length ? $this_el.find( '.et_bloom_custom_html_form' ) : $this_el.find( '.et_bloom_submit_subscription' ),
276					page_id = $data_holder.data( 'page_id' ),
277					optin_id = $data_holder.data( 'optin_id' ),
278					list_id = $data_holder.data( 'list_id' );
279
280				if ( ! $this_el.hasClass( 'et_bloom_animated' ) ) {
281					var $cookies_expire_idle = $this_el.data( 'cookie_duration' ) ? $this_el.data( 'cookie_duration' ) : false,
282						$already_subscribed = checkCookieValue( 'et_bloom_subscribed_to_' + optin_id + list_id, 'true' );
283						$idle_timeout = '' !== $this_el.data( 'idle_timeout' ) ? $this_el.data( 'idle_timeout' ) * 1000 : 30000,
284						$delay = 0;
285
286					if ( ( ( false !== $cookies_expire_idle && ! checkCookieValue( 'etBloomCookie_' + optin_id, 'true' ) ) || false == $cookies_expire_idle ) && ! $already_subscribed ) {
287						$( document ).idleTimer( $idle_timeout );
288
289						$( document ).on( 'idle.idleTimer', function() {
290							if ( false !== $cookies_expire_idle ) {
291								make_popup_visible ( $this_el, $delay, $cookies_expire_idle, 'etBloomCookie_' + optin_id + '=true' );
292							} else {
293								make_popup_visible ( $this_el, $delay, '', '' );
294							}
295						});
296					}
297				}
298			});
299		}
300
301		if ( 'true' == get_url_parameter( 'et_bloom_popup' ) ) {
302			$( '.et_bloom_after_comment' ).each( function() {
303				auto_popup( $( this ), 0 );
304			});
305		}
306
307		if ( $( '.et_bloom_after_order' ).length ) {
308			$( '.et_bloom_after_purchase' ).each( function() {
309				auto_popup( $( this ), 0 );
310			});
311		}
312
313		if( $( '.et_bloom_locked_container' ).length ) {
314			var $i = 0;
315
316			$( '.et_bloom_locked_container' ).each( function() {
317				var $this_el = $( this ),
318					content = $this_el.find( '.et_bloom_locked_content' ),
319					form = $this_el.find( '.et_bloom_locked_form' ),
320					page_id = $this_el.data( 'page_id' ),
321					optin_id = $this_el.data( 'optin_id' );
322
323				$this_el.data( 'container_id', $i );
324				$locked_containers.push( content );
325
326				if ( checkCookieValue( 'et_bloom_unlocked' + optin_id + page_id, 'true' ) ) {
327					content.css( {'display' : 'block'} );
328					form.remove();
329				} else {
330					content.remove();
331					update_stats_table( 'imp', $this_el );
332				}
333
334				$i++;
335			});
336		}
337
338		$( 'body' ).on( 'click', '.et_bloom_locked_container .et_bloom_submit_subscription', function(){
339			var $current_container = $( this ).closest( '.et_bloom_locked_container' ),
340				container_id = $current_container.data( 'container_id' ),
341				page_id = $current_container.data( 'page_id' ),
342				optin_id = typeof $current_container.data( 'current_optin_id' ) !== 'undefined' ? $current_container.data( 'current_optin_id' ) : $current_container.data( 'optin_id' );
343
344			perform_subscription( $( this ), $current_container, container_id, page_id, optin_id );
345
346			return false;
347		});
348
349		// unlock content immediately if custom HTML form is used.
350		$( 'body' ).on( 'click', '.et_bloom_locked_container .et_bloom_custom_html_form input[type="submit"], .et_bloom_locked_container .et_bloom_custom_html_form button[type="submit"]', function() {
351			var current_container = $( this ).closest( '.et_bloom_locked_container' ),
352				container_id = current_container.data( 'container_id' ),
353				page_id = current_container.data( 'page_id' ),
354				optin_id = current_container.data( 'optin_id' );
355
356			unlock_content( current_container, container_id, page_id, optin_id );
357		} );
358
359		function unlock_content( current_container, container_id, locked_page_id, locked_optin_id ) {
360			set_cookie( 365, 'et_bloom_unlocked' + locked_optin_id + locked_page_id + '=true' );
361			current_container.find( '.et_bloom_locked_form' ).replaceWith( $locked_containers[container_id] );
362			current_container.find( '.et_bloom_locked_content' ).css( { 'display' : 'block' } );
363		}
364
365		// Move inline forms into appropriate sections in Divi theme
366		if( $( '.et_bloom_below_post' ).length ) {
367			if ( $( 'body' ).hasClass( 'et_pb_pagebuilder_layout' ) ) {
368				var bottom_inline = $( '.et_bloom_below_post' ),
369					divi_container = '<div class="et_pb_row"><div class="et_pb_column et_pb_column_4_4"></div></div>';
370
371				if ( bottom_inline.length ) {
372					$( '.et_pb_section' ).not( '.et_pb_fullwidth_section' ).last().append( divi_container ).find( '.et_pb_row' ).last().find( '.et_pb_column' ).append( bottom_inline );
373				}
374			}
375		}
376
377		function define_popup_position( $this_popup, $just_loaded, $message_space ) {
378			var this_popup = $this_popup.find( '.et_bloom_form_container' ),
379				popup_max_height = this_popup.hasClass( 'et_bloom_popup_container' ) ? $( window ).height() - 40 : $( window ).height() - 20,
380				real_popup_height = 0,
381				percentage = this_popup.parent().hasClass( 'et_bloom_flyin' ) ? 0.03 : 0.05,
382				percentage = this_popup.hasClass( 'et_bloom_with_border' ) ? percentage + 0.03 : percentage,
383				breakout_offset = this_popup.hasClass( 'breakout_edge' ) ? 0.95 
383: 1,
384				dashed_offset = this_popup.hasClass( 'et_bloom_border_dashed' ) ? 4 : 0,
385				form_height = this_popup.find( 'form' ).innerHeight() + $message_space,
386				form_add = true == $just_loaded ? 5 : 0;
387
388			this_popup.css( { 'max-height' : popup_max_height } );
389
390			if ( this_popup.hasClass( 'et_bloom_popup_container' ) ) {
391				var top_position = $( window ).height() / 2 - this_popup.innerHeight() / 2;
392				this_popup.css( { 'top' : top_position + 'px' } );
393			}
394
395			this_popup.find( '.et_bloom_form_container_wrapper' ).css( { 'max-height' : popup_max_height - 20 } );
396
397
398			if ( ( 768 > $( 'body' ).outerWidth() + 15 ) || this_popup.hasClass( 'et_bloom_form_bottom' ) ) {
399				if ( this_popup.hasClass( 'et_bloom_form_right' ) || this_popup.hasClass( 'et_bloom_form_left' ) ) {
400					this_popup.find( '.et_bloom_form_header' ).css( { 'height' : 'auto' } );
401				}
402
403				real_popup_height = this_popup.find( '.et_bloom_form_container_wrapper' ).height() + 30 + form_add;
404
405				if ( this_popup.hasClass( 'et_bloom_form_right' ) || this_popup.hasClass( 'et_bloom_form_left' ) ) {
406					this_popup.find( '.et_bloom_form_container_wrapper' ).css( { 'height' : real_popup_height - 30 + dashed_offset } );
407				}
408			} else {
409				real_popup_height = this_popup.find( '.et_bloom_form_container_wrapper' ).height() + $message_space;
410
411				/**
412				 * Sometimes real_popup_height return 0 because the page is no loaded fully. This
413				 * is added to set the Bloom container height as 100% to avoid 0 height. Note, the
414				 * height will be set as 100% only when the real_popup_height is 0.
415				 */
416				var container_height = real_popup_height;
417				if (parseInt(real_popup_height) === 0) {
418					container_height = '100%';
419				}
420
421				if ( this_popup.hasClass( 'et_bloom_form_right' ) || this_popup.hasClass( 'et_bloom_form_left' ) ) {
422					this_popup.find( '.et_bloom_form_header' ).css( { 'height' : real_popup_height * breakout_offset - dashed_offset } );
423					this_popup.find( '.et_bloom_form_content' ).css( { 'min-height' : real_popup_height - dashed_offset } );
424					this_popup.find( '.et_bloom_form_container_wrapper' ).css( { 'height' : container_height } );
425				}
426			}
427
428			if ( real_popup_height > popup_max_height ) {
429				this_popup.find( '.et_bloom_form_container_wrapper' ).addClass( 'et_bloom_vertical_scroll' );
430			} else {
431				this_popup.find( '.et_bloom_form_container_wrapper' ).removeClass( 'et_bloom_vertical_scroll' );
432			}
433
434			if ( $this_popup.hasClass( 'et_bloom_popup' ) ) {
435				$( 'body' ).addClass( 'et_bloom_popup_active' );
436			}
437		}
438
439		$( 'body' ).on( 'click', '.et_bloom_submit_subscription:not(.et_bloom_submit_subscription_locked)', function() {
440			perform_subscription( $( this ), '', '', '', '' );
441			return false;
442		});
443
444		function perform_subscription(this_button, current_container, container_id, locked_page_id, locked_optin_id) {
445			var this_form = this_button.parents('form');
446			var list_id = this_button.data('list_id');
447			var account_name = this_button.data('account');
448			var service = this_button.data('service');
449			var name = this_form.find('.et_bloom_subscribe_name input').val();
450			var last_name = undefined !== this_form.find('.et_bloom_subscribe_last input').val() ? this_form.find('.et_bloom_subscribe_last input').val() : '';
451			var email = this_form.find('.et_bloom_subscribe_email input').val();
452			var page_id = this_button.data('page_id');
453			var optin_id = this_button.data('optin_id');
454			var $popup_container = this_form.closest('.et_bloom_optin');
455			var is_popup = $popup_container.hasClass('et_bloom_popup') || $popup_container.hasClass('et_bloom_flyin');
456			var $success_action_el = this_button.closest('.et_bloom_success_action');
457			var success_action_details = $success_action_el.length > 0 ? $success_action_el.parent().data('success_action_details').split('|') : [];
458			var success_action = 2 === success_action_details.length ? success_action_details[0] : '';
459			var success_action_url = '' !== success_action ? success_action_details[1] : '';
460
461			var ip_address        = this_button.data('ip_address');
462			var $fields_container = this_form.find('.et_bloom_fields');
463			var $custom_fields    = $fields_container.find('.et_bloom_custom_field input[type=text], .et_bloom_checkbox_handle, [data-field_type="radio"], textarea, select');
464			var custom_fields     = {};
465			var is_valid          = true;
466
467			// Email Validation
468			// Use the regex defined in the HTML5 spec for input[type=email] validation
469			// (see https://www.w3.org/TR/2016/REC-html51-20161101/sec-forms.html#email-state-typeemail)
470			var et_email_reg_html5 = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
471
472			this_form.find('.et_bloom_warn_field').removeClass('et_bloom_warn_field');
473
474			if (this_form.length > 0 && typeof this_form[0].reportValidity === 'function') {
475				// Checks HTML5 validation constraints
476				is_valid = this_form[0].reportValidity();
477			}
478
479			$custom_fields.each( function() {
480				var $this_el      = $(this);
481				var $this_wrapper = false;
482				var this_id       = $this_el.attr('data-id');
483				var field_type    = typeof $this_el.data( 'field_type' ) !== 'undefined' ? $this_el.data( 'field_type' ) : 'text';
484
485				if ('checkbox' === field_type || 'radio' === field_type) {
486					$this_wrapper = $this_el.closest('.et_bloom_custom_field');
487				}
488
489				var this_val      = $this_el.val();
490				var required_mark = typeof $this_el.data('required_mark') !== 'undefined' ? $this_el.data('required_mark') : 'not_required';
491				var original_id   = typeof $this_el.data('original_id') !== 'undefined' ? $this_el.data('original_id') : '';
492				var unchecked     = false;
493				var default_value;
494
495				// radio field properties adjustment
496				if ('radio' === field_type) {
497					if (0 !== $this_wrapper.find('input[type="radio"]').length) {
498						var $firstRadio = $this_wrapper.find('input[type="radio"]:first');
499
500						required_mark = typeof $firstRadio.data('required_mark') !== 'undefined' ? $firstRadio.data('required_mark') : 'not_required';
501
502						this_val = '';
503
504						if ($this_wrapper.find('input[type="radio"]:checked')) {
505							this_val = $this_wrapper.find('input[type="radio"]:checked').val();
506						}
507					}
508
509					if (!$.isEmptyObject(this_val)) {
510						custom_fields[this_id] = this_val;
511					}
512
513					if (0 === $this_wrapper.find('input[type="radio"]:checked').length) {
514						unchecked = true;
515					}
516
517					if (this_val) {
518						custom_fields[this_id] = this_val;
519					}
520				} else if ('checkbox' === field_type) {
521					this_val = {};
522
523					if ( 0 !== $this_wrapper.find('input[type="checkbox"]').length) {
524						var $checkboxHandle = $this_wrapper.find('.et_bloom_checkbox_handle');
525
526						required_mark = typeof $checkboxHandle.data('required_mark') !== 'undefined' ? $checkboxHandle.data('required_mark') : 'not_required';
527
528						if ($this_wrapper.find('input[type="checkbox"]:checked').length > 0) {
529							$this_wrapper.find('input[type="checkbox"]:checked').each(function() {
530								var field_id       = $(this).data('id');
531								this_val[field_id] = $(this).val();
532							} );
533						}
534					}
535
536					if (!$.isEmptyObject(this_val)) {
537						custom_fields[this_id] = this_val;
538					}
539
540					if (0 === $this_wrapper.find('input[type="checkbox"]:checked').length) {
541						unchecked = true;
542					}
543				} else if ('ontraport' === service && 'select' === field_type) {
544					// Need to pass option ID as a value for dropdown menu in Ontraport
545					var $selected_option   = $this_el.find(':selected');
546					custom_fields[this_id] = $selected_option.length > 0 ? $selected_option.data('id') : this_val;
547				} else {
548					custom_fields[this_id] = this_val;
549				}
550
551				// add error message for the field if it is required and empty
552				if ('required' === required_mark && ('' === this_val || true === unchecked)) {
553					if (false === $this_wrapper) {
554						$this_el.addClass('et_bloom_warn_field');
555					} else {
556						$this_wrapper.addClass('et_bloom_warn_field');
557					}
558
559					is_valid = false;
560				}
561
562				if ('email' === field_type) {
563					// remove trailing/leading spaces and convert email to lowercase
564					var processed_email = this_val.trim().toLowerCase();
565					var is_valid_email = et_email_reg_html5.test(processed_email);
566
567					if ('' !== processed_email && !is_valid_email) {
568						$this_el.addClass('et_bloom_warn_field');
569						is_valid = false;
570					}
571				}
572			} );
573
574			if (! is_valid) {
575				return;
576			}
577
578			if ('' == email) {
579				this_form.find('.et_bloom_subscribe_email input').addClass('et_bloom_warn_field');
580			} else {
581				ip_address = ip_address ? 'true' : 'false';
582				$subscribe_data = JSON.stringify({ 'list_id' : list_id, 'account_name' : account_name, 'service' : service, 'name' : name, 'email' : email, 'page_id' : page_id, 'optin_id' : optin_id, 'last_name' : last_name, 'ip_address': ip_address });
583				$.ajax({
584					type: 'POST',
585					dataType: 'json',
586					url: bloomSettings.ajaxurl,
587					data: {
588						action : 'bloom_subscribe',
589						subscribe_data_array : $subscribe_data,
590						custom_fields: custom_fields,
591						subscribe_nonce : bloomSettings.subscribe_nonce
592					},
593					beforeSend: function(data) {
594						this_button.addClass('et_bloom_button_text_loading');
595						this_button.find('.et_bloom_subscribe_loader').css({ 'display' : 'block' });
596					},
597					success: function(data) {
598						this_button.removeClass('et_bloom_button_text_loading');
599						this_button.find('.et_bloom_subscribe_loader').css({ 'display' : 'none' });
600						if (data) {
601							if ('' !== current_container && (data.success || 'Invalid email' !== data.error)) {
602								unlock_content(current_container, container_id, locked_page_id, locked_optin_id);
603							} else {
604								if (data.error) {
605									this_form.find('.et_bloom_error_message').remove();
606									this_form.prepend('<h2 class="et_bloom_error_message">' + data.error + '</h2>');
607									this_form.parent().parent().find('.et_bloom_form_header').addClass('et_bloom_with_error');
608								}
609								if (data.success && '' == current_container) {
610									set_cookie(365, 'et_bloom_subscribed_to_' + optin_id + list_id + '=true');
611
612									if ('' === success_action || '' === success_action_url) {
613									  this_form.parent().find('.et_bloom_success_message').addClass('et_bloom_animate_message');
614									  this_form.parent().find('.et_bloom_success_container').addClass('et_bloom_animate_success');
615									  this_form.remove();
616									} else {
617										window.location = success_action_url;
618									}
619
620									// auto close popup if enabled
621									if (is_popup && $popup_container.hasClass('et_bloom_auto_close')) {
622										setTimeout(function() {
623											perform_popup_closing($popup_container);
624										},1400);
625									}
626								}
627							}
628
629							if (is_popup) {
630								define_popup_position($popup_container, false, 50);
631							}
632						}
633					}
634				});
635			}
636		}
637
638		$( 'body' ).on( 'click', '.et_bloom_custom_html_form input[type="submit"], .et_bloom_custom_html_form button[type="submit"]', function() {
639			var this_button = $( this ),
640				form_container = this_button.closest( '.et_bloom_custom_html_form' );
641
642			update_stats_table( 'con', form_container );
643		} );
644
645		$( window ).resize( function(){
646			if ( $( '.et_bloom_resize' ).length ) {
647				$( '.et_bloom_resize' ).each( function() {
648					define_popup_position( $( this ), false, 0 );
649				});
650			}
651		});
652	});
653})(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.