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
$items = $wrap.find( '.wpforms-field-rating-item' );
[1500] Fix | Delete
$this.focus(); // Enable keyboard navigation.
[1501] Fix | Delete
$items.removeClass( 'hover selected' );
[1502] Fix | Delete
$this.parent().prevAll().addBack().addClass( 'selected' );
[1503] Fix | Delete
} );
[1504] Fix | Delete
[1505] Fix | Delete
// Rating field: preselect the selected rating (from dynamic/fallback population).
[1506] Fix | Delete
$( function() {
[1507] Fix | Delete
$( '.wpforms-field-rating-item input:checked' ).trigger( 'change' );
[1508] Fix | Delete
} );
[1509] Fix | Delete
[1510] Fix | Delete
// Checkbox/Radio/Payment checkbox: make labels keyboard-accessible.
[1511] Fix | Delete
$document.on( 'keydown', '.wpforms-image-choices-item label', function( event ) {
[1512] Fix | Delete
const $label = $( this ),
[1513] Fix | Delete
$field = $label.closest( '.wpforms-field' );
[1514] Fix | Delete
[1515] Fix | Delete
if ( $field.hasClass( 'wpforms-conditional-hide' ) ) {
[1516] Fix | Delete
event.preventDefault();
[1517] Fix | Delete
return false;
[1518] Fix | Delete
}
[1519] Fix | Delete
[1520] Fix | Delete
// Cause the input to be clicked when pressing Space bar on the label.
[1521] Fix | Delete
if ( event.keyCode !== 32 ) {
[1522] Fix | Delete
return;
[1523] Fix | Delete
}
[1524] Fix | Delete
[1525] Fix | Delete
$label.find( 'input' ).trigger( 'click' );
[1526] Fix | Delete
event.preventDefault();
[1527] Fix | Delete
} );
[1528] Fix | Delete
[1529] Fix | Delete
// IE: Click on the `image choice` image should trigger the click event on the input (checkbox or radio) field.
[1530] Fix | Delete
if ( window.document.documentMode ) {
[1531] Fix | Delete
$document.on( 'click', '.wpforms-image-choices-item img', function() {
[1532] Fix | Delete
$( this ).closest( 'label' ).find( 'input' ).trigger( 'click' );
[1533] Fix | Delete
} );
[1534] Fix | Delete
}
[1535] Fix | Delete
[1536] Fix | Delete
$document.on( 'change', '.wpforms-field-checkbox input, .wpforms-field-radio input, .wpforms-field-payment-multiple input, .wpforms-field-payment-checkbox input, .wpforms-field-gdpr-checkbox input', function( event ) {
[1537] Fix | Delete
const $this = $( this ),
[1538] Fix | Delete
$field = $this.closest( '.wpforms-field' );
[1539] Fix | Delete
[1540] Fix | Delete
if ( $field.hasClass( 'wpforms-conditional-hide' ) ) {
[1541] Fix | Delete
event.preventDefault();
[1542] Fix | Delete
return false;
[1543] Fix | Delete
}
[1544] Fix | Delete
[1545] Fix | Delete
switch ( $this.attr( 'type' ) ) {
[1546] Fix | Delete
case 'radio':
[1547] Fix | Delete
$this.closest( 'ul' ).find( 'li' ).removeClass( 'wpforms-selected' ).find( 'input[type=radio]' ).removeProp( 'checked' );
[1548] Fix | Delete
$this
[1549] Fix | Delete
.prop( 'checked', true )
[1550] Fix | Delete
.closest( 'li' ).addClass( 'wpforms-selected' );
[1551] Fix | Delete
break;
[1552] Fix | Delete
[1553] Fix | Delete
case 'checkbox':
[1554] Fix | Delete
if ( $this.is( ':checked' ) ) {
[1555] Fix | Delete
$this.closest( 'li' ).addClass( 'wpforms-selected' );
[1556] Fix | Delete
$this.prop( 'checked', true );
[1557] Fix | Delete
} else {
[1558] Fix | Delete
$this.closest( 'li' ).removeClass( 'wpforms-selected' );
[1559] Fix | Delete
$this.prop( 'checked', false );
[1560] Fix | Delete
}
[1561] Fix | Delete
break;
[1562] Fix | Delete
}
[1563] Fix | Delete
} );
[1564] Fix | Delete
[1565] Fix | Delete
// Upload fields: Check combined file size.
[1566] Fix | Delete
$document.on( 'input', '.wpforms-field-file-upload', function() {
[1567] Fix | Delete
const $this = $( this ),
[1568] Fix | Delete
$uploads = $this.closest( 'form.wpforms-form' ).find( '.wpforms-field-file-upload input:not(".dropzone-input")' );
[1569] Fix | Delete
let totalSize = 0,
[1570] Fix | Delete
postMaxSize = Number( wpforms_settings.post_max_size ),
[1571] Fix | Delete
errorMsg = '<div class="wpforms-error-container-post_max_size">' + wpforms_settings.val_post_max_size + '</div>';
[1572] Fix | Delete
const errorCntTpl = '<div class="wpforms-error-container">{errorMsg}</div>';
[1573] Fix | Delete
const $submitCnt = $this.closest( 'form.wpforms-form' ).find( '.wpforms-submit-container' );
[1574] Fix | Delete
let $submitBtn = $submitCnt.find( 'button.wpforms-submit' ),
[1575] Fix | Delete
$errorCnt = $submitCnt.prev();
[1576] Fix | Delete
const $form = $submitBtn.closest( 'form' ),
[1577] Fix | Delete
$btnNext = $form.find( '.wpforms-page-next:visible' );
[1578] Fix | Delete
[1579] Fix | Delete
// For multi-pages layout, use the "Next" button instead of the primary "Submit" button.
[1580] Fix | Delete
if ( $form.find( '.wpforms-page-indicator' ).length !== 0 && $btnNext.length !== 0 ) {
[1581] Fix | Delete
$submitBtn = $btnNext;
[1582] Fix | Delete
}
[1583] Fix | Delete
[1584] Fix | Delete
// Calculating totalSize.
[1585] Fix | Delete
$uploads.each( function() {
[1586] Fix | Delete
const $upload = $( this );
[1587] Fix | Delete
let i = 0;
[1588] Fix | Delete
const len = $upload[ 0 ].files.length;
[1589] Fix | Delete
[1590] Fix | Delete
for ( ; i < len; i++ ) {
[1591] Fix | Delete
totalSize += $upload[ 0 ].files[ i ].size;
[1592] Fix | Delete
}
[1593] Fix | Delete
} );
[1594] Fix | Delete
[1595] Fix | Delete
// Checking totalSize.
[1596] Fix | Delete
if ( totalSize < postMaxSize ) {
[1597] Fix | Delete
// Remove error and release submit button.
[1598] Fix | Delete
$errorCnt.find( '.wpforms-error-container-post_max_size' ).remove();
[1599] Fix | Delete
[1600] Fix | Delete
$submitBtn.prop( 'disabled', false );
[1601] Fix | Delete
[1602] Fix | Delete
WPFormsUtils.triggerEvent( $form, 'wpformsFormSubmitButtonRestore', [ $form, $submitBtn ] );
[1603] Fix | Delete
[1604] Fix | Delete
WPFormsUtils.triggerEvent( $form, 'wpformsCombinedUploadsSizeOk', [ $form, $errorCnt ] );
[1605] Fix | Delete
[1606] Fix | Delete
return;
[1607] Fix | Delete
}
[1608] Fix | Delete
[1609] Fix | Delete
// Convert sizes to Mb.
[1610] Fix | Delete
totalSize = Number( ( totalSize / 1048576 ).toFixed( 3 ) );
[1611] Fix | Delete
postMaxSize = Number( ( postMaxSize / 1048576 ).toFixed( 3 ) );
[1612] Fix | Delete
[1613] Fix | Delete
// Preparing error message.
[1614] Fix | Delete
errorMsg = errorMsg.replace( /{totalSize}/, totalSize ).replace( /{maxSize}/, postMaxSize );
[1615] Fix | Delete
[1616] Fix | Delete
// Output error message.
[1617] Fix | Delete
if ( $errorCnt.hasClass( 'wpforms-error-container' ) ) {
[1618] Fix | Delete
$errorCnt.find( '.wpforms-error-container-post_max_size' ).remove();
[1619] Fix | Delete
$errorCnt.append( errorMsg );
[1620] Fix | Delete
} else {
[1621] Fix | Delete
$submitCnt.before( errorCntTpl.replace( /{errorMsg}/, errorMsg ) );
[1622] Fix | Delete
$errorCnt = $submitCnt.prev();
[1623] Fix | Delete
}
[1624] Fix | Delete
[1625] Fix | Delete
// Disable submit button.
[1626] Fix | Delete
$submitBtn.prop( 'disabled', true );
[1627] Fix | Delete
WPFormsUtils.triggerEvent( $form, 'wpformsFormSubmitButtonDisable', [ $form, $submitBtn ] );
[1628] Fix | Delete
[1629] Fix | Delete
WPFormsUtils.triggerEvent( $form, 'wpformsCombinedUploadsSizeError', [ $form, $errorCnt ] );
[1630] Fix | Delete
} );
[1631] Fix | Delete
[1632] Fix | Delete
// Number Slider field: update hints.
[1633] Fix | Delete
$document.on( 'change input', '.wpforms-field-number-slider input[type=range]', function( event ) {
[1634] Fix | Delete
const hintEl = $( event.target ).siblings( '.wpforms-field-number-slider-hint' );
[1635] Fix | Delete
[1636] Fix | Delete
hintEl.html( hintEl.data( 'hint' ).replaceAll( '{value}', '<b>' + event.target.value + '</b>' ) );
[1637] Fix | Delete
} );
[1638] Fix | Delete
[1639] Fix | Delete
// Enter key event.
[1640] Fix | Delete
$document.on( 'keydown', '.wpforms-form input', function( e ) {
[1641] Fix | Delete
if ( e.keyCode !== 13 ) {
[1642] Fix | Delete
return;
[1643] Fix | Delete
}
[1644] Fix | Delete
[1645] Fix | Delete
const $t = $( this ),
[1646] Fix | Delete
$page = $t.closest( '.wpforms-page' );
[1647] Fix | Delete
[1648] Fix | Delete
if ( $page.length === 0 ) {
[1649] Fix | Delete
return;
[1650] Fix | Delete
}
[1651] Fix | Delete
[1652] Fix | Delete
if ( [ 'text', 'tel', 'number', 'email', 'url', 'radio', 'checkbox' ].indexOf( $t.attr( 'type' ) ) < 0 ) {
[1653] Fix | Delete
return;
[1654] Fix | Delete
}
[1655] Fix | Delete
[1656] Fix | Delete
if ( $t.hasClass( 'wpforms-datepicker' ) ) {
[1657] Fix | Delete
$t.flatpickr( 'close' );
[1658] Fix | Delete
}
[1659] Fix | Delete
[1660] Fix | Delete
e.preventDefault();
[1661] Fix | Delete
[1662] Fix | Delete
if ( $page.hasClass( 'last' ) ) {
[1663] Fix | Delete
$page.closest( '.wpforms-form' ).find( '.wpforms-submit' ).trigger( 'click' );
[1664] Fix | Delete
return;
[1665] Fix | Delete
}
[1666] Fix | Delete
[1667] Fix | Delete
$page.find( '.wpforms-page-next' ).trigger( 'click' );
[1668] Fix | Delete
} );
[1669] Fix | Delete
[1670] Fix | Delete
// Allow only numbers, minus and decimal point to be entered into the Numbers field.
[1671] Fix | Delete
$document.on( 'keypress', '.wpforms-field-number input', function( e ) {
[1672] Fix | Delete
return /^[-0-9.]+$/.test( String.fromCharCode( e.keyCode || e.which ) );
[1673] Fix | Delete
} );
[1674] Fix | Delete
[1675] Fix | Delete
// Start anti-spam timer on interaction of the form fields.
[1676] Fix | Delete
$document
[1677] Fix | Delete
.one( 'input', '.wpforms-field input, .wpforms-field textarea, .wpforms-field select', app.formChanged )
[1678] Fix | Delete
.one( 'change', '.wpforms-field-select-style-modern, .wpforms-timepicker', app.formChanged )
[1679] Fix | Delete
.one( 'focus', '.dropzone-input', app.formChanged )
[1680] Fix | Delete
.one( 'click touchstart', '.wpforms-signature-canvas', app.formChanged )
[1681] Fix | Delete
.one( 'wpformsRichTextContentChange', app.richTextContentChanged );
[1682] Fix | Delete
[1683] Fix | Delete
$( 'form.wpforms-form' ).on( 'wpformsBeforePageChange', app.skipEmptyPages );
[1684] Fix | Delete
},
[1685] Fix | Delete
[1686] Fix | Delete
/**
[1687] Fix | Delete
* Skip empty pages (by CL, hidden fields etc.) inside multi-steps forms.
[1688] Fix | Delete
*
[1689] Fix | Delete
* @since 1.8.5
[1690] Fix | Delete
*
[1691] Fix | Delete
* @param {Event} event Event.
[1692] Fix | Delete
* @param {number} nextPage Next page.
[1693] Fix | Delete
* @param {jQuery} $form Current form.
[1694] Fix | Delete
* @param {string} action The navigation action.
[1695] Fix | Delete
*/
[1696] Fix | Delete
skipEmptyPages( event, nextPage, $form, action ) {
[1697] Fix | Delete
const nextNonEmptyPage = app.findNonEmptyPage( nextPage, $form, action );
[1698] Fix | Delete
[1699] Fix | Delete
if ( nextNonEmptyPage === nextPage ) {
[1700] Fix | Delete
return;
[1701] Fix | Delete
}
[1702] Fix | Delete
[1703] Fix | Delete
event.preventDefault();
[1704] Fix | Delete
[1705] Fix | Delete
if ( nextNonEmptyPage === 1 && action === 'prev' ) {
[1706] Fix | Delete
const $secondPage = $form.find( '.wpforms-page-2' );
[1707] Fix | Delete
const $currentPage = $form.find( '.wpforms-page-' + nextPage );
[1708] Fix | Delete
// The previous button is optional. We pass the fallback to the original previous button
[1709] Fix | Delete
// in the case when the previous button on the second page does not exist.
[1710] Fix | Delete
const $prevButton = $secondPage.find( '.wpforms-page-prev' ).length
[1711] Fix | Delete
? $secondPage.find( '.wpforms-page-prev' )
[1712] Fix | Delete
: $currentPage.find( '.wpforms-page-prev' );
[1713] Fix | Delete
[1714] Fix | Delete
wpforms.navigateToPage( $prevButton, 'prev', 2, $form, $secondPage );
[1715] Fix | Delete
[1716] Fix | Delete
return;
[1717] Fix | Delete
}
[1718] Fix | Delete
[1719] Fix | Delete
// The next page button is always visible.
[1720] Fix | Delete
// So we take the previous page before the next non-empty page
[1721] Fix | Delete
// and simulate a jump forward from the next page.
[1722] Fix | Delete
const prevPage = nextNonEmptyPage - 1;
[1723] Fix | Delete
const $previousPage = $form.find( '.wpforms-page-' + prevPage );
[1724] Fix | Delete
[1725] Fix | Delete
wpforms.navigateToPage( $previousPage.find( '.wpforms-page-next' ), 'next', prevPage, $form, $previousPage );
[1726] Fix | Delete
},
[1727] Fix | Delete
[1728] Fix | Delete
/**
[1729] Fix | Delete
* Find the next non-empty page.
[1730] Fix | Delete
*
[1731] Fix | Delete
* @since 1.8.5
[1732] Fix | Delete
*
[1733] Fix | Delete
* @param {number} page Current page.
[1734] Fix | Delete
* @param {jQuery} $form Current form.
[1735] Fix | Delete
* @param {string} action The navigation action.
[1736] Fix | Delete
*
[1737] Fix | Delete
* @return {number} The next non-empty page number.
[1738] Fix | Delete
*/
[1739] Fix | Delete
findNonEmptyPage( page, $form, action ) {
[1740] Fix | Delete
let nextNonEmptyPage = page;
[1741] Fix | Delete
[1742] Fix | Delete
while ( app.isEmptyPage( $form, nextNonEmptyPage ) ) {
[1743] Fix | Delete
if ( action === 'prev' ) {
[1744] Fix | Delete
nextNonEmptyPage--;
[1745] Fix | Delete
} else {
[1746] Fix | Delete
nextNonEmptyPage++;
[1747] Fix | Delete
}
[1748] Fix | Delete
}
[1749] Fix | Delete
[1750] Fix | Delete
return nextNonEmptyPage;
[1751] Fix | Delete
},
[1752] Fix | Delete
[1753] Fix | Delete
/**
[1754] Fix | Delete
* Check the target page is empty.
[1755] Fix | Delete
*
[1756] Fix | Delete
* @since 1.8.5
[1757] Fix | Delete
*
[1758] Fix | Delete
* @param {jQuery} $form Current form.
[1759] Fix | Delete
* @param {number} page Page number.
[1760] Fix | Delete
*
[1761] Fix | Delete
* @return {boolean} True if page is empty.
[1762] Fix | Delete
*/
[1763] Fix | Delete
isEmptyPage( $form, page ) {
[1764] Fix | Delete
// The first page is always visible.
[1765] Fix | Delete
if ( page === 1 ) {
[1766] Fix | Delete
return false;
[1767] Fix | Delete
}
[1768] Fix | Delete
[1769] Fix | Delete
const $currentPage = $form.find( '.wpforms-page-' + page );
[1770] Fix | Delete
[1771] Fix | Delete
// The last page has the "Submit" button, so it's always non-empty.
[1772] Fix | Delete
if ( $currentPage.hasClass( 'last' ) ) {
[1773] Fix | Delete
return false;
[1774] Fix | Delete
}
[1775] Fix | Delete
[1776] Fix | Delete
const $fieldsOnPage = $currentPage.find( '.wpforms-field:not(.wpforms-field-pagebreak):not(.wpforms-field-hidden)' );
[1777] Fix | Delete
[1778] Fix | Delete
return $currentPage.find( '.wpforms-conditional-hide' ).length === $fieldsOnPage.length;
[1779] Fix | Delete
},
[1780] Fix | Delete
[1781] Fix | Delete
/**
[1782] Fix | Delete
* Form changed.
[1783] Fix | Delete
*
[1784] Fix | Delete
* @since 1.8.3
[1785] Fix | Delete
*
[1786] Fix | Delete
* @param {Object} event Event object.
[1787] Fix | Delete
*/
[1788] Fix | Delete
formChanged( event ) {
[1789] Fix | Delete
const $form = $( this ).closest( '.wpforms-form' );
[1790] Fix | Delete
[1791] Fix | Delete
app.maybeSetStartTime( $form );
[1792] Fix | Delete
},
[1793] Fix | Delete
[1794] Fix | Delete
/**
[1795] Fix | Delete
* Rich text content changed.
[1796] Fix | Delete
*
[1797] Fix | Delete
* @since 1.8.3
[1798] Fix | Delete
*
[1799] Fix | Delete
* @param {Object} event Event object.
[1800] Fix | Delete
* @param {Object} mutation Mutation object.
[1801] Fix | Delete
* @param {Object} editor Editor object.
[1802] Fix | Delete
*/
[1803] Fix | Delete
richTextContentChanged( event, mutation, editor ) {
[1804] Fix | Delete
const container = editor.getContainer();
[1805] Fix | Delete
[1806] Fix | Delete
const $form = $( container ).closest( '.wpforms-form' );
[1807] Fix | Delete
[1808] Fix | Delete
app.maybeSetStartTime( $form );
[1809] Fix | Delete
},
[1810] Fix | Delete
[1811] Fix | Delete
/**
[1812] Fix | Delete
* Maybe set start time for anti-spam timer.
[1813] Fix | Delete
*
[1814] Fix | Delete
* @since 1.8.3
[1815] Fix | Delete
*
[1816] Fix | Delete
* @param {jQuery} $form Form element.
[1817] Fix | Delete
*/
[1818] Fix | Delete
maybeSetStartTime( $form ) {
[1819] Fix | Delete
if ( $form.data( 'timestamp' ) ) {
[1820] Fix | Delete
return;
[1821] Fix | Delete
}
[1822] Fix | Delete
[1823] Fix | Delete
if ( $form.hasClass( 'wpforms-ajax-form' ) && typeof FormData !== 'undefined' ) {
[1824] Fix | Delete
$form.data( 'timestamp', Date.now() );
[1825] Fix | Delete
return;
[1826] Fix | Delete
}
[1827] Fix | Delete
[1828] Fix | Delete
$form.append( '<input type="hidden" name="start_timestamp" value="' + Date.now() + '">' );
[1829] Fix | Delete
},
[1830] Fix | Delete
[1831] Fix | Delete
/**
[1832] Fix | Delete
* Entry preview field callback for a page changing.
[1833] Fix | Delete
*
[1834] Fix | Delete
* @since 1.6.9
[1835] Fix | Delete
* @deprecated 1.7.0
[1836] Fix | Delete
*
[1837] Fix | Delete
* @param {Event} event Event.
[1838] Fix | Delete
* @param {number} currentPage Current page.
[1839] Fix | Delete
* @param {jQuery} $form Current form.
[1840] Fix | Delete
*/
[1841] Fix | Delete
entryPreviewFieldPageChange( event, currentPage, $form ) {
[1842] Fix | Delete
// eslint-disable-next-line no-console
[1843] Fix | Delete
console.warn( 'WARNING! Obsolete function called. Function wpforms.entryPreviewFieldPageChange has been deprecated, please use the WPFormsEntryPreview.pageChange function instead!' );
[1844] Fix | Delete
WPFormsEntryPreview.pageChange( event, currentPage, $form );
[1845] Fix | Delete
},
[1846] Fix | Delete
[1847] Fix | Delete
/**
[1848] Fix | Delete
* Update the entry preview fields on the page.
[1849] Fix | Delete
*
[1850] Fix | Delete
* @since 1.6.9
[1851] Fix | Delete
* @deprecated 1.7.0
[1852] Fix | Delete
*
[1853] Fix | Delete
* @param {number} currentPage Current page.
[1854] Fix | Delete
* @param {jQuery} $form Current form.
[1855] Fix | Delete
*/
[1856] Fix | Delete
entryPreviewFieldUpdate( currentPage, $form ) {
[1857] Fix | Delete
// eslint-disable-next-line no-console
[1858] Fix | Delete
console.warn( 'WARNING! Obsolete function called. Function wpforms.entryPreviewFieldUpdate has been deprecated, please use the WPFormsEntryPreview.update function instead!' );
[1859] Fix | Delete
WPFormsEntryPreview.update( currentPage, $form );
[1860] Fix | Delete
},
[1861] Fix | Delete
[1862] Fix | Delete
/**
[1863] Fix | Delete
* Scroll to and focus on the field with error.
[1864] Fix | Delete
*
[1865] Fix | Delete
* @since 1.5.8
[1866] Fix | Delete
*
[1867] Fix | Delete
* @param {jQuery} $el Form, container or input element jQuery object.
[1868] Fix | Delete
*/
[1869] Fix | Delete
scrollToError( $el ) {
[1870] Fix | Delete
if ( $el.length === 0 ) {
[1871] Fix | Delete
return;
[1872] Fix | Delete
}
[1873] Fix | Delete
[1874] Fix | Delete
// Look for a field with an error inside an $el.
[1875] Fix | Delete
let $field = $el.find( '.wpforms-field.wpforms-has-error' );
[1876] Fix | Delete
[1877] Fix | Delete
// Look outside in not found inside.
[1878] Fix | Delete
if ( $field.length === 0 ) {
[1879] Fix | Delete
$field = $el.closest( '.wpforms-field' );
[1880] Fix | Delete
}
[1881] Fix | Delete
[1882] Fix | Delete
if ( $field.length === 0 ) {
[1883] Fix | Delete
return;
[1884] Fix | Delete
}
[1885] Fix | Delete
[1886] Fix | Delete
const offset = $field.offset();
[1887] Fix | Delete
[1888] Fix | Delete
if ( typeof offset === 'undefined' ) {
[1889] Fix | Delete
return;
[1890] Fix | Delete
}
[1891] Fix | Delete
[1892] Fix | Delete
app.animateScrollTop( offset.top - 75, 750 ).done( function() {
[1893] Fix | Delete
const $error = $field.find( '.wpforms-error' ).first();
[1894] Fix | Delete
if ( typeof $error.focus === 'function' ) {
[1895] Fix | Delete
$error.trigger( 'focus' );
[1896] Fix | Delete
}
[1897] Fix | Delete
} );
[1898] Fix | Delete
},
[1899] Fix | Delete
[1900] Fix | Delete
/**
[1901] Fix | Delete
* Update Pagebreak navigation.
[1902] Fix | Delete
*
[1903] Fix | Delete
* @since 1.2.2
[1904] Fix | Delete
*
[1905] Fix | Delete
* @param {jQuery} el jQuery element object.
[1906] Fix | Delete
*/
[1907] Fix | Delete
pagebreakNav( el ) {
[1908] Fix | Delete
const $this = $( el ),
[1909] Fix | Delete
action = $this.data( 'action' ),
[1910] Fix | Delete
page = $this.data( 'page' ),
[1911] Fix | Delete
$form = $this.closest( '.wpforms-form' ),
[1912] Fix | Delete
$page = $form.find( '.wpforms-page-' + page );
[1913] Fix | Delete
[1914] Fix | Delete
app.saveTinyMCE();
[1915] Fix | Delete
[1916] Fix | Delete
if ( 'next' === action && ( typeof $.fn.validate !== 'undefined' ) ) {
[1917] Fix | Delete
app.checkForInvalidFields( $form, $page, function() {
[1918] Fix | Delete
app.navigateToPage( $this, action, page, $form, $page );
[1919] Fix | Delete
} );
[1920] Fix | Delete
return;
[1921] Fix | Delete
}
[1922] Fix | Delete
[1923] Fix | Delete
if ( 'prev' === action || 'next' === action ) {
[1924] Fix | Delete
app.navigateToPage( $this, action, page, $form, $page );
[1925] Fix | Delete
}
[1926] Fix | Delete
},
[1927] Fix | Delete
[1928] Fix | Delete
/**
[1929] Fix | Delete
* Check the validity of all the fields in the current page.
[1930] Fix | Delete
*
[1931] Fix | Delete
* @since 1.7.6
[1932] Fix | Delete
*
[1933] Fix | Delete
* @param {jQuery} $form WPForms element object.
[1934] Fix | Delete
* @param {jQuery} $page Current page element object in page break context.
[1935] Fix | Delete
* @param {Function} callback Callback to run when all fields are valid.
[1936] Fix | Delete
*/
[1937] Fix | Delete
checkForInvalidFields( $form, $page, callback ) {
[1938] Fix | Delete
const validator = $form.data( 'validator' );
[1939] Fix | Delete
if ( ! validator ) {
[1940] Fix | Delete
return;
[1941] Fix | Delete
}
[1942] Fix | Delete
[1943] Fix | Delete
if ( validator.pendingRequest > 0 ) {
[1944] Fix | Delete
setTimeout( function() {
[1945] Fix | Delete
app.checkForInvalidFields( $form, $page, callback );
[1946] Fix | Delete
}, 800 );
[1947] Fix | Delete
[1948] Fix | Delete
return;
[1949] Fix | Delete
}
[1950] Fix | Delete
[1951] Fix | Delete
let valid = true;
[1952] Fix | Delete
[1953] Fix | Delete
$page.find( ':input' ).each( function( index, el ) {
[1954] Fix | Delete
const $el = $( el );
[1955] Fix | Delete
// Skip input fields without `name` attribute, which could have fields.
[1956] Fix | Delete
// E.g. `Placeholder` input for Modern dropdown.
[1957] Fix | Delete
if ( ! $el.attr( 'name' ) ) {
[1958] Fix | Delete
return;
[1959] Fix | Delete
}
[1960] Fix | Delete
[1961] Fix | Delete
// Skip validation for some fields.
[1962] Fix | Delete
// E.g., applied coupon hidden field.
[1963] Fix | Delete
if ( $el.hasClass( 'wpforms-field-skip-validation' ) ) {
[1964] Fix | Delete
return;
[1965] Fix | Delete
}
[1966] Fix | Delete
[1967] Fix | Delete
if ( ! $( el ).valid() ) {
[1968] Fix | Delete
valid = false;
[1969] Fix | Delete
}
[1970] Fix | Delete
} );
[1971] Fix | Delete
[1972] Fix | Delete
if ( ! valid ) {
[1973] Fix | Delete
app.scrollToError( $page );
[1974] Fix | Delete
} else {
[1975] Fix | Delete
callback();
[1976] Fix | Delete
}
[1977] Fix | Delete
},
[1978] Fix | Delete
[1979] Fix | Delete
/**
[1980] Fix | Delete
* Navigate through page break pages.
[1981] Fix | Delete
*
[1982] Fix | Delete
* @since 1.7.6
[1983] Fix | Delete
*
[1984] Fix | Delete
* @param {jQuery} $this jQuery element of the next / prev nav button.
[1985] Fix | Delete
* @param {string} action The navigation action.
[1986] Fix | Delete
* @param {number} page Current page number.
[1987] Fix | Delete
* @param {jQuery} $form WPForms element object.
[1988] Fix | Delete
* @param {jQuery} $page Current page element object in page break context.
[1989] Fix | Delete
*/
[1990] Fix | Delete
navigateToPage( $this, action, page, $form, $page ) {
[1991] Fix | Delete
if ( $this.hasClass( 'wpforms-disabled' ) ) {
[1992] Fix | Delete
return;
[1993] Fix | Delete
}
[1994] Fix | Delete
[1995] Fix | Delete
let nextPage = page;
[1996] Fix | Delete
[1997] Fix | Delete
if ( 'next' === action ) {
[1998] Fix | Delete
nextPage += 1;
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function