PageSourceSearch

https://forumeco.fr/wp-content/plugins/pb-add-on-multi-step-forms/assets/js/frontend-multi-step-forms.js

js forumeco.fr collected 2026-10-10 00:31:18 UTC 35,141 bytes, 605 lines download raw bytes

1jQuery( document ).ready( function() {
2    var forms = jQuery( "form.wppb-user-forms" );
3
4    jQuery.each(forms, function( index, element ) {
5        element = jQuery(element);
6        var steps = jQuery( element ).find( "ul li.wppb-msf-step" );
7        var count = steps.length;
8
9        if( count > 1 ) {
10            var form_id = element.attr( 'id' );
11
12            jQuery( '#' + form_id ).on( 'keyup keypress', 'input:not([type="submit"]):not([type="button"])', function( e ) {
13                var keyCode = e.keyCode || e.which;
14                if( keyCode === 13 ) {
15                    e.preventDefault();
16                }
17            } );
18
19            steps.each( function( i ) {
20                jQuery( this ).attr( 'id', 'wppb-msf-step-' + i ).attr( 'data-msf-step', i );
21                jQuery( this ).wrapInner( "<fieldset>" );
22            } );
23
24            if( jQuery( element['selector'] + ' .wppb-field-error' ).length ) {
25                jQuery( element['selector'] + ' .wppb-field-error' ).each( function() {
26                    var error_step = jQuery( this ).closest( 'li.wppb-msf-step' ).attr( 'data-msf-step' );
27
28                    jQuery( '#wppb-msf-tabs-' + error_step ).addClass( 'wppb-msf-commands-error' );
29                    jQuery( '#wppb-msf-pagination-' + error_step ).addClass( 'wppb-msf-commands-error' );
30                } );
31
32                if( element.hasClass( 'wppb-register-user' ) ) {
33                    var pass_error_step = jQuery( element['selector'] + ' .wppb-default-password' ).closest( 'li.wppb-msf-step' ).attr( 'data-msf-step' );
34                    jQuery( '#wppb-msf-tabs-' + pass_error_step ).addClass( 'wppb-msf-commands-error' );
35                    jQuery( '#wppb-msf-pagination-' + pass_error_step ).addClass( 'wppb-msf-commands-error' );
36
37                    if( jQuery( element['selector'] + ' .wppb-default-repeat-password' ).length ) {
38                        var pass_repeat_error_step = jQuery( element['selector'] + ' .wppb-default-repeat-password' ).closest( 'li.wppb-msf-step' ).attr( 'data-msf-step' );
39                        jQuery( '#wppb-msf-tabs-' + pass_repeat_error_step, element ).addClass( 'wppb-msf-commands-error' );
40                        jQuery( '#wppb-msf-pagination-' + pass_repeat_error_step, element ).addClass( 'wppb-msf-commands-error' );
41                    }
42                }
43
44                jQuery( '.wppb-send-credentials-checkbox', element ).closest( 'ul' ).show();
45                jQuery( '.form-submit', element ).show();
46                jQuery( '.wppb-msf-tabs', element ).prop( 'disabled', false ).attr( 'data-msf-disabled-check', 'no' );
47                jQuery( '.wppb-msf-pagination', element ).prop( 'disabled', false ).attr( 'data-msf-disabled-check', 'no' );
48
49                if( ! jQuery( jQuery( '.wppb-field-error', element )[0] ).is( ':visible' ) ) {
50                    jQuery( '#wppb-msf-step-0', element ).hide();
51                    jQuery( jQuery( '.wppb-field-error', element )[0] ).
51closest( 'li.wppb-msf-step' ).show();
52                    var step_number = jQuery( jQuery( '.wppb-field-error', element )[0] ).closest( 'li.wppb-msf-step' ).attr( 'data-msf-step' );
53
54                    jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).removeClass( 'wppb-msf-active' );
55                    jQuery( '#wppb-msf-pagination', element ).find( '#wppb-msf-pagination-' + step_number ).addClass( 'wppb-msf-active' );
56
57                    jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).removeClass( 'wppb-msf-active' );
58                    jQuery( '#wppb-msf-tabs', element ).find( '#wppb-msf-tabs-' + step_number ).addClass( 'wppb-msf-active' );
59
60                    if( parseInt( step_number ) + 1 == count ) {
61                        jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
62                    }
63
64                    jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
65
66                    wppb_msf_commands( step_number, count, element, form_id );
67                } else {
68                    wppb_msf_commands( 0, count, element, form_id );
69                }
70            } else {
71                wppb_msf_commands( 0, count, element, form_id );
72            }
73
74            wppb_msf_tempRequired( element );
75        }
76    } );
77} );
78
79function wppb_msf_commands( i, count, element, form_id ) {
80    var form_type;
81    /* make sure this is an integer */
82    i = parseInt(i);
83
84    if( element.hasClass( 'wppb-register-user' ) ) {
85        form_type = 'register';
86    } else if( element.hasClass( 'wppb-edit-user' ) ) {
87        form_type = 'edit_profile';
88    }
89
90    jQuery( ".wppb-msf-prev", element ).on( "click", function( e ) {
91        e.preventDefault();
92
93        jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
94        jQuery( '.wppb-msf-prev', element ).prop( 'disabled', true );
95        jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).prop( 'disabled', true );
96        jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).prop( 'disabled', true );
97
98        var stepName = "wppb-msf-step-" + i;
99
100        jQuery( '#' + form_id ).find( '.wppb-msf-spinner-container' )
101            .css( 'height', jQuery( '#' + stepName ).outerHeight() + 'px' )
102            .css( 'line-height', jQuery( '#' + stepName ).outerHeight() + 'px' );
103
104        jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
105            jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeIn( 'fast', function() {
106                if( i - 1 == 0 ) {
107                    jQuery( '.wppb-msf-prev', element ).prop( 'disabled', true );
108                }
109                jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeOut( 'fast', function() {
110                    if( i < count ) {
111                        jQuery( '.wppb-msf-next', element ).prop( 'disabled', false );
112                    }
113
114                    i--;
115
116                    if( i != 0 ) {
117                        jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
118                    }
119
120                    jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).each( function() {
121                        if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
122                            jQuery( this ).prop( 'disabled', false );
123                        }
124                    } );
125
126                    jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).each( function() {
127                        if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
128                            jQuery( this ).prop( 'disabled', false );
129                        }
130                    } );
131
132                    jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).removeClass( 'wppb-msf-active' );
133                    jQuery( '#wppb-msf-pagination', element ).find( '#wppb-msf-pagination-' + i ).addClass( 'wppb-msf-active' );
134
135                    jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).removeClass( 'wppb-msf-active' );
136                    jQuery( '#wppb-msf-tabs', element ).find( '#wppb-msf-tabs-' + i ).addClass( 'wppb-msf-active' );
137
138                    jQuery( "#wppb-msf-step-" + i, element ).fadeIn( 'fast', function() {
139                        if( typeof wppb_resize_maps !== 'undefined' ) {
140                            wppb_resize_maps();
141                        }
142                    } );
143
144                    wppb_msf_tempRequired( element );
145                } );
146            } );
147        } );
148    } );
149
150
151    jQuery( ".wppb-msf-next", element ).on( "click", function( e ) {
152        e.preventDefault();
153
154        jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
155        jQuery( '.wppb-msf-prev', element ).prop( 'disabled', true );
156        jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).prop( 'disabled', true );
157        jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).prop( 'disabled', true );
158
159        var stepName = "wppb-msf-step-" + i;
160
161        jQuery( '#' + form_id ).find( '.wppb-msf-spinner-container' )
162            .css( 'height', jQuery( '#' + stepName ).outerHeight() + 'px' )
163            .css( 'line-height', jQuery( '#' + stepName ).outerHeight() + 'px' );
164
165        var fields = {};
166        var request_data = {};
167
168        jQuery( '.wppb-msf-step fieldset li.wppb-form-field', element ).each( function( e ) {
169            if( jQuery( this ).attr( 'class' ).indexOf( 'heading' ) == -1 && jQuery( this ).attr( 'class' ).indexOf( 'wppb_billing' ) == -1
170                && jQuery( this ).attr( 'class' ).indexOf( 'wppb_shipping' ) == -1 && jQuery( this ).attr( 'class' ).indexOf( 'wppb-shipping' ) == -1 ) {
171
172                if( jQuery( this ).hasClass( 'wppb-repeater' ) || jQuery( this ).parent().attr( 'data-wppb-rpf-set' ) == 'template' || jQuery( this ).hasClass( 'wppb-recaptcha' ) ) {
173                    return true;
174                }
175
176                /* exclude conditional required fields */
177                if( jQuery( this ).find('[conditional-value]').length !== 0 ) {
178                    return true;
179                }
180
181                if( ! jQuery( this ).hasClass( 'wppb-wysiwyg' ) && ! jQuery( this ).hasClass( 'wppb-checkbox' ) && ! jQuery( this ).hasClass( 'wppb-checkbox-terms-and-conditions' ) && ! jQuery( this ).hasClass( 'wppb-radio' )
182                    && ! jQuery( this ).hasClass( 'wppb-map' ) && ! jQuery( this ).hasClass( 'wppb-woocommerce-customer-billing-address' ) && ! jQuery( this ).hasClass( 'wppb-woocommerce-customer-shipping-address' ) ) {
183
184                    if( jQuery( this ).find( 'input' ).val() && jQuery( this ).find( 'input' ).val().length != 0 ) {
185                        request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input' ).val();
186                    }
187                }
188                if( jQuery( this ).hasClass( 'wppb-map' ) && jQuery( this ).find( 'input.wppb-map-marker' ).length != 0 ) {
189                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input.wppb-map-marker' ).map( function() { return this.value } ).get();
190                }
191                if( ( jQuery( this ).hasClass( 'wppb-default-biographical-info' ) || jQuery( this ).hasClass( 'wppb-textarea' ) ) && jQuery( this ).find( 'textarea' ).val() && jQuery( this ).find( 'textarea' ).val().length != 0 ) {
192                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'textarea' ).val();
193                }
194                if( jQuery( this ).hasClass( 'wppb-wysiwyg' ) ) {
195                    if ( jQuery('#wp-' + jQuery( this ).find( 'label' ).attr( 'for' ) + '-wrap').hasClass('tmce-active') && tinyMCE.get( jQuery( this ).find( 'label' ).attr( 'for' ) ) ) {
196                        if( tinyMCE.get( jQuery( this ).find( 'label' ).attr( 'for' ) ).getContent().length != 0 ) {
197                            request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = tinyMCE.get( jQuery( this ).find( 'label' ).attr( 'for' ) ).getContent();
198                        }
199                    }
200                }
201                if( ( jQuery( this ).is( '[class*="wppb-select"]' ) || jQuery( this ).hasClass( 'wppb-select-user-role' ) || jQuery( this ).hasClass( 'wppb-default-display-name-publicly-as' ) ) && jQuery( this ).find( 'option:selected' ).length != 0 ) {
202                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'option:selected' ).map( function() { return this.value } ).get().join( ',' );
203                }
204                if( ( jQuery( this ).hasClass( 'wppb-select-multiple' ) || jQuery( this ).hasClass( 'wppb-select2-multiple' ) ) && jQuery( this ).find( 'option:selected' ).length != 0 ) {
205                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'option:selected' ).map( function() { return this.value } ).get();
206                }
207                if( jQuery( this ).hasClass( 'wppb-checkbox' ) && jQuery( this ).find( 'input:checked' ).length != 0 ) {
208                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input:checked' ).map( function() { return this.value } ).get();
209                }
210                if( jQuery( this ).hasClass( 'wppb-checkbox-terms-and-conditions' ) && jQuery( this ).find( 'input:checked' ).length != 0 ) {
211                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input:checked' ).map( function() { return this.value } ).get().join( ',' );
212                }
213                if( jQuery( this ).hasClass( 'wppb-radio' ) ) {
214                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input:checked' ).val();
215                }
216                if( jQuery( this ).hasClass( 'wppb-timepicker' ) && jQuery( this ).find( 'option:selected' ).length != 0 ) {
217                    var timepicker_values = {};
218                    var timepicker_meta_name = jQuery( this ).find( 'label' ).attr( 'for' );
219                    timepicker_meta_name = timepicker_meta_name.replace( '-hour', '' );
220                    timepicker_values['hours'] = jQuery( this ).find( '#' + timepicker_meta_name + '-hour option:selected' ).val();
221                    timepicker_values['minutes'] = jQuery( this ).find( '#' + timepicker_meta_name + '-minutes option:selected' ).val();
222                    request_data[timepicker_meta_name] = timepicker_values;
223                }
224                if ( ( jQuery( this ).hasClass( 'wppb-upload') || jQuery( this ).hasClass( 'wppb-avatar') ) && jQuery( this ).find( 'input' ) && jQuery( this ).find( 'input' ).length >= 3 ){
225                    if (! ( jQuery( this ).find( 'label' ).attr( 'for' ) in request_data ) ){
226                        name = jQuery( this ).find( 'label' ).attr( 'for' );
227                        jQuery( this ).find( 'input' ).each( function ( i ) {
228                           if ( jQuery( this ).attr( 'id' ) == name.split('-').join('_') ){
229                               request_data[ name ] = jQuery( '#' + jQuery( this ).attr( 'id' ) )[ 0 ][ 'value' ];
230                           }
231                        });
232                    }
233                }
234                if( ! ( jQuery( this ).find( 'label' ).attr( 'for' ) in request_data )&& ! jQuery( this ).hasClass( 'wppb-timepicker' ) && ! jQuery( this ).hasClass( 'wppb-checkbox' )
235                    && ! jQuery( this ).hasClass( 'wppb-woocommerce-customer-billing-address' ) && ! jQuery( this ).hasClass( 'wppb-woocommerce-customer-shipping-address' ) ) {
236
237                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = '';
238                }
239
240                if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-billing-address' ) ) {
241                    jQuery( 'ul.wppb-woo-billing-fields li.wppb-form-field', element ).each( function() {
242                        if( ! jQuery( this ).hasClass( 'wppb_billing_heading' ) ) {
243                            if( ! jQuery( this ).hasClass( 'wppb_billing_country' ) ) {
244                                if( jQuery( this ).find( 'input' ).val() && jQuery( this ).find( 'input' ).val().length != 0 ) {
245                                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input' ).val();
246                                } else {
247                                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = '';
248                                }
249                            }
250
251                            if( ( jQuery( this ).hasClass( 'wppb_billing_state' ) || jQuery( this ).hasClass( 'wppb_billing_country' ) ) && jQuery( this ).find( 'option:selected' ).length != 0 ) {
252                                request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'option:selected' ).map( function() { return this.value } ).get().join( ',' );
253                            }
254                        }
255                    } );
256                }
257
258                if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-shipping-address' ) ) {
259                    jQuery( 'ul.wppb-woo-shipping-fields li.wppb-form-field', element ).each( function() {
260                        if( ! jQuery( this ).hasClass( 'wppb_shipping_heading' ) ) {
261                            if( ! jQuery( this ).hasClass( 'wppb_shipping_country' ) ) {
262                                if( jQuery( this ).find( 'input' ).val() && jQuery( this ).find( 'input' ).val().length != 0 ) {
263                                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'input' ).val();
264                                } else {
265                                    request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = '';
266                                }
267                            }
268
269                            if( ( jQuery( this ).hasClass( 'wppb_shipping_state' ) || jQuery( this ).hasClass( 'wppb_shipping_country' ) ) && jQuery( this ).find( 'option:selected' ).length != 0 ) {
270                                request_data[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'option:selected' ).map( function() { return this.value } ).get().join( ',' );
271                            }
272                        }
273                    } );
274                }
275            }
276        } );
277
278        jQuery( '#' + stepName + ' fieldset li.wppb-form-field', element ).each( function() {
279            if( jQuery( this ).attr( 'class' ).indexOf( 'heading' ) == -1 && jQuery( this ).attr( 'class' ).indexOf( 'wppb_billing' ) == -1
280                && jQuery( this ).attr( 'class' ).indexOf( 'wppb_shipping' ) == -1 && jQuery( this ).attr( 'class' ).indexOf( 'wppb-shipping' ) == -1 ) {
281
282                var meta_name;
283
284                if( jQuery( this ).hasClass( 'wppb-repeater' ) || jQuery( this ).parent().attr( 'data-wppb-rpf-set' ) == 'template' || jQuery( this ).hasClass( 'wppb-recaptcha' ) ) {
285                    return true;
286                }
287
288                /* exclude conditional required fields */
289                if( jQuery( this ).find('[conditional-value]').length !== 0 ) {
290                    return true;
291                }
292
293                fields[jQuery( this ).attr( 'id' )] = {};
294                fields[jQuery( this ).attr( 'id' )]['class'] = jQuery( this ).attr( 'class' );
295
296                if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-billing-address' ) ) {
297                    meta_name = 'woocommerce-customer-billing-address';
298                } else if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-shipping-address' ) ) {
299                    meta_name = 'woocommerce-customer-shipping-address';
300
301                    if( ! jQuery( '#' + form_id + ' .wppb-woocommerce-customer-billing-address #woo_different_shipping_address' ).is( ':checked' ) ) {
302                        return true;
303                    }
304                } else {
305                    meta_name = jQuery( this ).find( 'label' ).attr( 'for' );
306
307                    //fields[jQuery( this ).attr( 'id' )]['required'] = jQuery( this ).find( 'label' ).find( 'span' ).attr( 'class' );
308                    fields[jQuery( this ).attr( 'id' )]['title'] = jQuery( this ).find( 'label' ).first().text().trim();
309                }
310
311                fields[jQuery( this ).attr( 'id' )]['meta-name'] = meta_name;
312
313                if( jQuery( this ).parent().parent().attr( 'data-wppb-rpf-meta-name' ) ) {
314                    var repeater_group = jQuery( this ).parent().parent();
315
316                    fields[jQuery( this ).attr( 'id' )]['extra_groups_count'] = jQuery( repeater_group ).find( '#' + jQuery( repeater_group ).attr( 'data-wppb-rpf-meta-name' ) + '_extra_groups_count' ).val();
317                }
318
319                if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-billing-address' ) ) {
320                    var woo_billing_fields_fields = {};
321
322                    jQuery( 'ul.wppb-woo-billing-fields li.wppb-form-field', element ).each( function() {
323                        if( ! jQuery( this ).hasClass( 'wppb_billing_heading' ) ) {
324                            woo_billing_fields_fields[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'label' ).text();
325                        }
326                    } );
327
328                    fields[jQuery( this ).attr( 'id' )]['fields'] = woo_billing_fields_fields;
329                }
330
331                if( jQuery( this ).hasClass( 'wppb-woocommerce-customer-shipping-address' ) ) {
332                    var woo_shipping_fields_fields = {};
333
334                    jQuery( 'ul.wppb-woo-shipping-fields li.wppb-form-field', element ).each( function() {
335                        if( ! jQuery( this ).hasClass( 'wppb_shipping_heading' ) ) {
336                            woo_shipping_fields_fields[jQuery( this ).find( 'label' ).attr( 'for' )] = jQuery( this ).find( 'label' ).text();
337                        }
338                    } );
339
340                    fields[jQuery( this ).attr( 'id' )]['fields'] = woo_shipping_fields_fields;
341                }
342            }
343        } );
344
345        var data = {
346            'action'				: 'wppb_msf_check_required_fields',
347            'wppb_msf_ajax_nonce'   : wppb_msf_data_frontend.ajaxNonce,
348            'wppb_msf_fields'       : fields,
349            'request_data'          : request_data,
350            'form_type'             : form_type
351        };
352
353        jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
354            jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeIn( 'fast', function() {
355                jQuery.post( wppb_msf_data_frontend.ajaxUrl , data, function( response ) {
356                    if( response.includes('no_errors') ) {
357                        if( i + 2 == count ) {
358                            jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
359                        }
360
361                        jQuery( '#' + stepName + ' fieldset li.wppb-form-field', element ).removeClass( 'wppb-field-error' ).children().remove( '.wppb-form-error' );
362
363                        jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeOut( 'fast', function() {
364                            jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
365                                jQuery( "#wppb-msf-step-" + ( i + 1 ), element ).fadeIn( 'fast' );
366
367                                if( i + 2 == count && form_type != 'edit_profile' ) {
368                                    jQuery( "p.form-submit", element ).fadeIn( 'fast' );
369                                    jQuery( ".wppb-send-credentials-checkbox", element ).closest( 'ul' ).fadeIn( 'fast' );
370                                }
371
372                                if( typeof wppb_resize_maps !== 'undefined' ) {
373                                    wppb_resize_maps();
374                                }
375
376                                jQuery( '#wppb-msf-tabs-' + i, element ).removeClass( 'wppb-msf-commands-error' );
377                                jQuery( '#wppb-msf-pagination-' + i, element ).removeClass( 'wppb-msf-commands-error' );
378
379                                i++;
380
381                                if( i > 0 ) {
382                                    jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
383                                }
384
385                                if( i != count - 1 ) {
386                                    jQuery( '.wppb-msf-next', element ).prop( 'disabled', false );
387                                }
388
389                                jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).removeClass( 'wppb-msf-active' );
390                                jQuery( '#wppb-msf-pagination', element ).find( '#wppb-msf-pagination-' + i ).prop( 'disabled', false ).addClass( 'wppb-msf-active' ).attr( 'data-msf-disabled-check', 'no' );
391
392                                jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).each( function() {
393                                    if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
394                                        jQuery( this ).prop( 'disabled', false );
395                                    }
396                                } );
397
398                                jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).removeClass( 'wppb-msf-active' );
399                                jQuery( '#wppb-msf-tabs', element ).find( '#wppb-msf-tabs-' + i ).prop( 'disabled', false ).addClass( 'wppb-msf-active' ).attr( 'data-msf-disabled-check', 'no' );
400
401                                jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).each( function() {
402                                    if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
403                                        jQuery( this ).prop( 'disabled', false );
404                                    }
405                                } );
406
407                                wppb_msf_tempRequired( element );
408
409                                jQuery( 'html, body' ).animate( {
410                                    scrollTop: jQuery( element ).offset().top - 150
411                                }, 200 );
412                            } );
413                        } );
414                    } else {
415                        jQuery( '#' + stepName + ' fieldset li.wppb-form-field', element ).removeClass( 'wppb-field-error' ).children().remove( '.wppb-form-error' );
416
417                        var fields_errors = JSON.parse( response );
418
419                        jQuery.each( fields_errors, function( key, value ) {
420                            var meta_name;
421
422                            if( value['type'] !== undefined && value['type'] == 'woocommerce' ) {
423                                meta_name = jQuery( '#' + form_id ).find( '.wppb_' +  value['field'] );
424                            } else {
425                                meta_name = jQuery( '#' + form_id ).find( '.wppb-' +  value['field'] );
426                            }
427
428                            if( meta_name.length > 1 ) {
429                                jQuery.each( meta_name, function( key2, value2 ) {
430                                    if( jQuery( value2, element ).find( 'label' ).attr( 'for' ) == key ) {
431                                        jQuery( jQuery( value2, element ) ).addClass( 'wppb-field-error' ).append( value['error'] );
432                                    }
433                                } );
434                            } else {
435                                meta_name.addClass( 'wppb-field-error' ).append( value['error'] );
436                            }
437                        } );
438
439                        jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeOut( 'fast', function() {
440                            jQuery( "#" + stepName, element ).fadeIn( 'fast' );
441
442                            jQuery( '.wppb-msf-next', element ).prop( 'disabled', false );
443
444                            if( i > 0 ) {
445                                jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
446                            }
447
448                            jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).each( function() {
449                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
450                                    jQuery( this ).prop( 'disabled', false );
451                                }
452                            } );
453
454                            jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).each( function() {
455                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
456                                    jQuery( this ).prop( 'disabled', false );
457                                }
458                            } );
459
460                            jQuery( 'html, body' ).animate( {
461                                scrollTop: jQuery( '.wppb-field-error', element ).first().closest( 'li' ).offset().top - 100
462                            }, 200 );
463                        } );
464                    }
465                } );
466            } );
467        } );
468    } );
469
470    jQuery( ".wppb-msf-pagination", element ).on( "click", function( e ) {
471        e.preventDefault();
472
473        var page = jQuery( this );
474
475        if( page.data( 'msf-step' ) != i ) {
476            var stepName = "wppb-msf-step-" + i;
477
478            jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).removeClass( 'wppb-msf-active' ).prop( 'disabled', true );
479            jQuery( page ).addClass( 'wppb-msf-active' );
480
481            jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).removeClass( 'wppb-msf-active' ).prop( 'disabled', true );
482            jQuery( '#wppb-msf-tabs', element ).find( '#wppb-msf-tabs-' + page.data( 'msf-step' ) ).addClass( 'wppb-msf-active' );
483
484            jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
485            jQuery( '.wppb-msf-prev', element ).prop( 'disabled', true );
486
487            jQuery( '#' + form_id ).find( '.wppb-msf-spinner-container' )
488                .css( 'height', jQuery( '#' + stepName ).outerHeight() + 'px' )
489                .css( 'line-height', jQuery( '#' + stepName ).outerHeight() + 'px' );
490
491            jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
492                jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeIn( 'fast', function() {
493                    jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeOut( 'fast', function() {
494                        jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
495                            jQuery( "#wppb-msf-step-" + page.data( 'msf-step' ), element ).fadeIn( 'fast' );
496
497                            if( typeof wppb_resize_maps !== 'undefined' ) {
498                                wppb_resize_maps();
499                            }
500
501                            if( page.val() > 1 ) {
502                                jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
503                            }
504
505                            if( page.val() != count ) {
506                                jQuery( '.wppb-msf-next', element ).prop( 'disabled', false );
507                            }
508
509                            jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).each( function() {
510                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
511                                    jQuery( this ).prop( 'disabled', false );
512                                }
513                            } );
514
515                            jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).each( function() {
516                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
517                                    jQuery( this ).prop( 'disabled', false );
518                                }
519                            } );
520
521                            i = page.data( 'msf-step' );
522
523                            wppb_msf_tempRequired( element );
524                        } );
525                    } );
526                } );
527            } );
528        }
529    } );
530
531    jQuery( ".wppb-msf-tabs", element ).on( "click", function( e ) {
532        e.preventDefault();
533
534        var page = jQuery( this );
535
536        if( page.data( 'msf-step' ) != i ) {
537            var stepName = "wppb-msf-step-" + i;
538
539            jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).removeClass( 'wppb-msf-active' ).prop( 'disabled', true );
540            jQuery( page ).addClass( 'wppb-msf-active' );
541
542            jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).removeClass( 'wppb-msf-active' ).prop( 'disabled', true );
543            jQuery( '#wppb-msf-pagination', element ).find( '#wppb-msf-pagination-' + page.data( 'msf-step' ) ).addClass( 'wppb-msf-active' );
544
545            jQuery( '.wppb-msf-next', element ).prop( 'disabled', true );
546            jQuery( '.wppb-msf-prev', element ).prop( 'disabled', true );
547
548            jQuery( '#' + form_id ).find( '.wppb-msf-spinner-container' )
549                .css( 'height', jQuery( '#' + stepName ).outerHeight() + 'px' )
550                .css( 'line-height', jQuery( '#' + stepName ).outerHeight() + 'px' );
551
552            jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
553                jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeIn( 'fast', function() {
554                    jQuery( '#' + form_id ).find( ".wppb-msf-spinner-container" ).fadeOut( 'fast', function() {
555                        jQuery( "#" + stepName, element ).fadeOut( 'fast', function() {
556                            jQuery( "#wppb-msf-step-" + page.data( 'msf-step' ), element ).fadeIn( 'fast' );
557
558                            if( typeof wppb_resize_maps !== 'undefined' ) {
559                                wppb_resize_maps();
560                            }
561
562                            if( ( page.data( 'msf-step' ) + 1 ) > 1 ) {
563                                jQuery( '.wppb-msf-prev', element ).prop( 'disabled', false );
564                            }
565
566                            if( ( page.data( 'msf-step' ) + 1 ) != count ) {
567                                jQuery( '.wppb-msf-next', element ).prop( 'disabled', false );
568                            }
569
570                            jQuery( '#wppb-msf-tabs', element ).find( '.wppb-msf-tabs' ).each( function() {
571                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
572                                    jQuery( this ).prop( 'disabled', false );
573                                }
574                            } );
575
576                            jQuery( '#wppb-msf-pagination', element ).find( '.wppb-msf-pagination' ).each( function() {
577                                if( jQuery( this ).attr( 'data-msf-disabled-check' ) == 'no' ) {
578                                    jQuery( this ).prop( 'disabled', false );
579                                }
580                            } );
581
582                            i = page.data( 'msf-step' );
583
584                            wppb_msf_tempRequired( element );
585                        } );
586                    } );
587                } );
588            } );
589        }
590    } );
591}
592
593function wppb_msf_tempRequired( element ) {
594    jQuery( element['selector'] + ' .wppb-form-field:hidden' ).find( '[required]' ).each( function() {
595        if( jQuery( this ).closest( 'ul' ).attr( 'data-wppb-rpf-set' ) != 'template' ) {
596            jQuery( this ).removeAttr( 'required' ).attr( 'wppb-msf-temp-required', '' );
597        }
598    } );
599
600    jQuery( element['selector'] + ' .wppb-form-field:visible' ).find( '[wppb-msf-temp-required]' ).each( function() {
601        if( jQuery( this ).closest( 'ul' ).attr( 'data-wppb-rpf-set' ) != 'template' ) {
602            jQuery( this ).removeAttr( 'wppb-msf-temp-required' ).attr( 'required', '' );
603        }
604    } );
605}

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.