PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21
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
← All changes | js/admin/settings.js +2 -71 6.306.21 View file →
@@ -1,15 +1,9 @@
1 1 ( function() {
2 - 'use strict';
3 2
4 - const globalVars = {
5 - sendTestEmailModal: null
6 - };
7 -
8 3 function addEventListeners() {
9 4 document.addEventListener( 'change', handleChangeEvent );
10 5 document.addEventListener( 'keydown', handleKeyDownEvent );
11 - document.addEventListener( 'click', handleClickEvent );
12 6 }
13 7
14 8 function handleChangeEvent( e ) {
15 9 if ( 'INPUT' === e.target.nodeName && 'checkbox' === e.target.type && e.target.parentNode.classList.contains( 'frm_toggle_block' ) ) {
@@ -15,15 +9,15 @@
15 9 if ( 'INPUT' === e.target.nodeName && 'checkbox' === e.target.type && e.target.parentNode.classList.contains( 'frm_toggle_block' ) ) {
16 10 handleToggleChangeEvent( e );
17 11 }
18 12
19 - if ( 'frm_currency' === e.target.id ) {
13 + if ( 'frm_currency' === e.target.id) {
20 14 syncCurrencyOptions( e.target );
21 15 }
22 16 }
23 17
24 18 function handleKeyDownEvent( e ) {
25 - switch ( e.key ) { // eslint-disable-line sonarjs/no-small-switch
19 + switch ( e.key ) {
26 20 case ' ':
27 21 handleSpaceDownEvent( e );
28 22 break;
29 23 }
@@ -30,71 +24,8 @@
30 24 }
31 25
32 26 function handleToggleChangeEvent( e ) {
33 27 e.target.nextElementSibling.setAttribute( 'aria-checked', e.target.checked ? 'true' : 'false' );
34 - }
35 -
36 - function handleClickEvent( e ) {
37 - if ( 'BUTTON' === e.target.nodeName && 'choose' === e.target.dataset.action && e.target.closest( '.frm-email-style' ) ) {
38 - handleClickChooseEmailStyle( e );
39 - return;
40 - }
41 -
42 - if ( 'frm-send-test-email' === e.target.id ) {
43 - showSendTestEmailModal();
44 - return;
45 - }
46 -
47 - if ( 'frm-send-test-email-btn' === e.target.id ) {
48 - handleClickSendTestEmailBtn();
49 - }
50 - }
51 -
52 - function handleClickChooseEmailStyle( e ) {
53 - const styleEls = document.querySelectorAll( '.frm-email-style' );
54 - styleEls.forEach( el => {
55 - el.classList.remove( 'frm-email-style--selected' );
56 - } );
57 -
58 - const styleEl = e.target.closest( '.frm-email-style' );
59 - styleEl.classList.add( 'frm-email-style--selected' );
60 -
61 - const { styleKey } = styleEl.dataset;
62 - document.getElementById( 'frm-email-style-value' ).value = styleKey;
63 - }
64 -
65 - function showSendTestEmailModal() {
66 - if ( ! globalVars.sendTestEmailModal ) {
67 - globalVars.sendTestEmailModal = frmAdminBuild.initModal( '#frm-send-test-email-modal', '400px' );
68 - }
69 -
70 - globalVars.sendTestEmailModal.dialog( 'open' );
71 - }
72 -
73 - function handleClickSendTestEmailBtn() {
74 - const emailInput = document.getElementById( 'frm-test-email-address' );
75 - const resultEl = document.getElementById( 'frm-send-test-email-result' );
76 -
77 - const showResult = ( msg, success ) => {
78 - resultEl.textContent = msg;
79 - resultEl.classList.add( success ? 'frm_updated_message' : 'frm_error_style' );
80 - };
81 -
82 - resultEl.textContent = '';
83 - resultEl.classList.remove( 'frm_error_style', 'frm_updated_message' );
84 -
85 - if ( ! emailInput.value ) {
86 - showResult( 'Empty email address' );
87 - return;
88 - }
89 -
90 - const data = new FormData();
91 - data.append( 'emails_str', emailInput.value );
92 - frmDom.ajax.doJsonPost( 'send_test_email', data ).then( response => {
93 - showResult( response, true );
94 - } ).catch( error => {
95 - showResult( error );
96 - } );
97 28 }
98 29
99 30 /**
100 31 * Updates the currency formatting options based on the selected currency.