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
[8000] Fix | Delete
// Set layout to inline on activation, revert to one column on deactivation.
[8001] Fix | Delete
$fieldOptions.find( `#wpforms-field-option-${ fieldID }-input_columns` ).val( checked ? 'inline' : '' ).trigger( 'change' );
[8002] Fix | Delete
[8003] Fix | Delete
// Finally, update the preview.
[8004] Fix | Delete
app.fieldChoiceUpdate( $fieldOptions.find( '.wpforms-field-option-hidden-type' ).val(), fieldID );
[8005] Fix | Delete
},
[8006] Fix | Delete
[8007] Fix | Delete
/**
[8008] Fix | Delete
* Change accent color and update previews.
[8009] Fix | Delete
*
[8010] Fix | Delete
* @since 1.7.9
[8011] Fix | Delete
*/
[8012] Fix | Delete
changeIconsColor() {
[8013] Fix | Delete
const $this = $( this ),
[8014] Fix | Delete
fieldID = $this.parents( '.wpforms-field-option-row' ).data( 'field-id' ),
[8015] Fix | Delete
$field = $( '#wpforms-field-option-' + fieldID ),
[8016] Fix | Delete
type = $field.find( '.wpforms-field-option-hidden-type' ).val(),
[8017] Fix | Delete
$choicesList = $field.find( '.wpforms-field-option-row-choices .choices-list' ),
[8018] Fix | Delete
colorValue = app.getValidColorPickerValue( $this );
[8019] Fix | Delete
[8020] Fix | Delete
// Update icons color in options panel.
[8021] Fix | Delete
$choicesList.prop( 'style', `${ app.iconChoices.config.colorPropertyName }: ${ colorValue };` );
[8022] Fix | Delete
[8023] Fix | Delete
// Update preview.
[8024] Fix | Delete
app.fieldChoiceUpdate( type, fieldID );
[8025] Fix | Delete
},
[8026] Fix | Delete
[8027] Fix | Delete
/**
[8028] Fix | Delete
* Open a modal prompting to install the icon library for Icon Choices.
[8029] Fix | Delete
*
[8030] Fix | Delete
* @since 1.7.9
[8031] Fix | Delete
*
[8032] Fix | Delete
* @param {boolean} force Whether it's a normal installation procedure or forced if the library is needed but is missing.
[8033] Fix | Delete
*/
[8034] Fix | Delete
openInstallPromptModal( force = false ) {
[8035] Fix | Delete
const content = force
[8036] Fix | Delete
? wpforms_builder.icon_choices.strings.reinstall_prompt_content
[8037] Fix | Delete
: wpforms_builder.icon_choices.strings.install_prompt_content;
[8038] Fix | Delete
[8039] Fix | Delete
const modal = $.confirm( {
[8040] Fix | Delete
title: wpforms_builder.heads_up,
[8041] Fix | Delete
content,
[8042] Fix | Delete
icon: 'fa fa-info-circle',
[8043] Fix | Delete
type: 'orange',
[8044] Fix | Delete
buttons: {
[8045] Fix | Delete
continue: {
[8046] Fix | Delete
text: wpforms_builder.continue,
[8047] Fix | Delete
btnClass: 'btn-confirm',
[8048] Fix | Delete
keys: [ 'enter' ],
[8049] Fix | Delete
action() {
[8050] Fix | Delete
this.setIcon( 'fa fa-cloud-download' );
[8051] Fix | Delete
this.setTitle( wpforms_builder.icon_choices.strings.install_title );
[8052] Fix | Delete
this.setContent( wpforms_builder.icon_choices.strings.install_content );
[8053] Fix | Delete
[8054] Fix | Delete
$.each( this.buttons, function( _index, button ) {
[8055] Fix | Delete
button.hide();
[8056] Fix | Delete
} );
[8057] Fix | Delete
[8058] Fix | Delete
app.iconChoices.installIconLibrary();
[8059] Fix | Delete
[8060] Fix | Delete
// Do not close the modal.
[8061] Fix | Delete
return false;
[8062] Fix | Delete
},
[8063] Fix | Delete
},
[8064] Fix | Delete
},
[8065] Fix | Delete
onOpen() {
[8066] Fix | Delete
// Turn the toggle off during normal installation.
[8067] Fix | Delete
if ( ! force && app.iconChoices.cache.toggle ) {
[8068] Fix | Delete
app.iconChoices.cache.toggle.prop( 'checked', false );
[8069] Fix | Delete
}
[8070] Fix | Delete
[8071] Fix | Delete
app.iconChoices.cache.previousModal = this;
[8072] Fix | Delete
},
[8073] Fix | Delete
} );
[8074] Fix | Delete
[8075] Fix | Delete
// Add a Cancel button for normal installation routine only.
[8076] Fix | Delete
if ( ! force ) {
[8077] Fix | Delete
modal.buttons.cancel = {
[8078] Fix | Delete
text: wpforms_builder.cancel,
[8079] Fix | Delete
keys: [ 'esc' ],
[8080] Fix | Delete
action() {
[8081] Fix | Delete
app.iconChoices.cache.toggle.prop( 'checked', false );
[8082] Fix | Delete
},
[8083] Fix | Delete
};
[8084] Fix | Delete
}
[8085] Fix | Delete
},
[8086] Fix | Delete
[8087] Fix | Delete
/**
[8088] Fix | Delete
* Silently download and install the icon library on the server.
[8089] Fix | Delete
*
[8090] Fix | Delete
* @since 1.7.9
[8091] Fix | Delete
*/
[8092] Fix | Delete
installIconLibrary() {
[8093] Fix | Delete
const data = {
[8094] Fix | Delete
// eslint-disable-next-line camelcase
[8095] Fix | Delete
_wp_http_referer: wpf.updateQueryString( '_wp_http_referer', null ),
[8096] Fix | Delete
nonce: wpforms_builder.nonce,
[8097] Fix | Delete
action: 'wpforms_icon_choices_install',
[8098] Fix | Delete
};
[8099] Fix | Delete
[8100] Fix | Delete
$.ajaxSetup( {
[8101] Fix | Delete
type: 'POST',
[8102] Fix | Delete
timeout: 120000, // 2 minutes.
[8103] Fix | Delete
} );
[8104] Fix | Delete
[8105] Fix | Delete
$.post( wpforms_builder.ajax_url, data, function( response ) {
[8106] Fix | Delete
// eslint-disable-next-line no-unused-expressions
[8107] Fix | Delete
response.success
[8108] Fix | Delete
? app.iconChoices.openInstallSuccessModal()
[8109] Fix | Delete
: app.iconChoices.openInstallErrorModal( response );
[8110] Fix | Delete
} ).fail( function( jqXHR ) {
[8111] Fix | Delete
app.iconChoices.openInstallErrorModal( jqXHR );
[8112] Fix | Delete
} );
[8113] Fix | Delete
},
[8114] Fix | Delete
[8115] Fix | Delete
/**
[8116] Fix | Delete
* Open a modal on icon library installation success.
[8117] Fix | Delete
*
[8118] Fix | Delete
* @since 1.7.9
[8119] Fix | Delete
*/
[8120] Fix | Delete
openInstallSuccessModal() {
[8121] Fix | Delete
$.confirm( {
[8122] Fix | Delete
title: wpforms_builder.done,
[8123] Fix | Delete
content: wpforms_builder.icon_choices.strings.install_success_content,
[8124] Fix | Delete
icon: 'fa fa-check-circle',
[8125] Fix | Delete
type: 'green',
[8126] Fix | Delete
buttons: {
[8127] Fix | Delete
confirm: {
[8128] Fix | Delete
text: wpforms_builder.ok,
[8129] Fix | Delete
btnClass: 'btn-confirm',
[8130] Fix | Delete
keys: [ 'enter' ],
[8131] Fix | Delete
action() {
[8132] Fix | Delete
if ( app.iconChoices.cache.toggle ) {
[8133] Fix | Delete
app.iconChoices.cache.toggle.prop( 'checked', true );
[8134] Fix | Delete
[8135] Fix | Delete
const fieldId = app.iconChoices.cache.toggle.parents( '.wpforms-field-option-row' ).data( 'field-id' );
[8136] Fix | Delete
const $imageChoices = $builder.find( `#wpforms-field-option-${ fieldId }-choices_images` );
[8137] Fix | Delete
[8138] Fix | Delete
// Turn Image Choice off, if needed, without triggering change event.
[8139] Fix | Delete
if ( $imageChoices.is( ':checked' ) ) {
[8140] Fix | Delete
$imageChoices.prop( 'checked', false );
[8141] Fix | Delete
}
[8142] Fix | Delete
}
[8143] Fix | Delete
[8144] Fix | Delete
app.formSave( false ).done( function() {
[8145] Fix | Delete
window.location.reload();
[8146] Fix | Delete
} );
[8147] Fix | Delete
},
[8148] Fix | Delete
},
[8149] Fix | Delete
},
[8150] Fix | Delete
onOpen() {
[8151] Fix | Delete
if ( app.iconChoices.cache.toggle ) {
[8152] Fix | Delete
const fieldId = app.iconChoices.cache.toggle.parents( '.wpforms-field-option-row-choices_icons' ).data( 'field-id' );
[8153] Fix | Delete
[8154] Fix | Delete
$builder.find( `#wpforms-field-option-${ fieldId }-input_columns` ).val( 'inline' );
[8155] Fix | Delete
}
[8156] Fix | Delete
[8157] Fix | Delete
app.iconChoices.cache.previousModal.close();
[8158] Fix | Delete
},
[8159] Fix | Delete
} );
[8160] Fix | Delete
},
[8161] Fix | Delete
[8162] Fix | Delete
/**
[8163] Fix | Delete
* Open a modal on icon library installation failure.
[8164] Fix | Delete
*
[8165] Fix | Delete
* @since 1.7.9
[8166] Fix | Delete
*
[8167] Fix | Delete
* @param {Object} errorData Unsuccessful ajax JSON response or jqXHR object.
[8168] Fix | Delete
*/
[8169] Fix | Delete
openInstallErrorModal( errorData ) {
[8170] Fix | Delete
$.confirm( {
[8171] Fix | Delete
title: wpforms_builder.uh_oh,
[8172] Fix | Delete
content: wpforms_builder.icon_choices.strings.install_error_content,
[8173] Fix | Delete
icon: 'fa fa-exclamation-circle',
[8174] Fix | Delete
type: 'red',
[8175] Fix | Delete
buttons: {
[8176] Fix | Delete
confirm: {
[8177] Fix | Delete
text: wpforms_builder.ok,
[8178] Fix | Delete
btnClass: 'btn-confirm',
[8179] Fix | Delete
keys: [ 'enter' ],
[8180] Fix | Delete
action() {
[8181] Fix | Delete
if ( app.iconChoices.cache.toggle ) {
[8182] Fix | Delete
app.iconChoices.cache.toggle.prop( 'checked', false );
[8183] Fix | Delete
} else {
[8184] Fix | Delete
app.formSaveError();
[8185] Fix | Delete
}
[8186] Fix | Delete
},
[8187] Fix | Delete
},
[8188] Fix | Delete
},
[8189] Fix | Delete
onOpen() {
[8190] Fix | Delete
wpf.debug( errorData );
[8191] Fix | Delete
app.iconChoices.cache.previousModal.close();
[8192] Fix | Delete
},
[8193] Fix | Delete
onDestroy() {
[8194] Fix | Delete
// Clean up the cache, we're done.
[8195] Fix | Delete
delete app.iconChoices.cache.previousModal;
[8196] Fix | Delete
delete app.iconChoices.cache.toggle;
[8197] Fix | Delete
},
[8198] Fix | Delete
} );
[8199] Fix | Delete
},
[8200] Fix | Delete
[8201] Fix | Delete
/**
[8202] Fix | Delete
* Extend jquery-confirm plugin with support of max-height for the content area.
[8203] Fix | Delete
*
[8204] Fix | Delete
* @since 1.7.9
[8205] Fix | Delete
*/
[8206] Fix | Delete
extendJqueryConfirm() {
[8207] Fix | Delete
// Extend a method of global instance.
[8208] Fix | Delete
window.Jconfirm.prototype._updateContentMaxHeight = function() { // noinspection JSUnusedGlobalSymbols
[8209] Fix | Delete
const height = $( window ).height() - ( this.$jconfirmBox.outerHeight() - this.$contentPane.outerHeight() ) - ( this.offsetTop + this.offsetBottom );
[8210] Fix | Delete
[8211] Fix | Delete
// Custom property, if set via jquery-confirm options.
[8212] Fix | Delete
const maxHeight = this.contentMaxHeight || height;
[8213] Fix | Delete
[8214] Fix | Delete
this.$contentPane.css( {
[8215] Fix | Delete
'max-height': Math.min( maxHeight, height ) + 'px',
[8216] Fix | Delete
} );
[8217] Fix | Delete
};
[8218] Fix | Delete
},
[8219] Fix | Delete
[8220] Fix | Delete
/**
[8221] Fix | Delete
* Open Icon Picker modal.
[8222] Fix | Delete
*
[8223] Fix | Delete
* @since 1.7.9
[8224] Fix | Delete
*/
[8225] Fix | Delete
openIconPickerModal() {
[8226] Fix | Delete
const $this = $( this );
[8227] Fix | Delete
[8228] Fix | Delete
const data = {
[8229] Fix | Delete
fieldId: $this.parents( '.wpforms-field-option-row' ).data( 'field-id' ),
[8230] Fix | Delete
choiceId: $this.parent().data( 'key' ),
[8231] Fix | Delete
selectedIcon: $this.find( '.source-icon' ).val(),
[8232] Fix | Delete
selectedIconStyle: $this.find( '.source-icon-style' ).val(),
[8233] Fix | Delete
};
[8234] Fix | Delete
[8235] Fix | Delete
const title = `
[8236] Fix | Delete
${ wpforms_builder.icon_choices.strings.icon_picker_title }
[8237] Fix | Delete
<span class="wpforms-icon-picker-description">${ wpforms_builder.icon_choices.strings.icon_picker_description }</span>
[8238] Fix | Delete
<input type="text" placeholder="${ wpforms_builder.icon_choices.strings.icon_picker_search_placeholder }" class="search" id="wpforms-icon-picker-search">
[8239] Fix | Delete
`;
[8240] Fix | Delete
[8241] Fix | Delete
const content = `
[8242] Fix | Delete
<div class="wpforms-icon-picker-container" id="wpforms-icon-picker-icons">
[8243] Fix | Delete
<ul class="wpforms-icon-picker-icons" data-field-id="${ data.fieldId }" data-choice-id="${ data.choiceId }"></ul>
[8244] Fix | Delete
<ul class="wpforms-icon-picker-pagination"></ul>
[8245] Fix | Delete
<p class="wpforms-icon-picker-not-found wpforms-hidden" data-message="${ wpforms_builder.icon_choices.strings.icon_picker_not_found }"></>
[8246] Fix | Delete
</div>`;
[8247] Fix | Delete
[8248] Fix | Delete
$.confirm( {
[8249] Fix | Delete
title,
[8250] Fix | Delete
titleClass: 'wpforms-icon-picker-title',
[8251] Fix | Delete
content,
[8252] Fix | Delete
icon: false,
[8253] Fix | Delete
closeIcon: true,
[8254] Fix | Delete
type: 'orange',
[8255] Fix | Delete
backgroundDismiss: true,
[8256] Fix | Delete
boxWidth: 800,
[8257] Fix | Delete
contentMaxHeight: 368, // Custom property, see app.iconChoices.extendJqueryConfirm().
[8258] Fix | Delete
smoothContent: false,
[8259] Fix | Delete
buttons: false,
[8260] Fix | Delete
onOpenBefore() {
[8261] Fix | Delete
// Add custom classes to target various elements.
[8262] Fix | Delete
this.$body.addClass( 'wpforms-icon-picker-jconfirm-box' );
[8263] Fix | Delete
this.$contentPane.addClass( 'wpforms-icon-picker-jconfirm-content-pane' );
[8264] Fix | Delete
},
[8265] Fix | Delete
onContentReady() {
[8266] Fix | Delete
const modal = this;
[8267] Fix | Delete
[8268] Fix | Delete
// Initialize the list of icons with List.js and display the 1st page.
[8269] Fix | Delete
app.iconChoices.initIconsList( data );
[8270] Fix | Delete
[8271] Fix | Delete
// Focus the search input.
[8272] Fix | Delete
modal.$title.find( '.search' ).focus();
[8273] Fix | Delete
[8274] Fix | Delete
// Listen for clicks on icons to select them.
[8275] Fix | Delete
modal.$content.find( '.wpforms-icon-picker-icons' ).on( 'click', 'li', function() {
[8276] Fix | Delete
app.iconChoices.selectIcon( modal, $( this ) );
[8277] Fix | Delete
} );
[8278] Fix | Delete
},
[8279] Fix | Delete
} );
[8280] Fix | Delete
},
[8281] Fix | Delete
[8282] Fix | Delete
/**
[8283] Fix | Delete
* Initialize List.js in the Icon Selector modal on demand and cache it.
[8284] Fix | Delete
*
[8285] Fix | Delete
* @since 1.7.9
[8286] Fix | Delete
*
[8287] Fix | Delete
* @param {Object} data Source option data - field and choice IDs, selected icon name and style.
[8288] Fix | Delete
*/
[8289] Fix | Delete
initIconsList( data ) {
[8290] Fix | Delete
const options = {
[8291] Fix | Delete
valueNames: [ 'name' ],
[8292] Fix | Delete
listClass: 'wpforms-icon-picker-icons',
[8293] Fix | Delete
page: wpforms_builder.icon_choices.icons_per_page,
[8294] Fix | Delete
pagination: {
[8295] Fix | Delete
paginationClass: 'wpforms-icon-picker-pagination',
[8296] Fix | Delete
},
[8297] Fix | Delete
item( values ) {
[8298] Fix | Delete
const maybeSelectedClass = ( values.icon === data.selectedIcon && values.style === data.selectedIconStyle ) ? 'class="selected"' : '';
[8299] Fix | Delete
[8300] Fix | Delete
return `
[8301] Fix | Delete
<li data-icon="${ values.icon }" data-icon-style="${ values.style }"${ maybeSelectedClass }>
[8302] Fix | Delete
<i class="ic-fa-${ values.style } ic-fa-${ values.icon }"></i>
[8303] Fix | Delete
<span class="name">${ values.icon }</span>
[8304] Fix | Delete
</li>`;
[8305] Fix | Delete
},
[8306] Fix | Delete
indexAsync: true,
[8307] Fix | Delete
};
[8308] Fix | Delete
[8309] Fix | Delete
// Initialize List.js instance.
[8310] Fix | Delete
const iconsList = new List( 'wpforms-icon-picker-icons', options, wpforms_builder.icon_choices.icons );
[8311] Fix | Delete
[8312] Fix | Delete
// Initialize infinite scroll pagination on the list instance.
[8313] Fix | Delete
app.iconChoices.infiniteScrollPagination( iconsList );
[8314] Fix | Delete
[8315] Fix | Delete
// Bind search to custom input.
[8316] Fix | Delete
$( '#wpforms-icon-picker-search' ).on( 'keyup', function() {
[8317] Fix | Delete
// Custom partial match search.
[8318] Fix | Delete
iconsList.search( $( this ).val(), [ 'name' ], function( searchString, columns ) { // eslint-disable-line no-unused-vars
[8319] Fix | Delete
for ( let index = 0, length = iconsList.items.length; index < length; index++ ) {
[8320] Fix | Delete
iconsList.items[ index ].found = ( new RegExp( searchString ) ).test( iconsList.items[ index ].values().icon );
[8321] Fix | Delete
}
[8322] Fix | Delete
} );
[8323] Fix | Delete
} );
[8324] Fix | Delete
[8325] Fix | Delete
// Show "nothing found" message if the search returned no results.
[8326] Fix | Delete
iconsList.on( 'searchComplete', function() {
[8327] Fix | Delete
const $element = $( '.wpforms-icon-picker-not-found' );
[8328] Fix | Delete
[8329] Fix | Delete
$element.html( $element.data( 'message' ).replace( '{keyword}', $( '#wpforms-icon-picker-search' ).val() ) );
[8330] Fix | Delete
$element.toggleClass( 'wpforms-hidden', ! _.isEmpty( iconsList.matchingItems ) );
[8331] Fix | Delete
} );
[8332] Fix | Delete
},
[8333] Fix | Delete
[8334] Fix | Delete
/**
[8335] Fix | Delete
* Handle infinite scroll on the list of icons.
[8336] Fix | Delete
*
[8337] Fix | Delete
* @since 1.7.9
[8338] Fix | Delete
*
[8339] Fix | Delete
* @param {Object} list List.js instance.
[8340] Fix | Delete
*/
[8341] Fix | Delete
infiniteScrollPagination( list ) {
[8342] Fix | Delete
let page = 1;
[8343] Fix | Delete
[8344] Fix | Delete
const options = {
[8345] Fix | Delete
root: document.querySelector( '.wpforms-icon-picker-jconfirm-content-pane' ),
[8346] Fix | Delete
rootMargin: '600px', // 5 rows of icons. Formula: 20 + ( (96 + 20) * rows ).
[8347] Fix | Delete
};
[8348] Fix | Delete
[8349] Fix | Delete
const observer = new IntersectionObserver( function( entries ) {
[8350] Fix | Delete
if ( ! entries[ 0 ].isIntersecting ) {
[8351] Fix | Delete
return;
[8352] Fix | Delete
}
[8353] Fix | Delete
[8354] Fix | Delete
page++;
[8355] Fix | Delete
list.show( 0, page * wpforms_builder.icon_choices.icons_per_page );
[8356] Fix | Delete
}, options );
[8357] Fix | Delete
[8358] Fix | Delete
observer.observe( document.querySelector( '.wpforms-icon-picker-pagination' ) );
[8359] Fix | Delete
},
[8360] Fix | Delete
[8361] Fix | Delete
/**
[8362] Fix | Delete
* When an icon is selected, update the choice and the field preview.
[8363] Fix | Delete
*
[8364] Fix | Delete
* @since 1.7.9
[8365] Fix | Delete
*
[8366] Fix | Delete
* @param {Object} modal Current jQuery Confirm modal instance.
[8367] Fix | Delete
* @param {jQuery} $this The list item (icon) that was clicked.
[8368] Fix | Delete
*/
[8369] Fix | Delete
selectIcon( modal, $this ) {
[8370] Fix | Delete
const fieldId = $this.parent().data( 'field-id' );
[8371] Fix | Delete
const choiceId = $this.parent().data( 'choice-id' );
[8372] Fix | Delete
const icon = $this.data( 'icon' );
[8373] Fix | Delete
const iconStyle = $this.data( 'icon-style' );
[8374] Fix | Delete
const $choice = $( '#wpforms-field-option-row-' + fieldId + '-choices ul li[data-key=' + choiceId + ']' );
[8375] Fix | Delete
const fieldType = $( '#wpforms-field-option-row-' + fieldId + '-choices ul' ).data( 'field-type' );
[8376] Fix | Delete
[8377] Fix | Delete
$this.addClass( 'selected' );
[8378] Fix | Delete
$this.siblings( '.selected' ).removeClass( 'selected' );
[8379] Fix | Delete
[8380] Fix | Delete
$choice.find( '.wpforms-icon-select span' ).text( icon );
[8381] Fix | Delete
$choice.find( '.wpforms-icon-select .ic-fa-preview' ).removeClass().addClass( `ic-fa-preview ic-fa-${ iconStyle } ic-fa-${ icon }` );
[8382] Fix | Delete
$choice.find( '.wpforms-icon-select .source-icon' ).val( icon );
[8383] Fix | Delete
$choice.find( '.wpforms-icon-select .source-icon-style' ).val( iconStyle );
[8384] Fix | Delete
[8385] Fix | Delete
app.fieldChoiceUpdate( fieldType, fieldId );
[8386] Fix | Delete
[8387] Fix | Delete
modal.close();
[8388] Fix | Delete
},
[8389] Fix | Delete
},
[8390] Fix | Delete
[8391] Fix | Delete
//--------------------------------------------------------------------//
[8392] Fix | Delete
// Alerts (notices).
[8393] Fix | Delete
//--------------------------------------------------------------------//
[8394] Fix | Delete
[8395] Fix | Delete
/**
[8396] Fix | Delete
* Click on the Dismiss notice button.
[8397] Fix | Delete
*
[8398] Fix | Delete
* @since 1.6.7
[8399] Fix | Delete
*/
[8400] Fix | Delete
dismissNotice() {
[8401] Fix | Delete
$builder.on( 'click', '.wpforms-alert-field-not-available .wpforms-dismiss-button', function( e ) {
[8402] Fix | Delete
e.preventDefault();
[8403] Fix | Delete
[8404] Fix | Delete
const $button = $( this ),
[8405] Fix | Delete
$alert = $button.closest( '.wpforms-alert' ),
[8406] Fix | Delete
fieldId = $button.data( 'field-id' );
[8407] Fix | Delete
[8408] Fix | Delete
$alert.addClass( 'out' );
[8409] Fix | Delete
setTimeout( function() {
[8410] Fix | Delete
$alert.remove();
[8411] Fix | Delete
}, 250 );
[8412] Fix | Delete
[8413] Fix | Delete
if ( fieldId ) {
[8414] Fix | Delete
$( '#wpforms-field-option-' + fieldId ).remove();
[8415] Fix | Delete
}
[8416] Fix | Delete
} );
[8417] Fix | Delete
},
[8418] Fix | Delete
[8419] Fix | Delete
//--------------------------------------------------------------------//
[8420] Fix | Delete
// Other functions.
[8421] Fix | Delete
//--------------------------------------------------------------------//
[8422] Fix | Delete
[8423] Fix | Delete
/**
[8424] Fix | Delete
* Trim long form titles.
[8425] Fix | Delete
*
[8426] Fix | Delete
* @since 1.0.0
[8427] Fix | Delete
*/
[8428] Fix | Delete
trimFormTitle() {
[8429] Fix | Delete
const $title = $( '.wpforms-center-form-name' );
[8430] Fix | Delete
[8431] Fix | Delete
if ( $title.text().length > 38 ) {
[8432] Fix | Delete
const shortTitle = $title.text().trim().substring( 0, 38 ).split( ' ' ).slice( 0, -1 ).join( ' ' ) + '...';
[8433] Fix | Delete
[8434] Fix | Delete
$title.text( shortTitle );
[8435] Fix | Delete
}
[8436] Fix | Delete
},
[8437] Fix | Delete
[8438] Fix | Delete
/**
[8439] Fix | Delete
* Load or refresh color picker.
[8440] Fix | Delete
*
[8441] Fix | Delete
* @since 1.2.1
[8442] Fix | Delete
* @since 1.7.9 Added default value support.
[8443] Fix | Delete
*/
[8444] Fix | Delete
loadColorPickers() {
[8445] Fix | Delete
$( '.wpforms-color-picker' ).each( function() {
[8446] Fix | Delete
const $this = $( this );
[8447] Fix | Delete
[8448] Fix | Delete
// If it appears to be already initialized, reset. This is needed when duplicating fields with color pickers.
[8449] Fix | Delete
if ( $this.hasClass( 'minicolors-input' ) ) {
[8450] Fix | Delete
$this.minicolors( 'destroy' );
[8451] Fix | Delete
}
[8452] Fix | Delete
[8453] Fix | Delete
$this.minicolors( {
[8454] Fix | Delete
defaultValue: $this.data( 'fallback-color' ) || '',
[8455] Fix | Delete
} );
[8456] Fix | Delete
} );
[8457] Fix | Delete
},
[8458] Fix | Delete
[8459] Fix | Delete
/**
[8460] Fix | Delete
* Get a valid color value from color picker or a default one.
[8461] Fix | Delete
*
[8462] Fix | Delete
* @since 1.7.9
[8463] Fix | Delete
*
[8464] Fix | Delete
* @param {Object} $colorPicker Current field.
[8465] Fix | Delete
*
[8466] Fix | Delete
* @return {string} Always valid color value.
[8467] Fix | Delete
*/
[8468] Fix | Delete
getValidColorPickerValue( $colorPicker ) {
[8469] Fix | Delete
const color = $colorPicker.minicolors( 'value' );
[8470] Fix | Delete
[8471] Fix | Delete
// jQuery MiniColors returns "black" RGB object if the color value is invalid.
[8472] Fix | Delete
const isInvalid = _.isEqual( $colorPicker.minicolors( 'rgbObject' ), { r: 0, g: 0, b: 0 } );
[8473] Fix | Delete
const isBlack = _.includes( [ '#000', '#000000' ], color );
[8474] Fix | Delete
[8475] Fix | Delete
// If default value isn't provided via the data attribute, use black.
[8476] Fix | Delete
const defaultValue = $colorPicker.data( 'fallback-color' ) || '#000000';
[8477] Fix | Delete
[8478] Fix | Delete
return isInvalid && ! isBlack ? defaultValue : color;
[8479] Fix | Delete
},
[8480] Fix | Delete
[8481] Fix | Delete
/**
[8482] Fix | Delete
* Hotkeys:
[8483] Fix | Delete
* Ctrl+H - Help.
[8484] Fix | Delete
* Ctrl+P - Preview.
[8485] Fix | Delete
* Ctrl+B - Embed.
[8486] Fix | Delete
* Ctrl+E - Entries.
[8487] Fix | Delete
* Ctrl+S - Save.
[8488] Fix | Delete
* Ctrl+Q - Exit.
[8489] Fix | Delete
* Ctrl+/ - Keyboard Shortcuts modal.
[8490] Fix | Delete
* Ctrl+F - Focus search fields input.
[8491] Fix | Delete
* Ctrl+T - Toggle sidebar.
[8492] Fix | Delete
*
[8493] Fix | Delete
* @since 1.2.4
[8494] Fix | Delete
*/
[8495] Fix | Delete
builderHotkeys() {
[8496] Fix | Delete
$( document ).on( 'keydown', function( e ) { // eslint-disable-line complexity
[8497] Fix | Delete
if ( ! e.ctrlKey ) {
[8498] Fix | Delete
return;
[8499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function