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/admin/builder
File: admin-builder.js
} ).removeClass( 'wpforms-hidden-strict' );
[2500] Fix | Delete
$currentCountry.attr( { id: '', name: '' } ).addClass( 'wpforms-hidden-strict' );
[2501] Fix | Delete
} );
[2502] Fix | Delete
[2503] Fix | Delete
// Real-time updates for a Date/Time date type
[2504] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-date .type select', function( e ) { // eslint-disable-line no-unused-vars
[2505] Fix | Delete
const $this = $( this ),
[2506] Fix | Delete
value = $this.val(),
[2507] Fix | Delete
id = $( this ).closest( '.wpforms-field-option-row' ).data( 'field-id' ),
[2508] Fix | Delete
addClass = value === 'datepicker' ? 'wpforms-date-type-datepicker' : 'wpforms-date-type-dropdown',
[2509] Fix | Delete
removeClass = value === 'datepicker' ? 'wpforms-date-type-dropdown' : 'wpforms-date-type-datepicker';
[2510] Fix | Delete
[2511] Fix | Delete
$( '#wpforms-field-' + id ).find( '.wpforms-date' ).addClass( addClass ).removeClass( removeClass );
[2512] Fix | Delete
$( '#wpforms-field-option-' + id ).addClass( addClass ).removeClass( removeClass );
[2513] Fix | Delete
[2514] Fix | Delete
const $limitDays = $this.closest( '.wpforms-field-option-group-advanced' )
[2515] Fix | Delete
.find( '.wpforms-field-option-row-date_limit_days, .wpforms-field-option-row-date_limit_days_options, .wpforms-field-option-row-date_disable_past_dates' ),
[2516] Fix | Delete
$limitDaysOptions = $( '#wpforms-field-option-row-' + id + '-date_limit_days_options' );
[2517] Fix | Delete
[2518] Fix | Delete
if ( value === 'dropdown' ) {
[2519] Fix | Delete
const $dateSelect = $( '#wpforms-field-option-' + id + '-date_format' );
[2520] Fix | Delete
[2521] Fix | Delete
if ( $dateSelect.find( 'option:selected' ).hasClass( 'datepicker-only' ) ) {
[2522] Fix | Delete
$dateSelect.prop( 'selectedIndex', 0 ).trigger( 'change' );
[2523] Fix | Delete
}
[2524] Fix | Delete
[2525] Fix | Delete
$limitDays.hide();
[2526] Fix | Delete
} else {
[2527] Fix | Delete
$limitDays.show();
[2528] Fix | Delete
$( '#wpforms-field-option-' + id + '-date_limit_days' ).is( ':checked' )
[2529] Fix | Delete
? $limitDaysOptions.show()
[2530] Fix | Delete
: $limitDaysOptions.hide();
[2531] Fix | Delete
}
[2532] Fix | Delete
} );
[2533] Fix | Delete
[2534] Fix | Delete
// Real-time updates for Date/Time date select format
[2535] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-date .format select', function( e ) { // eslint-disable-line no-unused-vars
[2536] Fix | Delete
const $this = $( this ),
[2537] Fix | Delete
value = $this.val(),
[2538] Fix | Delete
id = $( this ).closest( '.wpforms-field-option-row' ).data( 'field-id' ),
[2539] Fix | Delete
$field = $( '#wpforms-field-' + id );
[2540] Fix | Delete
[2541] Fix | Delete
if ( value === 'm/d/Y' ) {
[2542] Fix | Delete
$field.find( '.wpforms-date-dropdown .first option' ).text( wpforms_builder.date_select_month );
[2543] Fix | Delete
$field.find( '.wpforms-date-dropdown .second option' ).text( wpforms_builder.date_select_day );
[2544] Fix | Delete
} else if ( value === 'd/m/Y' ) {
[2545] Fix | Delete
$field.find( '.wpforms-date-dropdown .first option' ).text( wpforms_builder.date_select_day );
[2546] Fix | Delete
$field.find( '.wpforms-date-dropdown .second option' ).text( wpforms_builder.date_select_month );
[2547] Fix | Delete
}
[2548] Fix | Delete
} );
[2549] Fix | Delete
[2550] Fix | Delete
// Real-time updates for Date/Time select format
[2551] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-time .format select', function( e ) { // eslint-disable-line no-unused-vars
[2552] Fix | Delete
const $this = $( this ),
[2553] Fix | Delete
id = $this.closest( '.wpforms-field-option-row' ).data( 'field-id' );
[2554] Fix | Delete
[2555] Fix | Delete
let options = '',
[2556] Fix | Delete
hh;
[2557] Fix | Delete
[2558] Fix | Delete
// Determine a time format type.
[2559] Fix | Delete
// If the format contains `g` or `h`, then this is 12-hour format, otherwise 24 hours.
[2560] Fix | Delete
const format = $this.val().match( /[gh]/ ) ? 12 : 24,
[2561] Fix | Delete
minHour = format === 12 ? 1 : 0,
[2562] Fix | Delete
maxHour = format === 12 ? 13 : 24;
[2563] Fix | Delete
[2564] Fix | Delete
// Generate a new set of hour options.
[2565] Fix | Delete
for ( let i = minHour; i < maxHour; i++ ) {
[2566] Fix | Delete
hh = i < 10 ? '0' + i : i;
[2567] Fix | Delete
options += '<option value="{hh}">{hh}</option>'.replace( /{hh}/g, hh );
[2568] Fix | Delete
}
[2569] Fix | Delete
[2570] Fix | Delete
_.forEach( [ 'start', 'end' ], function( field ) {
[2571] Fix | Delete
const $hour = $builder.find( '#wpforms-field-option-' + id + '-time_limit_hours_' + field + '_hour' ),
[2572] Fix | Delete
$ampm = $builder.find( '#wpforms-field-option-' + id + '-time_limit_hours_' + field + '_ampm' );
[2573] Fix | Delete
[2574] Fix | Delete
let hourValue = parseInt( $hour.val(), 10 ),
[2575] Fix | Delete
ampmValue = $ampm.val();
[2576] Fix | Delete
[2577] Fix | Delete
if ( format === 24 ) {
[2578] Fix | Delete
hourValue = ampmValue === 'pm' ? hourValue + 12 : hourValue;
[2579] Fix | Delete
} else {
[2580] Fix | Delete
ampmValue = hourValue > 12 ? 'pm' : 'am';
[2581] Fix | Delete
hourValue = hourValue > 12 ? hourValue - 12 : hourValue;
[2582] Fix | Delete
}
[2583] Fix | Delete
[2584] Fix | Delete
hourValue = hourValue < 10 ? '0' + hourValue : hourValue;
[2585] Fix | Delete
$hour.html( options ).val( hourValue );
[2586] Fix | Delete
$ampm.toggleClass( 'wpforms-hidden-strict', format === 24 ).val( ampmValue );
[2587] Fix | Delete
$ampm.nextAll( 'div' ).toggleClass( 'wpforms-hidden-strict', format === 12 );
[2588] Fix | Delete
} );
[2589] Fix | Delete
} );
[2590] Fix | Delete
[2591] Fix | Delete
// Consider the field active when a disabled nav button is clicked
[2592] Fix | Delete
$builder.on( 'click', '.wpforms-pagebreak-button', function( e ) {
[2593] Fix | Delete
e.preventDefault();
[2594] Fix | Delete
$( this ).closest( '.wpforms-field' ).trigger( 'click' );
[2595] Fix | Delete
} );
[2596] Fix | Delete
[2597] Fix | Delete
/*
[2598] Fix | Delete
* Pagebreak field.
[2599] Fix | Delete
*/
[2600] Fix | Delete
app.fieldPageBreakInitDisplayPrevious( $builder.find( '.wpforms-field-pagebreak.wpforms-pagebreak-normal' ).first() );
[2601] Fix | Delete
[2602] Fix | Delete
$builder
[2603] Fix | Delete
.on( 'input', '.wpforms-field-option-row-next input', function( e ) { // eslint-disable-line no-unused-vars
[2604] Fix | Delete
// Real-time updates for "Next" pagebreak field option.
[2605] Fix | Delete
const $this = $( this ),
[2606] Fix | Delete
value = $this.val(),
[2607] Fix | Delete
$next = $( '#wpforms-field-' + $this.parent().data( 'field-id' ) ).find( '.wpforms-pagebreak-next' );
[2608] Fix | Delete
[2609] Fix | Delete
if ( value ) {
[2610] Fix | Delete
$next.css( 'display', 'inline-block' ).text( value );
[2611] Fix | Delete
} else {
[2612] Fix | Delete
$next.css( 'display', 'none' ).empty();
[2613] Fix | Delete
}
[2614] Fix | Delete
} )
[2615] Fix | Delete
.on( 'input', '.wpforms-field-option-row-prev input', function( e ) { // eslint-disable-line no-unused-vars
[2616] Fix | Delete
// Real-time updates for "Prev" pagebreak field option.
[2617] Fix | Delete
const $this = $( this ),
[2618] Fix | Delete
value = $this.val().trim(),
[2619] Fix | Delete
$field = $( '#wpforms-field-' + $this.parent().data( 'field-id' ) ),
[2620] Fix | Delete
$prevBtn = $field.find( '.wpforms-pagebreak-prev' );
[2621] Fix | Delete
[2622] Fix | Delete
if ( value && $field.prevAll( '.wpforms-field-pagebreak.wpforms-pagebreak-normal' ).length > 0 ) {
[2623] Fix | Delete
$prevBtn.removeClass( 'wpforms-hidden' ).text( value );
[2624] Fix | Delete
} else {
[2625] Fix | Delete
$prevBtn.addClass( 'wpforms-hidden' ).empty();
[2626] Fix | Delete
}
[2627] Fix | Delete
} )
[2628] Fix | Delete
.on( 'change', '.wpforms-field-option-row-prev_toggle input', function( e ) { // eslint-disable-line complexity, no-unused-vars
[2629] Fix | Delete
// Real-time updates for "Display Previous" pagebreak field option.
[2630] Fix | Delete
const $input = $( this ),
[2631] Fix | Delete
$wrapper = $input.closest( '.wpforms-field-option-row-prev_toggle' );
[2632] Fix | Delete
[2633] Fix | Delete
if ( $wrapper.hasClass( 'wpforms-entry-preview-block' ) ) {
[2634] Fix | Delete
return;
[2635] Fix | Delete
}
[2636] Fix | Delete
[2637] Fix | Delete
const $prev = $input.closest( '.wpforms-field-option-group-inner' ).find( '.wpforms-field-option-row-prev' );
[2638] Fix | Delete
[2639] Fix | Delete
const $prevLabel = $prev.find( 'input' ),
[2640] Fix | Delete
$prevBtn = $( '#wpforms-field-' + $input.closest( '.wpforms-field-option' ).data( 'field-id' ) ).find( '.wpforms-pagebreak-prev' );
[2641] Fix | Delete
[2642] Fix | Delete
$prev.toggleClass( 'wpforms-hidden', ! $input.prop( 'checked' ) );
[2643] Fix | Delete
$prevBtn.toggleClass( 'wpforms-hidden', ! $input.prop( 'checked' ) );
[2644] Fix | Delete
[2645] Fix | Delete
if ( $input.prop( 'checked' ) && ! $prevLabel.val() ) {
[2646] Fix | Delete
let message = $prevLabel.data( 'last-value' );
[2647] Fix | Delete
message = message && message.trim() ? message.trim() : wpforms_builder.previous;
[2648] Fix | Delete
[2649] Fix | Delete
$prevLabel.val( message );
[2650] Fix | Delete
}
[2651] Fix | Delete
[2652] Fix | Delete
// Backward compatibility for forms that were created before the toggle was added.
[2653] Fix | Delete
if ( ! $input.prop( 'checked' ) ) {
[2654] Fix | Delete
$prevLabel.data( 'last-value', $prevLabel.val() );
[2655] Fix | Delete
$prevLabel.val( '' );
[2656] Fix | Delete
}
[2657] Fix | Delete
[2658] Fix | Delete
$prevLabel.trigger( 'input' );
[2659] Fix | Delete
} )
[2660] Fix | Delete
.on( 'wpformsFieldAdd', app.fieldPagebreakAdd )
[2661] Fix | Delete
.on( 'wpformsFieldDelete', app.fieldPagebreakDelete )
[2662] Fix | Delete
.on( 'wpformsFieldAdd', app.toggleOrderSummaryConfirmation )
[2663] Fix | Delete
.on( 'wpformsFieldDelete', app.toggleOrderSummaryConfirmation )
[2664] Fix | Delete
.on( 'wpformsBeforeFieldDelete', app.fieldEntryPreviewDelete );
[2665] Fix | Delete
[2666] Fix | Delete
// Update Display Previous option visibility for all Pagebreak fields.
[2667] Fix | Delete
$builder.on( 'wpformsFieldMove wpformsFieldAdd wpformsFieldDelete', function( e ) { // eslint-disable-line no-unused-vars
[2668] Fix | Delete
$builder.find( '.wpforms-field-pagebreak.wpforms-pagebreak-normal' ).each( function( i ) { // eslint-disable-line no-unused-vars
[2669] Fix | Delete
app.fieldPageBreakInitDisplayPrevious( $( this ) );
[2670] Fix | Delete
} );
[2671] Fix | Delete
} );
[2672] Fix | Delete
[2673] Fix | Delete
// Real-time updates for "Page Title" pagebreak field option
[2674] Fix | Delete
$builder.on( 'input', '.wpforms-field-option-row-title input', function( e ) { // eslint-disable-line no-unused-vars
[2675] Fix | Delete
const $this = $( this ),
[2676] Fix | Delete
value = $this.val(),
[2677] Fix | Delete
id = $this.parent().data( 'field-id' );
[2678] Fix | Delete
[2679] Fix | Delete
if ( value ) {
[2680] Fix | Delete
$( '#wpforms-field-' + id ).find( '.wpforms-pagebreak-title' ).text( value );
[2681] Fix | Delete
} else {
[2682] Fix | Delete
$( '#wpforms-field-' + id ).find( '.wpforms-pagebreak-title' ).empty();
[2683] Fix | Delete
}
[2684] Fix | Delete
} );
[2685] Fix | Delete
[2686] Fix | Delete
// Real-time updates for "Page Navigation Alignment" pagebreak field option
[2687] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-nav_align select', function( e ) { // eslint-disable-line no-unused-vars
[2688] Fix | Delete
const $this = $( this );
[2689] Fix | Delete
let value = $this.val();
[2690] Fix | Delete
[2691] Fix | Delete
if ( ! value ) {
[2692] Fix | Delete
value = 'center';
[2693] Fix | Delete
}
[2694] Fix | Delete
[2695] Fix | Delete
$( '.wpforms-pagebreak-buttons' )
[2696] Fix | Delete
.removeClass( 'wpforms-pagebreak-buttons-center wpforms-pagebreak-buttons-left wpforms-pagebreak-buttons-right wpforms-pagebreak-buttons-split' )
[2697] Fix | Delete
.addClass( 'wpforms-pagebreak-buttons-' + value );
[2698] Fix | Delete
} );
[2699] Fix | Delete
[2700] Fix | Delete
// Real-time updates for Single Item field "Item Price" option.
[2701] Fix | Delete
$builder.on( 'input', '.wpforms-field-option-row-price input', function() {
[2702] Fix | Delete
const $this = $( this ),
[2703] Fix | Delete
value = $this.val(),
[2704] Fix | Delete
formatted = wpf.amountFormat( wpf.amountSanitize( value ) ),
[2705] Fix | Delete
id = $this.parent().data( 'field-id' ),
[2706] Fix | Delete
placeholder = $( '#wpforms-field-option-' + id + '-placeholder' ).val().trim(),
[2707] Fix | Delete
$preview = $( '#wpforms-field-' + id ),
[2708] Fix | Delete
newValue = value === '' && placeholder !== '' ? '' : formatted;
[2709] Fix | Delete
[2710] Fix | Delete
$preview.find( '.primary-input' ).val( newValue );
[2711] Fix | Delete
$preview.find( '.price' ).text( wpf.amountFormatCurrency( value ) );
[2712] Fix | Delete
} );
[2713] Fix | Delete
[2714] Fix | Delete
// Real-time updates for Single Item field "Minimum Price" option.
[2715] Fix | Delete
$builder.on( 'input', '.wpforms-field-option-row-min_price input', function() {
[2716] Fix | Delete
const $this = $( this ),
[2717] Fix | Delete
amount = $this.val(),
[2718] Fix | Delete
sanitized = wpf.amountSanitize( amount ),
[2719] Fix | Delete
isEmpty = sanitized <= 0,
[2720] Fix | Delete
isValid = sanitized >= $this.data( 'minimum-price' ),
[2721] Fix | Delete
$fieldOptionRow = $this.parent(),
[2722] Fix | Delete
$preview = $( '#wpforms-field-' + $fieldOptionRow.data( 'field-id' ) );
[2723] Fix | Delete
[2724] Fix | Delete
$fieldOptionRow.find( '.wpforms-item-minimum-price-alert' ).toggleClass( 'wpforms-hidden', isValid );
[2725] Fix | Delete
$preview.find( '.item-min-price' ).toggleClass( 'wpforms-hidden', isEmpty );
[2726] Fix | Delete
$preview.toggleClass( 'min-price-warning', ! isValid );
[2727] Fix | Delete
$preview.find( '.fa-exclamation-triangle' ).toggleClass( 'wpforms-hidden', isValid );
[2728] Fix | Delete
[2729] Fix | Delete
if ( isEmpty ) {
[2730] Fix | Delete
return;
[2731] Fix | Delete
}
[2732] Fix | Delete
[2733] Fix | Delete
$preview.find( '.min-price' ).text( wpf.amountFormatCurrency( amount ) );
[2734] Fix | Delete
} );
[2735] Fix | Delete
[2736] Fix | Delete
// Real-time updates for price label for single item field.
[2737] Fix | Delete
$builder.on( 'input', '.wpforms-single-item-price-label-display', function() {
[2738] Fix | Delete
const $this = $( this ),
[2739] Fix | Delete
value = wpf.sanitizeHTML( $this.val(), '<>' ),
[2740] Fix | Delete
id = $this.parent().data( 'field-id' ),
[2741] Fix | Delete
$preview = $( `#wpforms-field-${ id }` ),
[2742] Fix | Delete
$price = wpf.amountFormatCurrency( $( `#wpforms-field-option-${ id }-price` ).val() );
[2743] Fix | Delete
[2744] Fix | Delete
if ( ! value ) {
[2745] Fix | Delete
$this.val( '{price}' );
[2746] Fix | Delete
$preview.find( '.price-label' ).html( `<span class="price"> ${ $price } </span>` );
[2747] Fix | Delete
return;
[2748] Fix | Delete
}
[2749] Fix | Delete
[2750] Fix | Delete
$preview.find( '.price-label' ).html( value.replaceAll( '{price}', `<span class="price"> ${ $price } </span>` ) );
[2751] Fix | Delete
} );
[2752] Fix | Delete
[2753] Fix | Delete
// Real-time updates for payment CC icons
[2754] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-credit-card .payment-icons input', function() {
[2755] Fix | Delete
const $this = $( this ),
[2756] Fix | Delete
card = $this.data( 'card' ),
[2757] Fix | Delete
id = $this.parent().data( 'field-id' );
[2758] Fix | Delete
[2759] Fix | Delete
$( '#wpforms-field-' + id ).find( 'img.icon-' + card ).toggleClass( 'card_hide' );
[2760] Fix | Delete
} );
[2761] Fix | Delete
[2762] Fix | Delete
// Generic updates for various additional placeholder fields (at least Stripe's "Name on Card").
[2763] Fix | Delete
$builder.on( 'input', '.wpforms-field-option input.placeholder-update', function( e ) { // eslint-disable-line no-unused-vars
[2764] Fix | Delete
const $this = $( this ),
[2765] Fix | Delete
value = $this.val(),
[2766] Fix | Delete
id = $this.data( 'field-id' ),
[2767] Fix | Delete
subfield = $this.data( 'subfield' );
[2768] Fix | Delete
[2769] Fix | Delete
$( '#wpforms-field-' + id ).find( '.wpforms-' + subfield + ' input' ).attr( 'placeholder', value );
[2770] Fix | Delete
} );
[2771] Fix | Delete
[2772] Fix | Delete
// Toggle Choice Layout advanced field option.
[2773] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-input_columns select', function() {
[2774] Fix | Delete
const $this = $( this ),
[2775] Fix | Delete
value = $this.val(),
[2776] Fix | Delete
id = $this.parent().data( 'field-id' );
[2777] Fix | Delete
[2778] Fix | Delete
let cls = '';
[2779] Fix | Delete
[2780] Fix | Delete
if ( value === '2' ) {
[2781] Fix | Delete
cls = 'wpforms-list-2-columns';
[2782] Fix | Delete
} else if ( value === '3' ) {
[2783] Fix | Delete
cls = 'wpforms-list-3-columns';
[2784] Fix | Delete
} else if ( value === 'inline' ) {
[2785] Fix | Delete
cls = 'wpforms-list-inline';
[2786] Fix | Delete
}
[2787] Fix | Delete
[2788] Fix | Delete
$( '#wpforms-field-' + id ).removeClass( 'wpforms-list-2-columns wpforms-list-3-columns wpforms-list-inline' ).addClass( cls );
[2789] Fix | Delete
} );
[2790] Fix | Delete
[2791] Fix | Delete
// Toggle the toggle field.
[2792] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row .wpforms-toggle-control input', function( e ) { // eslint-disable-line no-unused-vars
[2793] Fix | Delete
const $check = $( this ),
[2794] Fix | Delete
$control = $check.closest( '.wpforms-toggle-control' ),
[2795] Fix | Delete
$status = $control.find( '.wpforms-toggle-control-status' ),
[2796] Fix | Delete
state = $check.is( ':checked' ) ? 'on' : 'off';
[2797] Fix | Delete
[2798] Fix | Delete
$status.html( $status.data( state ) );
[2799] Fix | Delete
} );
[2800] Fix | Delete
[2801] Fix | Delete
// Real-time updates for "Dynamic Choices" field option, for Dropdown,
[2802] Fix | Delete
// Checkboxes, and Multiple choice fields
[2803] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-dynamic_choices select', function( e ) { // eslint-disable-line no-unused-vars
[2804] Fix | Delete
app.fieldDynamicChoiceToggle( $( this ) );
[2805] Fix | Delete
} );
[2806] Fix | Delete
[2807] Fix | Delete
// Real-time updates for "Dynamic [type] Source" field option, for Dropdown,
[2808] Fix | Delete
// Checkboxes, and Multiple choice fields
[2809] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-dynamic_taxonomy select, .wpforms-field-option-row-dynamic_post_type select', function( e ) { // eslint-disable-line no-unused-vars
[2810] Fix | Delete
app.fieldDynamicChoiceSource( $( this ) );
[2811] Fix | Delete
} );
[2812] Fix | Delete
[2813] Fix | Delete
// Toggle Layout selector
[2814] Fix | Delete
$builder.on( 'click', '.toggle-layout-selector-display', function( e ) {
[2815] Fix | Delete
e.preventDefault();
[2816] Fix | Delete
app.fieldLayoutSelectorToggle( this );
[2817] Fix | Delete
} );
[2818] Fix | Delete
$builder.on( 'click', '.layout-selector-display-layout', function( e ) {
[2819] Fix | Delete
e.preventDefault();
[2820] Fix | Delete
app.fieldLayoutSelectorLayout( this );
[2821] Fix | Delete
} );
[2822] Fix | Delete
$builder.on( 'click', '.layout-selector-display-columns span', function( e ) {
[2823] Fix | Delete
e.preventDefault();
[2824] Fix | Delete
app.fieldLayoutSelectorInsert( this );
[2825] Fix | Delete
} );
[2826] Fix | Delete
[2827] Fix | Delete
// Real-time updates for a Rating field scale option.
[2828] Fix | Delete
$( document ).on( 'change', '.wpforms-field-option-row-scale select', function() {
[2829] Fix | Delete
const $this = $( this ),
[2830] Fix | Delete
value = $this.val(),
[2831] Fix | Delete
id = $this.parent().data( 'field-id' ),
[2832] Fix | Delete
$icons = $( '#wpforms-field-' + id + ' .rating-icon' );
[2833] Fix | Delete
[2834] Fix | Delete
let x = 1;
[2835] Fix | Delete
[2836] Fix | Delete
$icons.each( function( index ) { // eslint-disable-line no-unused-vars
[2837] Fix | Delete
if ( x <= value ) {
[2838] Fix | Delete
$( this ).show();
[2839] Fix | Delete
} else {
[2840] Fix | Delete
$( this ).hide();
[2841] Fix | Delete
}
[2842] Fix | Delete
x++;
[2843] Fix | Delete
} );
[2844] Fix | Delete
} );
[2845] Fix | Delete
[2846] Fix | Delete
// Real-time updates for a Rating field icon option.
[2847] Fix | Delete
$( document ).on( 'change', '.wpforms-field-option-row-icon select', function() {
[2848] Fix | Delete
const $this = $( this ),
[2849] Fix | Delete
value = $this.val(),
[2850] Fix | Delete
id = $this.parent().data( 'field-id' ),
[2851] Fix | Delete
$icons = $( '#wpforms-field-' + id + ' .rating-icon' );
[2852] Fix | Delete
[2853] Fix | Delete
let iconClass = 'fa-star';
[2854] Fix | Delete
[2855] Fix | Delete
if ( 'heart' === value ) {
[2856] Fix | Delete
iconClass = 'fa-heart';
[2857] Fix | Delete
} else if ( 'thumb' === value ) {
[2858] Fix | Delete
iconClass = 'fa-thumbs-up';
[2859] Fix | Delete
} else if ( 'smiley' === value ) {
[2860] Fix | Delete
iconClass = 'fa-smile-o';
[2861] Fix | Delete
}
[2862] Fix | Delete
[2863] Fix | Delete
$icons.removeClass( 'fa-star fa-heart fa-thumbs-up fa-smile-o' ).addClass( iconClass );
[2864] Fix | Delete
} );
[2865] Fix | Delete
[2866] Fix | Delete
// Real-time updates for a Rating field icon size option.
[2867] Fix | Delete
$( document ).on( 'change', '.wpforms-field-option-row-icon_size select', function() {
[2868] Fix | Delete
const $this = $( this ),
[2869] Fix | Delete
value = $this.val(),
[2870] Fix | Delete
id = $this.parent().data( 'field-id' ),
[2871] Fix | Delete
$icons = $( '#wpforms-field-' + id + ' .rating-icon' );
[2872] Fix | Delete
[2873] Fix | Delete
let fontSize = '28';
[2874] Fix | Delete
[2875] Fix | Delete
if ( 'small' === value ) {
[2876] Fix | Delete
fontSize = '18';
[2877] Fix | Delete
} else if ( 'large' === value ) {
[2878] Fix | Delete
fontSize = '38';
[2879] Fix | Delete
}
[2880] Fix | Delete
[2881] Fix | Delete
$icons.css( 'font-size', fontSize + 'px' );
[2882] Fix | Delete
} );
[2883] Fix | Delete
[2884] Fix | Delete
// Real-time updates for a Rating field icon color option.
[2885] Fix | Delete
$( document ).on( 'input', '.wpforms-field-option-row-icon_color input.wpforms-color-picker', function() {
[2886] Fix | Delete
const $this = $( this ),
[2887] Fix | Delete
id = $this.closest( '.wpforms-field-option-row' ).data( 'field-id' ),
[2888] Fix | Delete
$icons = $( '#wpforms-field-' + id + ' > i.fa' );
[2889] Fix | Delete
[2890] Fix | Delete
$icons.css( 'color', app.getValidColorPickerValue( $this ) );
[2891] Fix | Delete
} );
[2892] Fix | Delete
[2893] Fix | Delete
// Real-time updates for a Checkbox field Disclaimer option.
[2894] Fix | Delete
$( document ).on( 'change', '.wpforms-field-option-row-disclaimer_format input', function() {
[2895] Fix | Delete
const $this = $( this ),
[2896] Fix | Delete
id = $this.closest( '.wpforms-field-option-row' ).data( 'field-id' ),
[2897] Fix | Delete
$desc = $( '#wpforms-field-' + id + ' .description' );
[2898] Fix | Delete
[2899] Fix | Delete
$desc.toggleClass( 'disclaimer' );
[2900] Fix | Delete
} );
[2901] Fix | Delete
[2902] Fix | Delete
$builder.on(
[2903] Fix | Delete
'change',
[2904] Fix | Delete
'.wpforms-field-option-row-limit_enabled input',
[2905] Fix | Delete
function( event ) {
[2906] Fix | Delete
app.updateTextFieldsLimitControls( $( event.target ).closest( '.wpforms-field-option-row-limit_enabled' ).data().fieldId, event.target.checked );
[2907] Fix | Delete
}
[2908] Fix | Delete
);
[2909] Fix | Delete
[2910] Fix | Delete
$builder.on(
[2911] Fix | Delete
'change',
[2912] Fix | Delete
'.wpforms-field-option-row-date_disable_past_dates input',
[2913] Fix | Delete
function( event ) {
[2914] Fix | Delete
app.updateDisableTodaysDateControls( $( event.target ).closest( '.wpforms-field-option-row-date_disable_past_dates' ).data().fieldId, event.target?.checked );
[2915] Fix | Delete
}
[2916] Fix | Delete
);
[2917] Fix | Delete
[2918] Fix | Delete
$builder.on(
[2919] Fix | Delete
'change',
[2920] Fix | Delete
'.wpforms-field-option-row-password-strength input',
[2921] Fix | Delete
function( event ) {
[2922] Fix | Delete
app.updatePasswordStrengthControls( $( event.target ).parents( '.wpforms-field-option-row-password-strength' ).data().fieldId, event.target.checked );
[2923] Fix | Delete
}
[2924] Fix | Delete
);
[2925] Fix | Delete
[2926] Fix | Delete
$builder.on(
[2927] Fix | Delete
'change',
[2928] Fix | Delete
'.wpforms-field-option-richtext .wpforms-field-option-row-media_enabled input',
[2929] Fix | Delete
app.updateRichTextMediaFieldsLimitControls
[2930] Fix | Delete
);
[2931] Fix | Delete
[2932] Fix | Delete
$builder.on(
[2933] Fix | Delete
'change',
[2934] Fix | Delete
'.wpforms-field-option-richtext .wpforms-field-option-row-style select',
[2935] Fix | Delete
app.updateRichTextStylePreview
[2936] Fix | Delete
);
[2937] Fix | Delete
[2938] Fix | Delete
// File uploader - change style.
[2939] Fix | Delete
$builder
[2940] Fix | Delete
.on(
[2941] Fix | Delete
'change',
[2942] Fix | Delete
'.wpforms-field-option-file-upload .wpforms-field-option-row-style select, .wpforms-field-option-file-upload .wpforms-field-option-row-max_file_number input',
[2943] Fix | Delete
function( event ) {
[2944] Fix | Delete
app.fieldFileUploadPreviewUpdate( event.target );
[2945] Fix | Delete
}
[2946] Fix | Delete
);
[2947] Fix | Delete
[2948] Fix | Delete
// Real-time updates for Number Slider field.
[2949] Fix | Delete
app.numberSliderEvents( $builder );
[2950] Fix | Delete
[2951] Fix | Delete
// Hide image and icon choices if dynamic choices are not off.
[2952] Fix | Delete
app.fieldDynamicChoiceToggleImageChoices();
[2953] Fix | Delete
app.fieldDynamicChoiceToggleIconChoices();
[2954] Fix | Delete
[2955] Fix | Delete
// Real-time updates for Payment field's 'Show price after item label' option.
[2956] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-show_price_after_labels input', function( e ) { // eslint-disable-line no-unused-vars
[2957] Fix | Delete
const $input = $( this ),
[2958] Fix | Delete
$list = $input.closest( '.wpforms-field-option-group-basic' ).find( '.wpforms-field-option-row-choices .choices-list' );
[2959] Fix | Delete
[2960] Fix | Delete
app.fieldChoiceUpdate( $list.data( 'field-type' ), $list.data( 'field-id' ) );
[2961] Fix | Delete
} );
[2962] Fix | Delete
[2963] Fix | Delete
$builder
[2964] Fix | Delete
.on( 'input', '.wpforms-field-option-row-preview-notice textarea', app.updatePreviewNotice )
[2965] Fix | Delete
.on( 'change', '.wpforms-field-option-row-preview-notice-enable input', app.toggleEntryPreviewNotice )
[2966] Fix | Delete
.on( 'wpformsFieldAdd', app.maybeLockEntryPreviewGroupOnAdd )
[2967] Fix | Delete
.on( 'wpformsFieldMove', app.maybeLockEntryPreviewGroupOnMove )
[2968] Fix | Delete
.on( 'click', '.wpforms-entry-preview-block', app.entryPreviewBlockField );
[2969] Fix | Delete
[2970] Fix | Delete
app.defaultStateEntryPreviewNotice();
[2971] Fix | Delete
},
[2972] Fix | Delete
[2973] Fix | Delete
/**
[2974] Fix | Delete
* Check if we had focusout event from certain fields.
[2975] Fix | Delete
*
[2976] Fix | Delete
* @since 1.7.5
[2977] Fix | Delete
*/
[2978] Fix | Delete
focusOutEvent() {
[2979] Fix | Delete
if ( elements.$focusOutTarget === null ) {
[2980] Fix | Delete
return;
[2981] Fix | Delete
}
[2982] Fix | Delete
[2983] Fix | Delete
if ( elements.$defaultEmail.is( elements.$focusOutTarget ) ) {
[2984] Fix | Delete
const $field = elements.$focusOutTarget;
[2985] Fix | Delete
[2986] Fix | Delete
if ( $field.val() === '' ) {
[2987] Fix | Delete
return;
[2988] Fix | Delete
}
[2989] Fix | Delete
[2990] Fix | Delete
$.get(
[2991] Fix | Delete
wpforms_builder.ajax_url,
[2992] Fix | Delete
{
[2993] Fix | Delete
nonce: wpforms_builder.nonce,
[2994] Fix | Delete
content: $field.val(),
[2995] Fix | Delete
action: 'wpforms_sanitize_default_email',
[2996] Fix | Delete
},
[2997] Fix | Delete
function( res ) {
[2998] Fix | Delete
if ( res.success ) {
[2999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function