PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.24
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.24
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 +18 -2 6.36.24 View file →
@@ -1,6 +1,5 @@
1 1 ( function() {
2 -
3 2 function addEventListeners() {
4 3 document.addEventListener( 'change', handleChangeEvent );
5 4 document.addEventListener( 'keydown', handleKeyDownEvent );
6 5 }
@@ -8,12 +7,16 @@
8 7 function handleChangeEvent( e ) {
9 8 if ( 'INPUT' === e.target.nodeName && 'checkbox' === e.target.type && e.target.parentNode.classList.contains( 'frm_toggle_block' ) ) {
10 9 handleToggleChangeEvent( e );
11 10 }
11 +
12 + if ( 'frm_currency' === e.target.id ) {
13 + syncCurrencyOptions( e.target );
14 + }
12 15 }
13 16
14 17 function handleKeyDownEvent( e ) {
15 - switch ( e.key ) {
18 + switch ( e.key ) { // eslint-disable-line sonarjs/no-small-switch
16 19 case ' ':
17 20 handleSpaceDownEvent( e );
18 21 break;
19 22 }
@@ -20,8 +23,21 @@
20 23 }
21 24
22 25 function handleToggleChangeEvent( e ) {
23 26 e.target.nextElementSibling.setAttribute( 'aria-checked', e.target.checked ? 'true' : 'false' );
27 + }
28 +
29 + /**
30 + * Updates the currency formatting options based on the selected currency.
31 + *
32 + * @param {HTMLSelectElement} currencySelect The currency select element.
33 + */
34 + function syncCurrencyOptions( currencySelect ) {
35 + const currency = frmSettings.currencies[ currencySelect.value ];
36 +
37 + document.getElementById( 'frm_thousand_separator' ).value = currency.thousand_separator;
38 + document.getElementById( 'frm_decimal_separator' ).value = currency.decimal_separator;
39 + document.getElementById( 'frm_decimals' ).value = currency.decimals;
24 40 }
25 41
26 42 function handleSpaceDownEvent( e ) {
27 43 if ( e.target.classList.contains( 'frm_toggle' ) ) {