| 1 |
jQuery(document).ready(function () { |
| 2 |
const paypalTestMode = jQuery("#woocommerce_wp_subscription_paypal_testmode"); |
| 3 |
|
| 4 |
makePaypalTestModeChange(); |
| 5 |
paypalTestMode.change(makePaypalTestModeChange); |
| 6 |
|
| 7 |
function makePaypalTestModeChange() { |
| 8 |
if (paypalTestMode.is(":checked")) { |
| 9 |
// Base |
| 10 |
jQuery(".wpsubs-paypal-live-creds").hide(); |
| 11 |
jQuery(".wpsubs-paypal-sandbox-creds").show(); |
| 12 |
|
| 13 |
// Titles |
| 14 |
jQuery(".wc-settings-sub-title.wpsubs-paypal-live-creds").hide(); |
| 15 |
jQuery(".wc-settings-sub-title.wpsubs-paypal-sandbox-creds").show(); |
| 16 |
|
| 17 |
// Input fields |
| 18 |
jQuery("input.wpsubs-paypal-live-creds").parent().parent().parent().hide(); |
| 19 |
jQuery("input.wpsubs-paypal-sandbox-creds").parent().parent().parent().show(); |
| 20 |
|
| 21 |
// Text areas |
| 22 |
jQuery("textarea.wpsubs-paypal-live-creds").parent().parent().parent().hide(); |
| 23 |
jQuery("textarea.wpsubs-paypal-sandbox-creds").parent().parent().parent().show(); |
| 24 |
|
| 25 |
// Selects |
| 26 |
jQuery("select.wpsubs-paypal-live-creds").parent().parent().parent().hide(); |
| 27 |
jQuery("select.wpsubs-paypal-sandbox-creds").parent().parent().parent().show(); |
| 28 |
} else { |
| 29 |
// Base |
| 30 |
jQuery(".wpsubs-paypal-live-creds").show(); |
| 31 |
jQuery(".wpsubs-paypal-sandbox-creds").hide(); |
| 32 |
|
| 33 |
// Titles |
| 34 |
jQuery(".wc-settings-sub-title.wpsubs-paypal-live-creds").show(); |
| 35 |
jQuery(".wc-settings-sub-title.wpsubs-paypal-sandbox-creds").hide(); |
| 36 |
|
| 37 |
// Input fields |
| 38 |
jQuery("input.wpsubs-paypal-live-creds").parent().parent().parent().show(); |
| 39 |
jQuery("input.wpsubs-paypal-sandbox-creds").parent().parent().parent().hide(); |
| 40 |
|
| 41 |
// Text areas |
| 42 |
jQuery("textarea.wpsubs-paypal-live-creds").parent().parent().parent().show(); |
| 43 |
jQuery("textarea.wpsubs-paypal-sandbox-creds").parent().parent().parent().hide(); |
| 44 |
|
| 45 |
// Selects |
| 46 |
jQuery("select.wpsubs-paypal-live-creds").parent().parent().parent().show(); |
| 47 |
jQuery("select.wpsubs-paypal-sandbox-creds").parent().parent().parent().hide(); |
| 48 |
} |
| 49 |
} |
| 50 |
}); |
| 51 |
|