Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wpforms-.../assets/js/frontend
File: wpforms.js
}
[3000] Fix | Delete
[3001] Fix | Delete
const $captchaContainer = $form.find( '.wpforms-recaptcha-container' );
[3002] Fix | Delete
let apiVar,
[3003] Fix | Delete
recaptchaID;
[3004] Fix | Delete
[3005] Fix | Delete
if ( $captchaContainer.hasClass( 'wpforms-is-hcaptcha' ) ) {
[3006] Fix | Delete
apiVar = hcaptcha;
[3007] Fix | Delete
} else if ( $captchaContainer.hasClass( 'wpforms-is-turnstile' ) ) {
[3008] Fix | Delete
apiVar = turnstile;
[3009] Fix | Delete
} else {
[3010] Fix | Delete
apiVar = grecaptcha;
[3011] Fix | Delete
}
[3012] Fix | Delete
[3013] Fix | Delete
// Check for invisible recaptcha first.
[3014] Fix | Delete
recaptchaID = $form.find( '.wpforms-submit' ).get( 0 ).recaptchaID;
[3015] Fix | Delete
[3016] Fix | Delete
// Check for hcaptcha/recaptcha v2, if invisible recaptcha is not found.
[3017] Fix | Delete
if ( app.empty( recaptchaID ) && recaptchaID !== 0 ) {
[3018] Fix | Delete
recaptchaID = $form.find( '.g-recaptcha' ).data( 'recaptcha-id' );
[3019] Fix | Delete
}
[3020] Fix | Delete
[3021] Fix | Delete
// Reset captcha.
[3022] Fix | Delete
if ( ! app.empty( recaptchaID ) || recaptchaID === 0 ) {
[3023] Fix | Delete
apiVar.reset( recaptchaID );
[3024] Fix | Delete
}
[3025] Fix | Delete
},
[3026] Fix | Delete
[3027] Fix | Delete
/**
[3028] Fix | Delete
* Console log AJAX error.
[3029] Fix | Delete
*
[3030] Fix | Delete
* @since 1.5.3
[3031] Fix | Delete
*
[3032] Fix | Delete
* @param {string} error Error text (optional).
[3033] Fix | Delete
*/
[3034] Fix | Delete
consoleLogAjaxError( error ) {
[3035] Fix | Delete
if ( error ) {
[3036] Fix | Delete
console.error( 'WPForms AJAX submit error:\n%s', error ); // eslint-disable-line no-console
[3037] Fix | Delete
} else {
[3038] Fix | Delete
console.error( 'WPForms AJAX submit error' ); // eslint-disable-line no-console
[3039] Fix | Delete
}
[3040] Fix | Delete
},
[3041] Fix | Delete
[3042] Fix | Delete
/**
[3043] Fix | Delete
* Display form AJAX errors.
[3044] Fix | Delete
*
[3045] Fix | Delete
* @since 1.5.3
[3046] Fix | Delete
*
[3047] Fix | Delete
* @param {jQuery} $form Form element.
[3048] Fix | Delete
* @param {Object} errors Errors in format { general: { generalErrors }, field: { fieldErrors } }.
[3049] Fix | Delete
*/
[3050] Fix | Delete
displayFormAjaxErrors( $form, errors ) { // eslint-disable-line complexity
[3051] Fix | Delete
if ( 'string' === typeof errors ) {
[3052] Fix | Delete
app.displayFormAjaxGeneralErrors( $form, errors );
[3053] Fix | Delete
return;
[3054] Fix | Delete
}
[3055] Fix | Delete
[3056] Fix | Delete
errors = errors && ( 'errors' in errors ) ? errors.errors : null;
[3057] Fix | Delete
[3058] Fix | Delete
if ( app.empty( errors ) || ( app.empty( errors.general ) && app.empty( errors.field ) ) ) {
[3059] Fix | Delete
app.consoleLogAjaxError();
[3060] Fix | Delete
return;
[3061] Fix | Delete
}
[3062] Fix | Delete
[3063] Fix | Delete
if ( ! app.empty( errors.general ) ) {
[3064] Fix | Delete
app.displayFormAjaxGeneralErrors( $form, errors.general );
[3065] Fix | Delete
}
[3066] Fix | Delete
[3067] Fix | Delete
if ( ! app.empty( errors.field ) ) {
[3068] Fix | Delete
app.displayFormAjaxFieldErrors( $form, errors.field );
[3069] Fix | Delete
}
[3070] Fix | Delete
},
[3071] Fix | Delete
[3072] Fix | Delete
/**
[3073] Fix | Delete
* Display form AJAX general errors that cannot be displayed using jQuery Validation plugin.
[3074] Fix | Delete
*
[3075] Fix | Delete
* @since 1.5.3
[3076] Fix | Delete
*
[3077] Fix | Delete
* @param {jQuery} $form Form element.
[3078] Fix | Delete
* @param {Object} errors Errors in format { errorType: errorText }.
[3079] Fix | Delete
*/
[3080] Fix | Delete
displayFormAjaxGeneralErrors( $form, errors ) { // eslint-disable-line complexity
[3081] Fix | Delete
if ( ! $form || ! $form.length ) {
[3082] Fix | Delete
return;
[3083] Fix | Delete
}
[3084] Fix | Delete
[3085] Fix | Delete
if ( app.empty( errors ) ) {
[3086] Fix | Delete
return;
[3087] Fix | Delete
}
[3088] Fix | Delete
[3089] Fix | Delete
if ( app.isModernMarkupEnabled() ) {
[3090] Fix | Delete
$form.attr( {
[3091] Fix | Delete
'aria-invalid': 'true',
[3092] Fix | Delete
'aria-errormessage': '',
[3093] Fix | Delete
} );
[3094] Fix | Delete
}
[3095] Fix | Delete
[3096] Fix | Delete
// Safety net for random errors thrown by a third-party code. Should never be used intentionally.
[3097] Fix | Delete
if ( 'string' === typeof errors ) {
[3098] Fix | Delete
const roleAttr = app.isModernMarkupEnabled() ? ' role="alert"' : '',
[3099] Fix | Delete
errPrefix = app.isModernMarkupEnabled() ? `<span class="wpforms-hidden">${ wpforms_settings.formErrorMessagePrefix }</span>` : '';
[3100] Fix | Delete
[3101] Fix | Delete
$form
[3102] Fix | Delete
.find( '.wpforms-submit-container' )
[3103] Fix | Delete
.before( `<div class="wpforms-error-container"${ roleAttr }>${ errPrefix }${ errors }</div>` );
[3104] Fix | Delete
[3105] Fix | Delete
app.setCurrentPage( $form, {} );
[3106] Fix | Delete
[3107] Fix | Delete
return;
[3108] Fix | Delete
}
[3109] Fix | Delete
[3110] Fix | Delete
const formId = $form.data( 'formid' );
[3111] Fix | Delete
[3112] Fix | Delete
app.printGeneralErrors( $form, errors, formId );
[3113] Fix | Delete
},
[3114] Fix | Delete
[3115] Fix | Delete
/**
[3116] Fix | Delete
* Print general errors.
[3117] Fix | Delete
*
[3118] Fix | Delete
* @since 1.8.3
[3119] Fix | Delete
*
[3120] Fix | Delete
* @param {jQuery} $form Form element.
[3121] Fix | Delete
* @param {Object} errors Error Object.
[3122] Fix | Delete
* @param {string} formId Form ID.
[3123] Fix | Delete
*/
[3124] Fix | Delete
printGeneralErrors( $form, errors, formId ) {
[3125] Fix | Delete
/**
[3126] Fix | Delete
* Handle header error.
[3127] Fix | Delete
*
[3128] Fix | Delete
* @since 1.8.6
[3129] Fix | Delete
*
[3130] Fix | Delete
* @param {string} html Error HTML.
[3131] Fix | Delete
*/
[3132] Fix | Delete
function handleHeaderError( html ) {
[3133] Fix | Delete
$form.prepend( html );
[3134] Fix | Delete
}
[3135] Fix | Delete
[3136] Fix | Delete
/**
[3137] Fix | Delete
* Handle footer error.
[3138] Fix | Delete
*
[3139] Fix | Delete
* @since 1.8.6
[3140] Fix | Delete
*
[3141] Fix | Delete
* @param {string} html Error HTML.
[3142] Fix | Delete
*/
[3143] Fix | Delete
function handleFooterError( html ) {
[3144] Fix | Delete
if ( $form.find( '.wpforms-page-indicator' ).length === 0 ) {
[3145] Fix | Delete
$form.find( '.wpforms-submit-container' ).before( html );
[3146] Fix | Delete
} else {
[3147] Fix | Delete
// Check if it is a multipage form.
[3148] Fix | Delete
// If it is a multipage form, we need error only on the first page.
[3149] Fix | Delete
$form.find( '.wpforms-page-1' ).append( html );
[3150] Fix | Delete
}
[3151] Fix | Delete
}
[3152] Fix | Delete
[3153] Fix | Delete
/**
[3154] Fix | Delete
* Handle reCAPTCHA error.
[3155] Fix | Delete
*
[3156] Fix | Delete
* @since 1.8.6
[3157] Fix | Delete
*
[3158] Fix | Delete
* @param {string} html Error HTML.
[3159] Fix | Delete
*/
[3160] Fix | Delete
function handleRecaptchaError( html ) {
[3161] Fix | Delete
$form.find( '.wpforms-recaptcha-container' ).append( html );
[3162] Fix | Delete
}
[3163] Fix | Delete
[3164] Fix | Delete
$.each( errors, function( type, html ) {
[3165] Fix | Delete
switch ( type ) {
[3166] Fix | Delete
case 'header':
[3167] Fix | Delete
handleHeaderError( html );
[3168] Fix | Delete
break;
[3169] Fix | Delete
case 'footer':
[3170] Fix | Delete
handleFooterError( html );
[3171] Fix | Delete
break;
[3172] Fix | Delete
case 'recaptcha':
[3173] Fix | Delete
handleRecaptchaError( html );
[3174] Fix | Delete
break;
[3175] Fix | Delete
}
[3176] Fix | Delete
[3177] Fix | Delete
if ( app.isModernMarkupEnabled() ) {
[3178] Fix | Delete
const errormessage = $form.attr( 'aria-errormessage' ) || '';
[3179] Fix | Delete
$form.attr( 'aria-errormessage', `${ errormessage } wpforms-${ formId }-${ type }-error` );
[3180] Fix | Delete
}
[3181] Fix | Delete
} );
[3182] Fix | Delete
[3183] Fix | Delete
if ( $form.find( '.wpforms-error-container' ).length ) {
[3184] Fix | Delete
app.animateScrollTop( $form.find( '.wpforms-error-container' ).first().offset().top - 100 );
[3185] Fix | Delete
}
[3186] Fix | Delete
},
[3187] Fix | Delete
[3188] Fix | Delete
/**
[3189] Fix | Delete
* Clear forms AJAX general errors that cannot be cleared using jQuery Validation plugin.
[3190] Fix | Delete
*
[3191] Fix | Delete
* @since 1.5.3
[3192] Fix | Delete
*
[3193] Fix | Delete
* @param {jQuery} $form Form element.
[3194] Fix | Delete
*/
[3195] Fix | Delete
clearFormAjaxGeneralErrors( $form ) {
[3196] Fix | Delete
$form.find( '.wpforms-error-container' ).remove();
[3197] Fix | Delete
$form.find( '#wpforms-field_recaptcha-error' ).remove();
[3198] Fix | Delete
[3199] Fix | Delete
// Clear form accessibility attributes.
[3200] Fix | Delete
if ( app.isModernMarkupEnabled() ) {
[3201] Fix | Delete
$form.attr( {
[3202] Fix | Delete
'aria-invalid': 'false',
[3203] Fix | Delete
'aria-errormessage': '',
[3204] Fix | Delete
} );
[3205] Fix | Delete
}
[3206] Fix | Delete
},
[3207] Fix | Delete
[3208] Fix | Delete
/**
[3209] Fix | Delete
* Display form AJAX field errors using jQuery Validation plugin.
[3210] Fix | Delete
*
[3211] Fix | Delete
* @since 1.5.3
[3212] Fix | Delete
*
[3213] Fix | Delete
* @param {jQuery} $form Form element.
[3214] Fix | Delete
* @param {Object} errors Errors in format { fieldName: errorText }.
[3215] Fix | Delete
*/
[3216] Fix | Delete
displayFormAjaxFieldErrors( $form, errors ) {
[3217] Fix | Delete
if ( ! $form || ! $form.length ) {
[3218] Fix | Delete
return;
[3219] Fix | Delete
}
[3220] Fix | Delete
[3221] Fix | Delete
if ( app.empty( errors ) ) {
[3222] Fix | Delete
return;
[3223] Fix | Delete
}
[3224] Fix | Delete
[3225] Fix | Delete
const validator = $form.data( 'validator' );
[3226] Fix | Delete
[3227] Fix | Delete
if ( ! validator ) {
[3228] Fix | Delete
return;
[3229] Fix | Delete
}
[3230] Fix | Delete
[3231] Fix | Delete
errors = app.splitFieldErrors( errors );
[3232] Fix | Delete
[3233] Fix | Delete
// Set data attribute for each field with server error.
[3234] Fix | Delete
$.each( errors, function( field, message ) {
[3235] Fix | Delete
$( '[name="' + field + '"]', $form ).attr( 'data-server-error', message );
[3236] Fix | Delete
} );
[3237] Fix | Delete
[3238] Fix | Delete
validator.showErrors( errors );
[3239] Fix | Delete
[3240] Fix | Delete
if ( ! app.formHasCaptcha( $form ) ) {
[3241] Fix | Delete
validator.focusInvalid();
[3242] Fix | Delete
}
[3243] Fix | Delete
},
[3244] Fix | Delete
[3245] Fix | Delete
/**
[3246] Fix | Delete
* Split field errors.
[3247] Fix | Delete
*
[3248] Fix | Delete
* @since 1.8.9
[3249] Fix | Delete
*
[3250] Fix | Delete
* @param {Object} errors Errors.
[3251] Fix | Delete
*
[3252] Fix | Delete
* @return {Object} Errors.
[3253] Fix | Delete
*/
[3254] Fix | Delete
splitFieldErrors: ( errors ) => {
[3255] Fix | Delete
$.each( errors, function( field, message ) {
[3256] Fix | Delete
if ( 'string' === typeof message ) {
[3257] Fix | Delete
return;
[3258] Fix | Delete
}
[3259] Fix | Delete
[3260] Fix | Delete
// If errors an object consisting of { subfield: errorMessage }, then iterate each to display error.
[3261] Fix | Delete
$.each( message, function( subfield, errorMessage ) {
[3262] Fix | Delete
// Get the last part of the field (in []) and check if it is the same as subfield.
[3263] Fix | Delete
const lastPart = field.split( '[' ).pop().replace( ']', '' );
[3264] Fix | Delete
// Get from the `field` name all except what we caught in `lastPart`.
[3265] Fix | Delete
const fieldNameBase = field.replace( '[' + lastPart + ']', '' );
[3266] Fix | Delete
[3267] Fix | Delete
if ( lastPart === subfield ) {
[3268] Fix | Delete
errors[ field ] = errorMessage;
[3269] Fix | Delete
} else if ( 'string' === typeof subfield && isNaN( subfield ) ) {
[3270] Fix | Delete
errors[ fieldNameBase + '[' + subfield + ']' ] = errorMessage;
[3271] Fix | Delete
}
[3272] Fix | Delete
} );
[3273] Fix | Delete
} );
[3274] Fix | Delete
[3275] Fix | Delete
return errors;
[3276] Fix | Delete
},
[3277] Fix | Delete
[3278] Fix | Delete
/**
[3279] Fix | Delete
* Submit a form using AJAX.
[3280] Fix | Delete
*
[3281] Fix | Delete
* @since 1.5.3
[3282] Fix | Delete
* @since 1.7.6 Allow canceling Ajax submission.
[3283] Fix | Delete
*
[3284] Fix | Delete
* @param {jQuery} $form Form element.
[3285] Fix | Delete
*
[3286] Fix | Delete
* @return {JQueryXHR|JQueryDeferred} Promise like an object for async callbacks.
[3287] Fix | Delete
*/
[3288] Fix | Delete
formSubmitAjax: ( $form ) => { // eslint-disable-line max-lines-per-function
[3289] Fix | Delete
if ( ! $form.length ) {
[3290] Fix | Delete
return $.Deferred().reject(); // eslint-disable-line new-cap
[3291] Fix | Delete
}
[3292] Fix | Delete
[3293] Fix | Delete
const $container = $form.closest( '.wpforms-container' ),
[3294] Fix | Delete
$spinner = $form.find( '.wpforms-submit-spinner' );
[3295] Fix | Delete
let $confirmationScroll;
[3296] Fix | Delete
[3297] Fix | Delete
$container.css( 'opacity', 0.6 );
[3298] Fix | Delete
$spinner.show();
[3299] Fix | Delete
[3300] Fix | Delete
app.clearFormAjaxGeneralErrors( $form );
[3301] Fix | Delete
[3302] Fix | Delete
const formData = new FormData( $form.get( 0 ) );
[3303] Fix | Delete
[3304] Fix | Delete
formData.append( 'action', 'wpforms_submit' );
[3305] Fix | Delete
formData.append( 'start_timestamp', $form.data( 'timestamp' ) );
[3306] Fix | Delete
formData.append( 'end_timestamp', Date.now() );
[3307] Fix | Delete
[3308] Fix | Delete
const args = {
[3309] Fix | Delete
type : 'post',
[3310] Fix | Delete
dataType : 'json',
[3311] Fix | Delete
url : wpforms_settings.ajaxurl,
[3312] Fix | Delete
data : formData,
[3313] Fix | Delete
cache : false,
[3314] Fix | Delete
contentType: false,
[3315] Fix | Delete
processData: false,
[3316] Fix | Delete
};
[3317] Fix | Delete
[3318] Fix | Delete
args.success = function( json ) { // eslint-disable-line complexity
[3319] Fix | Delete
if ( ! json ) {
[3320] Fix | Delete
app.consoleLogAjaxError();
[3321] Fix | Delete
return;
[3322] Fix | Delete
}
[3323] Fix | Delete
[3324] Fix | Delete
if ( json.data && json.data.action_required ) {
[3325] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitActionRequired', json );
[3326] Fix | Delete
return;
[3327] Fix | Delete
}
[3328] Fix | Delete
[3329] Fix | Delete
if ( ! json.success ) {
[3330] Fix | Delete
app.resetFormRecaptcha( $form );
[3331] Fix | Delete
app.displayFormAjaxErrors( $form, json.data );
[3332] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitFailed', json );
[3333] Fix | Delete
app.setCurrentPage( $form, json.data );
[3334] Fix | Delete
return;
[3335] Fix | Delete
}
[3336] Fix | Delete
[3337] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitSuccess', json );
[3338] Fix | Delete
[3339] Fix | Delete
if ( ! json.data ) {
[3340] Fix | Delete
return;
[3341] Fix | Delete
}
[3342] Fix | Delete
[3343] Fix | Delete
if ( json.data.redirect_url ) {
[3344] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitBeforeRedirect', json );
[3345] Fix | Delete
window.location = json.data.redirect_url;
[3346] Fix | Delete
return;
[3347] Fix | Delete
}
[3348] Fix | Delete
[3349] Fix | Delete
if ( json.data.confirmation ) {
[3350] Fix | Delete
$container.html( json.data.confirmation );
[3351] Fix | Delete
$confirmationScroll = $container.find( 'div.wpforms-confirmation-scroll' );
[3352] Fix | Delete
[3353] Fix | Delete
$container.trigger( 'wpformsAjaxSubmitSuccessConfirmation', json );
[3354] Fix | Delete
[3355] Fix | Delete
if ( $confirmationScroll.length ) {
[3356] Fix | Delete
app.animateScrollTop( $confirmationScroll.offset().top - 100 );
[3357] Fix | Delete
}
[3358] Fix | Delete
}
[3359] Fix | Delete
};
[3360] Fix | Delete
[3361] Fix | Delete
args.error = function( jqHXR, textStatus, error ) {
[3362] Fix | Delete
app.consoleLogAjaxError( error );
[3363] Fix | Delete
[3364] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitError', [ jqHXR, textStatus, error ] );
[3365] Fix | Delete
};
[3366] Fix | Delete
[3367] Fix | Delete
args.complete = function( jqHXR, textStatus ) {
[3368] Fix | Delete
/*
[3369] Fix | Delete
* Do not make form active if the action is required, or
[3370] Fix | Delete
* if the ajax request was successful and the form has a redirect.
[3371] Fix | Delete
*/
[3372] Fix | Delete
if (
[3373] Fix | Delete
jqHXR.responseJSON &&
[3374] Fix | Delete
jqHXR.responseJSON.data &&
[3375] Fix | Delete
(
[3376] Fix | Delete
jqHXR.responseJSON.data.action_required ||
[3377] Fix | Delete
( textStatus === 'success' && jqHXR.responseJSON.data.redirect_url )
[3378] Fix | Delete
)
[3379] Fix | Delete
) {
[3380] Fix | Delete
return;
[3381] Fix | Delete
}
[3382] Fix | Delete
[3383] Fix | Delete
app.restoreSubmitButton( $form, $container );
[3384] Fix | Delete
[3385] Fix | Delete
$form.trigger( 'wpformsAjaxSubmitCompleted', [ jqHXR, textStatus ] );
[3386] Fix | Delete
};
[3387] Fix | Delete
[3388] Fix | Delete
const event = WPFormsUtils.triggerEvent( $form, 'wpformsAjaxBeforeSubmit', [ $form ] );
[3389] Fix | Delete
[3390] Fix | Delete
// Allow callbacks on `wpformsAjaxBeforeSubmit` to cancel Ajax form submission by triggering `event.preventDefault()`.
[3391] Fix | Delete
if ( event.isDefaultPrevented() ) {
[3392] Fix | Delete
app.restoreSubmitButton( $form, $container );
[3393] Fix | Delete
[3394] Fix | Delete
return $.Deferred().reject(); // eslint-disable-line new-cap
[3395] Fix | Delete
}
[3396] Fix | Delete
[3397] Fix | Delete
return $.ajax( args );
[3398] Fix | Delete
},
[3399] Fix | Delete
[3400] Fix | Delete
/**
[3401] Fix | Delete
* Display page with error for multiple page form.
[3402] Fix | Delete
*
[3403] Fix | Delete
* @since 1.7.9
[3404] Fix | Delete
*
[3405] Fix | Delete
* @param {jQuery} $form Form element.
[3406] Fix | Delete
* @param {Object} $json Error json.
[3407] Fix | Delete
*/
[3408] Fix | Delete
setCurrentPage( $form, $json ) { // eslint-disable-line complexity
[3409] Fix | Delete
// Return for one-page forms.
[3410] Fix | Delete
if ( $form.find( '.wpforms-page-indicator' ).length === 0 ) {
[3411] Fix | Delete
return;
[3412] Fix | Delete
}
[3413] Fix | Delete
[3414] Fix | Delete
const $errorPages = [];
[3415] Fix | Delete
[3416] Fix | Delete
$form.find( '.wpforms-page' ).each( function( index, el ) {
[3417] Fix | Delete
if ( $( el ).find( '.wpforms-has-error' ).length >= 1 ) {
[3418] Fix | Delete
return $errorPages.push( $( el ) );
[3419] Fix | Delete
}
[3420] Fix | Delete
} );
[3421] Fix | Delete
[3422] Fix | Delete
// Do not change the page if there is a captcha error and there are no other field or footer errors.
[3423] Fix | Delete
if (
[3424] Fix | Delete
$errorPages.length === 0 &&
[3425] Fix | Delete
$json.errors !== undefined &&
[3426] Fix | Delete
$json.errors.general !== undefined &&
[3427] Fix | Delete
$json.errors.general.footer === undefined &&
[3428] Fix | Delete
$json.errors.general.recaptcha !== undefined
[3429] Fix | Delete
) {
[3430] Fix | Delete
return;
[3431] Fix | Delete
}
[3432] Fix | Delete
[3433] Fix | Delete
// Get the first page with error.
[3434] Fix | Delete
const $currentPage = $errorPages.length > 0 ? $errorPages[ 0 ] : $form.find( '.wpforms-page-1' );
[3435] Fix | Delete
const currentPage = $currentPage.data( 'page' );
[3436] Fix | Delete
[3437] Fix | Delete
let $page,
[3438] Fix | Delete
action = 'prev';
[3439] Fix | Delete
[3440] Fix | Delete
// If error is on the first page, or we have general errors among others, go to the first page.
[3441] Fix | Delete
if ( currentPage === 1 || ( $json.errors !== undefined && $json.errors.general.footer !== undefined ) ) {
[3442] Fix | Delete
$page = $form.find( '.wpforms-page-1' ).next();
[3443] Fix | Delete
} else {
[3444] Fix | Delete
$page = $currentPage.next().length !== 0 ? $currentPage.next() : $currentPage.prev();
[3445] Fix | Delete
action = $currentPage.next().length !== 0 ? 'prev' : 'next';
[3446] Fix | Delete
}
[3447] Fix | Delete
[3448] Fix | Delete
// Take the page from which navigate to error.
[3449] Fix | Delete
const $nextBtn = $page.find( '.wpforms-page-next' ),
[3450] Fix | Delete
page = $page.data( 'page' );
[3451] Fix | Delete
[3452] Fix | Delete
// Imitate navigation to the page with error.
[3453] Fix | Delete
app.navigateToPage( $nextBtn, action, page, $form, $( '.wpforms-page-' + page ) );
[3454] Fix | Delete
},
[3455] Fix | Delete
[3456] Fix | Delete
/**
[3457] Fix | Delete
* Scroll to position with animation.
[3458] Fix | Delete
*
[3459] Fix | Delete
* @since 1.5.3
[3460] Fix | Delete
*
[3461] Fix | Delete
* @param {number} position Position (in pixels) to scroll to,
[3462] Fix | Delete
* @param {number} duration Animation duration.
[3463] Fix | Delete
* @param {Function} complete Function to execute after animation is complete.
[3464] Fix | Delete
*
[3465] Fix | Delete
* @return {Promise} A promise object for async callbacks.
[3466] Fix | Delete
*/
[3467] Fix | Delete
animateScrollTop( position, duration, complete ) {
[3468] Fix | Delete
duration = duration || 1000;
[3469] Fix | Delete
complete = typeof complete === 'function' ? complete : function() {};
[3470] Fix | Delete
return $( 'html, body' ).animate( { scrollTop: parseInt( position, 10 ) }, { duration, complete } ).promise();
[3471] Fix | Delete
},
[3472] Fix | Delete
[3473] Fix | Delete
/**
[3474] Fix | Delete
* Save tinyMCE.
[3475] Fix | Delete
*
[3476] Fix | Delete
* @since 1.7.0
[3477] Fix | Delete
*/
[3478] Fix | Delete
saveTinyMCE() {
[3479] Fix | Delete
if ( typeof tinyMCE !== 'undefined' ) {
[3480] Fix | Delete
tinyMCE.triggerSave();
[3481] Fix | Delete
}
[3482] Fix | Delete
},
[3483] Fix | Delete
[3484] Fix | Delete
/**
[3485] Fix | Delete
* Check if an object is a function.
[3486] Fix | Delete
*
[3487] Fix | Delete
* @deprecated 1.6.7
[3488] Fix | Delete
*
[3489] Fix | Delete
* @since 1.5.8
[3490] Fix | Delete
*
[3491] Fix | Delete
* @param {any} object Object to check if it is a function.
[3492] Fix | Delete
*
[3493] Fix | Delete
* @return {boolean} True if an object is a function.
[3494] Fix | Delete
*/
[3495] Fix | Delete
isFunction( object ) {
[3496] Fix | Delete
return !! ( object && object.constructor && object.call && object.apply );
[3497] Fix | Delete
},
[3498] Fix | Delete
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function