PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.24.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.24.1
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 +0 -70 6.25 → 6.24.1 View file →
@@ -1,15 +1,8 @@
1 1 ( function() {
2 - 'use strict';
3 -
4 - const globalVars = {
5 - sendTestEmailModal: null
6 - };
7 -
8 2 function addEventListeners() {
9 3 document.addEventListener( 'change', handleChangeEvent );
10 4 document.addEventListener( 'keydown', handleKeyDownEvent );
11 - document.addEventListener( 'click', handleClickEvent );
12 5 }
13 6
14 7 function handleChangeEvent( e ) {
15 8 if ( 'INPUT' === e.target.nodeName && 'checkbox' === e.target.type && e.target.parentNode.classList.contains( 'frm_toggle_block' ) ) {
@@ -30,71 +23,8 @@
30 23 }
31 24
32 25 function handleToggleChangeEvent( e ) {
33 26 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( e );
44 - return;
45 - }
46 -
47 - if ( 'frm-send-test-email-btn' === e.target.id ) {
48 - handleClickSendTestEmailBtn( e );
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.styleKey;
62 - document.getElementById( 'frm-email-style-value' ).value = styleKey;
63 - }
64 -
65 - function showSendTestEmailModal( e ) {
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( e ) {
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 27 }
98 28
99 29 /**
100 30 * Updates the currency formatting options based on the selected currency.