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
.text( wpforms_builder.file_upload.preview_title_plural );
[1500] Fix | Delete
$preview
[1501] Fix | Delete
.find( '.modern-hint' )
[1502] Fix | Delete
.text( wpforms_builder.file_upload.preview_hint.replace( '{maxFileNumber}', maxFileNumber ) )
[1503] Fix | Delete
.removeClass( 'wpforms-hide' );
[1504] Fix | Delete
} else {
[1505] Fix | Delete
$preview
[1506] Fix | Delete
.find( '.modern-title' )
[1507] Fix | Delete
.text( wpforms_builder.file_upload.preview_title_single );
[1508] Fix | Delete
$preview
[1509] Fix | Delete
.find( '.modern-hint' )
[1510] Fix | Delete
.text( wpforms_builder.file_upload.preview_hint.replace( '{maxFileNumber}', 1 ) )
[1511] Fix | Delete
.addClass( 'wpforms-hide' );
[1512] Fix | Delete
}
[1513] Fix | Delete
[1514] Fix | Delete
// Display the preview.
[1515] Fix | Delete
$( classicPreview, $preview ).addClass( 'wpforms-hide' );
[1516] Fix | Delete
$( modernPreview, $preview ).removeClass( 'wpforms-hide' );
[1517] Fix | Delete
$maxFileNumberRow.removeClass( 'wpforms-hidden' );
[1518] Fix | Delete
}
[1519] Fix | Delete
},
[1520] Fix | Delete
[1521] Fix | Delete
/**
[1522] Fix | Delete
* Update limit controls by changing checkbox.
[1523] Fix | Delete
*
[1524] Fix | Delete
* @since 1.5.6
[1525] Fix | Delete
*
[1526] Fix | Delete
* @param {number} id Field id.
[1527] Fix | Delete
* @param {boolean} checked Whether an option is checked or not.
[1528] Fix | Delete
*/
[1529] Fix | Delete
updateTextFieldsLimitControls( id, checked ) {
[1530] Fix | Delete
if ( ! checked ) {
[1531] Fix | Delete
$( '#wpforms-field-option-row-' + id + '-limit_controls' ).addClass( 'wpforms-hide' );
[1532] Fix | Delete
} else {
[1533] Fix | Delete
$( '#wpforms-field-option-row-' + id + '-limit_controls' ).removeClass( 'wpforms-hide' );
[1534] Fix | Delete
}
[1535] Fix | Delete
},
[1536] Fix | Delete
[1537] Fix | Delete
/**
[1538] Fix | Delete
* Update disabling today's date controls by changing checkbox.
[1539] Fix | Delete
*
[1540] Fix | Delete
* @since 1.8.9.4
[1541] Fix | Delete
*
[1542] Fix | Delete
* @param {number} id Field id.
[1543] Fix | Delete
* @param {boolean} checked Whether an option is checked or not.
[1544] Fix | Delete
*/
[1545] Fix | Delete
updateDisableTodaysDateControls( id, checked ) {
[1546] Fix | Delete
$( `#wpforms-field-option-row-${ id }-date_disable_todays_date` )
[1547] Fix | Delete
.toggleClass( 'wpforms-hide', ! checked );
[1548] Fix | Delete
},
[1549] Fix | Delete
[1550] Fix | Delete
/**
[1551] Fix | Delete
* Update Password Strength controls by changing checkbox.
[1552] Fix | Delete
*
[1553] Fix | Delete
* @since 1.6.7
[1554] Fix | Delete
*
[1555] Fix | Delete
* @param {number} id Field id.
[1556] Fix | Delete
* @param {boolean} checked Whether an option is checked or not.
[1557] Fix | Delete
*/
[1558] Fix | Delete
updatePasswordStrengthControls( id, checked ) {
[1559] Fix | Delete
const $strengthControls = $( '#wpforms-field-option-row-' + id + '-password-strength-level' );
[1560] Fix | Delete
[1561] Fix | Delete
if ( checked ) {
[1562] Fix | Delete
$strengthControls.removeClass( 'wpforms-hidden' );
[1563] Fix | Delete
} else {
[1564] Fix | Delete
$strengthControls.addClass( 'wpforms-hidden' );
[1565] Fix | Delete
}
[1566] Fix | Delete
},
[1567] Fix | Delete
[1568] Fix | Delete
/**
[1569] Fix | Delete
* Update Rich Text media controls by changing checkbox.
[1570] Fix | Delete
*
[1571] Fix | Delete
* @since 1.7.0
[1572] Fix | Delete
*/
[1573] Fix | Delete
updateRichTextMediaFieldsLimitControls() {
[1574] Fix | Delete
const $this = $( this ),
[1575] Fix | Delete
fieldId = $this.closest( '.wpforms-field-option-row-media_enabled' ).data( 'field-id' ),
[1576] Fix | Delete
$mediaControls = $( '#wpforms-field-option-row-' + fieldId + '-media_controls' ),
[1577] Fix | Delete
$toolbar = $( '#wpforms-field-' + fieldId + ' .wpforms-richtext-wrap .mce-toolbar-grp' );
[1578] Fix | Delete
[1579] Fix | Delete
if ( ! $this.is( ':checked' ) ) {
[1580] Fix | Delete
$mediaControls.hide();
[1581] Fix | Delete
$toolbar.removeClass( 'wpforms-field-richtext-media-enabled' );
[1582] Fix | Delete
} else {
[1583] Fix | Delete
$mediaControls.show();
[1584] Fix | Delete
$toolbar.addClass( 'wpforms-field-richtext-media-enabled' );
[1585] Fix | Delete
}
[1586] Fix | Delete
},
[1587] Fix | Delete
[1588] Fix | Delete
/**
[1589] Fix | Delete
* Update Rich Text style preview by changing select.
[1590] Fix | Delete
*
[1591] Fix | Delete
* @since 1.7.0
[1592] Fix | Delete
*/
[1593] Fix | Delete
updateRichTextStylePreview() {
[1594] Fix | Delete
const $this = $( this ),
[1595] Fix | Delete
fieldId = $this.closest( '.wpforms-field-option-row-style' ).data( 'field-id' ),
[1596] Fix | Delete
$toolbar = $( '#wpforms-field-' + fieldId + ' .wpforms-richtext-wrap .mce-toolbar-grp' );
[1597] Fix | Delete
[1598] Fix | Delete
$toolbar.toggleClass( 'wpforms-field-richtext-toolbar-basic', $this.val() !== 'full' );
[1599] Fix | Delete
},
[1600] Fix | Delete
[1601] Fix | Delete
/**
[1602] Fix | Delete
* Element bindings.
[1603] Fix | Delete
*
[1604] Fix | Delete
* @since 1.0.0
[1605] Fix | Delete
*/
[1606] Fix | Delete
bindUIActions() {
[1607] Fix | Delete
// General Panels.
[1608] Fix | Delete
app.bindUIActionsPanels();
[1609] Fix | Delete
[1610] Fix | Delete
// Fields Panel.
[1611] Fix | Delete
app.bindUIActionsFields();
[1612] Fix | Delete
[1613] Fix | Delete
// Settings Panel.
[1614] Fix | Delete
app.bindUIActionsSettings();
[1615] Fix | Delete
[1616] Fix | Delete
// Revisions Panel.
[1617] Fix | Delete
app.bindUIActionsRevisions();
[1618] Fix | Delete
[1619] Fix | Delete
// Save and Exit.
[1620] Fix | Delete
app.bindUIActionsSaveExit();
[1621] Fix | Delete
[1622] Fix | Delete
// General/ global.
[1623] Fix | Delete
app.bindUIActionsGeneral();
[1624] Fix | Delete
},
[1625] Fix | Delete
[1626] Fix | Delete
//--------------------------------------------------------------------//
[1627] Fix | Delete
// General Panels
[1628] Fix | Delete
//--------------------------------------------------------------------//
[1629] Fix | Delete
[1630] Fix | Delete
/**
[1631] Fix | Delete
* Element bindings for general panel tasks.
[1632] Fix | Delete
*
[1633] Fix | Delete
* @since 1.0.0
[1634] Fix | Delete
*/
[1635] Fix | Delete
bindUIActionsPanels() {
[1636] Fix | Delete
// Panel switching.
[1637] Fix | Delete
$builder.on( 'click', '#wpforms-panels-toggle button, .wpforms-panel-switch', function( e ) {
[1638] Fix | Delete
e.preventDefault();
[1639] Fix | Delete
app.panelSwitch( $( this ).data( 'panel' ) );
[1640] Fix | Delete
} );
[1641] Fix | Delete
[1642] Fix | Delete
// Panel sections switching.
[1643] Fix | Delete
$builder.on( 'click', '.wpforms-panel .wpforms-panel-sidebar-section', function( e ) {
[1644] Fix | Delete
app.panelSectionSwitch( this, e );
[1645] Fix | Delete
} );
[1646] Fix | Delete
[1647] Fix | Delete
// Panel sidebar toggle.
[1648] Fix | Delete
$builder.on( 'click', '.wpforms-panels .wpforms-panel-sidebar-content .wpforms-panel-sidebar-toggle', function() {
[1649] Fix | Delete
$( this ).parent().toggleClass( 'wpforms-panel-sidebar-closed' );
[1650] Fix | Delete
} );
[1651] Fix | Delete
},
[1652] Fix | Delete
[1653] Fix | Delete
/**
[1654] Fix | Delete
* Switch Panels.
[1655] Fix | Delete
*
[1656] Fix | Delete
* @since 1.0.0
[1657] Fix | Delete
* @since 1.5.9 Added `wpformsPanelSwitched` trigger.
[1658] Fix | Delete
*
[1659] Fix | Delete
* @param {string} panel Panel slug.
[1660] Fix | Delete
*
[1661] Fix | Delete
* @return {void|boolean} Void or false.
[1662] Fix | Delete
*/
[1663] Fix | Delete
panelSwitch( panel ) {
[1664] Fix | Delete
const $panel = $( '#wpforms-panel-' + panel );
[1665] Fix | Delete
[1666] Fix | Delete
if ( ! $panel.hasClass( 'active' ) ) {
[1667] Fix | Delete
const event = WPFormsUtils.triggerEvent( $builder, 'wpformsPanelSwitch', [ panel ] );
[1668] Fix | Delete
[1669] Fix | Delete
// Allow callbacks on `wpformsPanelSwitch` to cancel panel switching by triggering `event.preventDefault()`.
[1670] Fix | Delete
if ( event.isDefaultPrevented() || ! wpforms_panel_switch ) {
[1671] Fix | Delete
return false;
[1672] Fix | Delete
}
[1673] Fix | Delete
[1674] Fix | Delete
$( '#wpforms-panels-toggle' ).find( 'button' ).removeClass( 'active' );
[1675] Fix | Delete
$( '.wpforms-panel' ).removeClass( 'active' );
[1676] Fix | Delete
$( '.wpforms-panel-' + panel + '-button' ).addClass( 'active' );
[1677] Fix | Delete
$panel.addClass( 'active' );
[1678] Fix | Delete
[1679] Fix | Delete
history.replaceState( {}, null, wpf.updateQueryString( 'view', panel ) );
[1680] Fix | Delete
[1681] Fix | Delete
$builder.trigger( 'wpformsPanelSwitched', [ panel ] );
[1682] Fix | Delete
}
[1683] Fix | Delete
},
[1684] Fix | Delete
[1685] Fix | Delete
/**
[1686] Fix | Delete
* Switch Panel section.
[1687] Fix | Delete
*
[1688] Fix | Delete
* @since 1.0.0
[1689] Fix | Delete
*
[1690] Fix | Delete
* @param {Element} el Element.
[1691] Fix | Delete
* @param {Event} e Event.
[1692] Fix | Delete
*
[1693] Fix | Delete
* @return {boolean|void} False when not switched.
[1694] Fix | Delete
*/
[1695] Fix | Delete
panelSectionSwitch( el, e ) { // eslint-disable-line complexity
[1696] Fix | Delete
if ( e ) {
[1697] Fix | Delete
e.preventDefault();
[1698] Fix | Delete
}
[1699] Fix | Delete
[1700] Fix | Delete
const $this = $( el );
[1701] Fix | Delete
[1702] Fix | Delete
if ( $this.hasClass( 'upgrade-modal' ) || $this.hasClass( 'education-modal' ) ) {
[1703] Fix | Delete
return;
[1704] Fix | Delete
}
[1705] Fix | Delete
[1706] Fix | Delete
const $panel = $this.parent().parent(),
[1707] Fix | Delete
section = $this.data( 'section' ),
[1708] Fix | Delete
$sectionButton = $panel.find( '.wpforms-panel-sidebar-section-' + section );
[1709] Fix | Delete
[1710] Fix | Delete
if ( ! $sectionButton.hasClass( 'active' ) ) {
[1711] Fix | Delete
const event = WPFormsUtils.triggerEvent( $builder, 'wpformsPanelSectionSwitch', section );
[1712] Fix | Delete
[1713] Fix | Delete
// Allow callbacks on `wpformsPanelSectionSwitch` to cancel panel section switching by triggering `event.preventDefault()`.
[1714] Fix | Delete
if ( event.isDefaultPrevented() || ! wpforms_panel_switch ) {
[1715] Fix | Delete
return false;
[1716] Fix | Delete
}
[1717] Fix | Delete
[1718] Fix | Delete
const $sectionButtons = $panel.find( '.wpforms-panel-sidebar-section' );
[1719] Fix | Delete
[1720] Fix | Delete
$sectionButtons.removeClass( 'active' );
[1721] Fix | Delete
$sectionButton.addClass( 'active' );
[1722] Fix | Delete
$panel.find( '.wpforms-panel-content-section' ).hide();
[1723] Fix | Delete
$panel.find( '.wpforms-panel-content-section-' + section ).show();
[1724] Fix | Delete
}
[1725] Fix | Delete
},
[1726] Fix | Delete
[1727] Fix | Delete
//--------------------------------------------------------------------//
[1728] Fix | Delete
// Setup Panel
[1729] Fix | Delete
//--------------------------------------------------------------------//
[1730] Fix | Delete
[1731] Fix | Delete
/**
[1732] Fix | Delete
* Element bindings for a Setup panel.
[1733] Fix | Delete
*
[1734] Fix | Delete
* @since 1.0.0
[1735] Fix | Delete
* @since 1.6.8 Deprecated.
[1736] Fix | Delete
*
[1737] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.Setup.events()` instead.
[1738] Fix | Delete
*/
[1739] Fix | Delete
bindUIActionsSetup() {
[1740] Fix | Delete
// eslint-disable-next-line no-console
[1741] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.bindUIActionsSetup()" has been deprecated, please use the new "WPForms.Admin.Builder.Setup.events()" function instead!' );
[1742] Fix | Delete
[1743] Fix | Delete
WPForms.Admin.Builder.Setup.events();
[1744] Fix | Delete
},
[1745] Fix | Delete
[1746] Fix | Delete
/**
[1747] Fix | Delete
* Select template.
[1748] Fix | Delete
*
[1749] Fix | Delete
* @since 1.0.0
[1750] Fix | Delete
* @since 1.6.8 Deprecated.
[1751] Fix | Delete
*
[1752] Fix | Delete
* @deprecated Use `WPForms.Admin.Builder.Setup.selectTemplate()` instead.
[1753] Fix | Delete
*
[1754] Fix | Delete
* @param {Object} el DOM element object.
[1755] Fix | Delete
* @param {Object} e Event object.
[1756] Fix | Delete
*/
[1757] Fix | Delete
templateSelect( el, e ) {
[1758] Fix | Delete
// eslint-disable-next-line no-console
[1759] Fix | Delete
console.warn( 'WARNING! Function "WPFormsBuilder.templateSelect()" has been deprecated, please use the new "WPForms.Admin.Builder.Setup.selectTemplate()" function instead!' );
[1760] Fix | Delete
[1761] Fix | Delete
WPForms.Admin.Builder.Setup.selectTemplate( e );
[1762] Fix | Delete
},
[1763] Fix | Delete
[1764] Fix | Delete
//--------------------------------------------------------------------//
[1765] Fix | Delete
// Fields Panel
[1766] Fix | Delete
//--------------------------------------------------------------------//
[1767] Fix | Delete
[1768] Fix | Delete
/**
[1769] Fix | Delete
* Element bindings for Fields panel.
[1770] Fix | Delete
*
[1771] Fix | Delete
* @since 1.0.0
[1772] Fix | Delete
*/
[1773] Fix | Delete
bindUIActionsFields() { // eslint-disable-line max-lines-per-function
[1774] Fix | Delete
// Field sidebar tab toggle
[1775] Fix | Delete
$builder.on( 'click', '.wpforms-tab a', function( e ) {
[1776] Fix | Delete
e.preventDefault();
[1777] Fix | Delete
app.fieldTabToggle( $( this ).parent().attr( 'id' ) );
[1778] Fix | Delete
} );
[1779] Fix | Delete
[1780] Fix | Delete
// Field sidebar group toggle
[1781] Fix | Delete
$builder.on( 'click', '.wpforms-add-fields-heading', function( e ) {
[1782] Fix | Delete
e.preventDefault();
[1783] Fix | Delete
app.fieldGroupToggle( $( this ), 'click' );
[1784] Fix | Delete
} );
[1785] Fix | Delete
[1786] Fix | Delete
// Form field preview clicking.
[1787] Fix | Delete
$builder.on( 'click', '.wpforms-field', function( event ) {
[1788] Fix | Delete
if ( app.isFieldPreviewActionsDisabled( this ) ) {
[1789] Fix | Delete
return;
[1790] Fix | Delete
}
[1791] Fix | Delete
[1792] Fix | Delete
// Allow clicking on the "dismiss" button inside the field.
[1793] Fix | Delete
if ( event.target.classList.contains( 'wpforms-dismiss-button' ) ) {
[1794] Fix | Delete
return;
[1795] Fix | Delete
}
[1796] Fix | Delete
[1797] Fix | Delete
// Dismiss the main context menu when it is open.
[1798] Fix | Delete
if ( WPForms.Admin.Builder.ContextMenu ) {
[1799] Fix | Delete
WPForms.Admin.Builder.ContextMenu.hideMainContextMenu( event );
[1800] Fix | Delete
}
[1801] Fix | Delete
[1802] Fix | Delete
event.stopPropagation();
[1803] Fix | Delete
[1804] Fix | Delete
app.fieldTabToggle( $( this ).data( 'field-id' ) );
[1805] Fix | Delete
} );
[1806] Fix | Delete
[1807] Fix | Delete
// Prevent interactions with inputs on the preview panel.
[1808] Fix | Delete
$builder.on( 'mousedown click', '.wpforms-field input, .wpforms-field select, .wpforms-field textarea', function( e ) {
[1809] Fix | Delete
e.preventDefault();
[1810] Fix | Delete
this.blur();
[1811] Fix | Delete
} );
[1812] Fix | Delete
[1813] Fix | Delete
// Field delete.
[1814] Fix | Delete
$builder.on( 'click', '.wpforms-field-delete', function( e ) {
[1815] Fix | Delete
e.preventDefault();
[1816] Fix | Delete
e.stopPropagation();
[1817] Fix | Delete
[1818] Fix | Delete
if ( app.isFormPreviewActionsDisabled( this ) ) {
[1819] Fix | Delete
return;
[1820] Fix | Delete
}
[1821] Fix | Delete
[1822] Fix | Delete
if ( WPForms.Admin.Builder.ContextMenu ) {
[1823] Fix | Delete
WPForms.Admin.Builder.ContextMenu.hideMenu();
[1824] Fix | Delete
}
[1825] Fix | Delete
[1826] Fix | Delete
app.fieldDelete( $( this ).parent().data( 'field-id' ) );
[1827] Fix | Delete
} );
[1828] Fix | Delete
[1829] Fix | Delete
// Field duplicate.
[1830] Fix | Delete
$builder.on( 'click', '.wpforms-field-duplicate', function( e ) {
[1831] Fix | Delete
e.preventDefault();
[1832] Fix | Delete
e.stopPropagation();
[1833] Fix | Delete
[1834] Fix | Delete
if ( app.isFormPreviewActionsDisabled( this ) ) {
[1835] Fix | Delete
return;
[1836] Fix | Delete
}
[1837] Fix | Delete
[1838] Fix | Delete
if ( WPForms.Admin.Builder.ContextMenu ) {
[1839] Fix | Delete
WPForms.Admin.Builder.ContextMenu.hideMenu();
[1840] Fix | Delete
}
[1841] Fix | Delete
[1842] Fix | Delete
app.fieldDuplicate( $( this ).parent().data( 'field-id' ) );
[1843] Fix | Delete
} );
[1844] Fix | Delete
[1845] Fix | Delete
// Field add.
[1846] Fix | Delete
$builder.on( 'click', '.wpforms-add-fields-button', function( e ) {
[1847] Fix | Delete
e.preventDefault();
[1848] Fix | Delete
[1849] Fix | Delete
const $field = $( this );
[1850] Fix | Delete
[1851] Fix | Delete
if ( $field.hasClass( 'ui-draggable-disabled' ) ) {
[1852] Fix | Delete
return;
[1853] Fix | Delete
}
[1854] Fix | Delete
[1855] Fix | Delete
const type = $field.data( 'field-type' ),
[1856] Fix | Delete
event = WPFormsUtils.triggerEvent( $builder, 'wpformsBeforeFieldAddOnClick', [ type, $field ] );
[1857] Fix | Delete
[1858] Fix | Delete
// Allow callbacks on `wpformsBeforeFieldAddOnClick` to cancel adding field
[1859] Fix | Delete
// by triggering `event.preventDefault()`.
[1860] Fix | Delete
if ( event.isDefaultPrevented() ) {
[1861] Fix | Delete
return;
[1862] Fix | Delete
}
[1863] Fix | Delete
[1864] Fix | Delete
app.fieldAdd( type, { $sortable: 'default' } );
[1865] Fix | Delete
} );
[1866] Fix | Delete
[1867] Fix | Delete
// New field choices should be sortable
[1868] Fix | Delete
$builder.on( 'wpformsFieldAdd', function( event, id, type ) {
[1869] Fix | Delete
const fieldTypes = [
[1870] Fix | Delete
'select',
[1871] Fix | Delete
'radio',
[1872] Fix | Delete
'checkbox',
[1873] Fix | Delete
'payment-multiple',
[1874] Fix | Delete
'payment-checkbox',
[1875] Fix | Delete
'payment-select',
[1876] Fix | Delete
];
[1877] Fix | Delete
[1878] Fix | Delete
if ( $.inArray( type, fieldTypes ) !== -1 ) {
[1879] Fix | Delete
app.fieldChoiceSortable( type, `#wpforms-field-option-row-${ id }-choices ul` );
[1880] Fix | Delete
}
[1881] Fix | Delete
} );
[1882] Fix | Delete
[1883] Fix | Delete
// Field option tab toggle.
[1884] Fix | Delete
$builder.on( 'wpformsFieldOptionTabToggle', function( e, fieldId ) {
[1885] Fix | Delete
app.fieldLayoutSelectorInit( fieldId );
[1886] Fix | Delete
} );
[1887] Fix | Delete
[1888] Fix | Delete
// Field choice "Add new".
[1889] Fix | Delete
$builder.on( 'click', '.wpforms-field-option-row-choices .add', function( e ) {
[1890] Fix | Delete
app.fieldChoiceAdd( e, $( this ) );
[1891] Fix | Delete
} );
[1892] Fix | Delete
[1893] Fix | Delete
// Field choice delete.
[1894] Fix | Delete
$builder.on( 'click', '.wpforms-field-option-row-choices .remove', function( e ) {
[1895] Fix | Delete
app.fieldChoiceDelete( e, $( this ) );
[1896] Fix | Delete
} );
[1897] Fix | Delete
[1898] Fix | Delete
// Field choices' defaults, before change.
[1899] Fix | Delete
$builder.on( 'mousedown', '.wpforms-field-option-row-choices input[type=radio]', function( e ) { // eslint-disable-line no-unused-vars
[1900] Fix | Delete
const $this = $( this );
[1901] Fix | Delete
[1902] Fix | Delete
if ( $this.is( ':checked' ) ) {
[1903] Fix | Delete
$this.attr( 'data-checked', '1' );
[1904] Fix | Delete
} else {
[1905] Fix | Delete
$this.attr( 'data-checked', '0' );
[1906] Fix | Delete
}
[1907] Fix | Delete
} );
[1908] Fix | Delete
[1909] Fix | Delete
// Field choices' defaults.
[1910] Fix | Delete
$builder.on( 'click', '.wpforms-field-option-row-choices input[type=radio]', function( e ) { // eslint-disable-line no-unused-vars
[1911] Fix | Delete
const $this = $( this ),
[1912] Fix | Delete
list = $this.parent().parent();
[1913] Fix | Delete
[1914] Fix | Delete
$this.parent().parent().find( 'input[type=radio]' ).not( this ).prop( 'checked', false );
[1915] Fix | Delete
[1916] Fix | Delete
if ( $this.attr( 'data-checked' ) === '1' ) {
[1917] Fix | Delete
$this.prop( 'checked', false );
[1918] Fix | Delete
$this.attr( 'data-checked', '0' );
[1919] Fix | Delete
}
[1920] Fix | Delete
[1921] Fix | Delete
app.fieldChoiceUpdate( list.data( 'field-type' ), list.data( 'field-id' ), list.find( 'li' ).length );
[1922] Fix | Delete
} );
[1923] Fix | Delete
[1924] Fix | Delete
// Field choices update preview area.
[1925] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices input[type=checkbox]', function( e ) { // eslint-disable-line no-unused-vars
[1926] Fix | Delete
const list = $( this ).parent().parent();
[1927] Fix | Delete
[1928] Fix | Delete
app.fieldChoiceUpdate( list.data( 'field-type' ), list.data( 'field-id' ), list.find( 'li' ).length );
[1929] Fix | Delete
} );
[1930] Fix | Delete
[1931] Fix | Delete
// Field choices display value toggle.
[1932] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-show_values input', function( e ) { // eslint-disable-line no-unused-vars
[1933] Fix | Delete
$( this ).closest( '.wpforms-field-option' ).find( '.wpforms-field-option-row-choices ul' ).toggleClass( 'show-values' );
[1934] Fix | Delete
} );
[1935] Fix | Delete
[1936] Fix | Delete
// Field choices image toggle.
[1937] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices_images input', function() {
[1938] Fix | Delete
const $this = $( this ),
[1939] Fix | Delete
$optionRow = $this.closest( '.wpforms-field-option-row' ),
[1940] Fix | Delete
fieldID = $optionRow.data( 'field-id' ),
[1941] Fix | Delete
$fieldOptions = $( '#wpforms-field-option-' + fieldID ),
[1942] Fix | Delete
checked = $this.is( ':checked' ),
[1943] Fix | Delete
type = $fieldOptions.find( '.wpforms-field-option-hidden-type' ).val(),
[1944] Fix | Delete
$iconToggle = $optionRow.siblings( '.wpforms-field-option-row-choices_icons' ).find( 'input' );
[1945] Fix | Delete
[1946] Fix | Delete
// Toggle icon choices off.
[1947] Fix | Delete
if ( checked && $iconToggle.is( ':checked' ) ) {
[1948] Fix | Delete
$iconToggle.prop( 'checked', false ).trigger( 'change' );
[1949] Fix | Delete
}
[1950] Fix | Delete
[1951] Fix | Delete
$optionRow.find( '.wpforms-alert' ).toggleClass( 'wpforms-hidden' );
[1952] Fix | Delete
$fieldOptions.find( '.wpforms-field-option-row-choices ul' ).toggleClass( 'show-images' );
[1953] Fix | Delete
$fieldOptions.find( '.wpforms-field-option-row-choices_images_style' ).toggleClass( 'wpforms-hidden' );
[1954] Fix | Delete
$fieldOptions.find( '.wpforms-field-option-row-dynamic_choices' ).toggleClass( 'wpforms-hidden', checked );
[1955] Fix | Delete
[1956] Fix | Delete
if ( checked ) {
[1957] Fix | Delete
$( '#wpforms-field-option-' + fieldID + '-input_columns' ).val( 'inline' ).trigger( 'change' );
[1958] Fix | Delete
} else {
[1959] Fix | Delete
$( '#wpforms-field-option-' + fieldID + '-input_columns' ).val( '' ).trigger( 'change' );
[1960] Fix | Delete
}
[1961] Fix | Delete
[1962] Fix | Delete
app.fieldChoiceUpdate( type, fieldID );
[1963] Fix | Delete
} );
[1964] Fix | Delete
[1965] Fix | Delete
// Field choices image upload add/remove image.
[1966] Fix | Delete
$builder.on( 'wpformsImageUploadAdd wpformsImageUploadRemove', function( event, $this, $container ) {
[1967] Fix | Delete
const $list = $container.closest( '.choices-list' ),
[1968] Fix | Delete
fieldID = $list.data( 'field-id' ),
[1969] Fix | Delete
type = $list.data( 'field-type' );
[1970] Fix | Delete
[1971] Fix | Delete
app.fieldChoiceUpdate( type, fieldID );
[1972] Fix | Delete
} );
[1973] Fix | Delete
[1974] Fix | Delete
// Field choices image style toggle.
[1975] Fix | Delete
$builder.on( 'change', '.wpforms-field-option-row-choices_images_style select', function() {
[1976] Fix | Delete
const fieldID = $( this ).parent().data( 'field-id' ),
[1977] Fix | Delete
type = $( '#wpforms-field-option-' + fieldID ).find( '.wpforms-field-option-hidden-type' ).val();
[1978] Fix | Delete
[1979] Fix | Delete
app.fieldChoiceUpdate( type, fieldID );
[1980] Fix | Delete
} );
[1981] Fix | Delete
[1982] Fix | Delete
// Updates field choices text in almost real time.
[1983] Fix | Delete
$builder.on( 'keyup', '.wpforms-field-option-row-choices input.label, .wpforms-field-option-row-choices input.value', function( e ) { // eslint-disable-line no-unused-vars
[1984] Fix | Delete
const $list = $( this ).parent().parent();
[1985] Fix | Delete
[1986] Fix | Delete
app.fieldChoiceUpdate( $list.data( 'field-type' ), $list.data( 'field-id' ) );
[1987] Fix | Delete
} );
[1988] Fix | Delete
[1989] Fix | Delete
// Sanitize field choices text on focus out.
[1990] Fix | Delete
$builder.on( 'focusout', '.wpforms-field-option-row-choices input.label, .wpforms-field-option-row-choices input.value', function( e ) { // eslint-disable-line no-unused-vars
[1991] Fix | Delete
const input = $( this );
[1992] Fix | Delete
[1993] Fix | Delete
input.val( wpf.sanitizeHTML( input.val(), wpforms_builder.allowed_label_html_tags ) );
[1994] Fix | Delete
} );
[1995] Fix | Delete
[1996] Fix | Delete
// Field Choices Bulk Add
[1997] Fix | Delete
$builder.on( 'click', '.toggle-bulk-add-display', function( e ) {
[1998] Fix | Delete
e.preventDefault();
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function