PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.8
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.8
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / js / admin / entries.js

entries.js in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.8, at js/admin/entries.js

52 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Entries Page Script.
3 *
4 * Handles UI interactions on the Entries admin page.
5 */
6
7 wp.domReady( () => {
8
9 /**
10 * Internal dependencies
11 */
12 const { applyZebraStriping } = window.frmAdminBuild;
13 const { onClickPreventDefault } = frmDom.util;
14
15 /**
16 * Applies zebra striping to the entry view page table.
17 */
18 applyZebraStriping( '.frm-alt-table', 'frm-empty-row' );
19
20 /**
21 * Manages the behavior of the 'Show Empty Fields' button.
22 *
23 * Handles the initialization and event binding for the button. It toggles
24 * the button's state between showing and hiding empty fields in the table and adjusts
25 * the zebra striping accordingly.
26 */
27 manageShowEmptyFieldsButton();
28
29 function manageShowEmptyFieldsButton() {
30 const showEmptyFieldsButton = document.getElementById( 'frm-entry-show-empty-fields' );
31
32 // Early return if the button is not found in the DOM.
33 if ( ! showEmptyFieldsButton ) {
34 return;
35 }
36
37 if ( ! showEmptyFieldsButton.dataset.show ) {
38 showEmptyFieldsButton.dataset.show = 'false';
39 }
40
41 onClickPreventDefault( showEmptyFieldsButton, () => {
42 // Toggle button state and update table striping
43 const newShowState = showEmptyFieldsButton.dataset.show === 'true' ? 'false' : 'true';
44 showEmptyFieldsButton.dataset.show = newShowState;
45
46 setTimeout( () => {
47 applyZebraStriping( '.frm-alt-table', newShowState === 'true' ? '' : 'frm-empty-row' );
48 }, newShowState === 'true' ? 0 : 200 );
49 });
50 }
51 });
52