diff --git a/assets/js/.ea-donate-form.js.swp b/assets/js/.ea-donate-form.js.swp deleted file mode 100644 index 5993b36..0000000 Binary files a/assets/js/.ea-donate-form.js.swp and /dev/null differ diff --git a/assets/js/everyaction_pledge_shim.js b/assets/js/everyaction_pledge_shim.js index c3251d8..4d62675 100644 --- a/assets/js/everyaction_pledge_shim.js +++ b/assets/js/everyaction_pledge_shim.js @@ -51,7 +51,6 @@ current_frequency = $(this).val(); } }); - set_required_amount(); } function set_required_amount() { @@ -68,8 +67,19 @@ } else { $("input[name='OtherAmount']").val(required_donation_amount); } + $("input[name='OtherAmount']").focus(); } + /* TK; A function to compare the required_donation_amount value + * (or if frequency is 4, required_installment_amount value) + * to each of the visible giving levels and disable any that are + * less than that value. + */ + + + /* TK: a function to to clear the shopping_cart cookie on successful form donation + */ + let initialize_form_when_ready = function () { if (!$("input[title='PCodes']").length) { setTimeout(initialize_form_when_ready, 100); @@ -79,6 +89,7 @@ update_pcode_and_premium_and_value_fields(); $('input[name="SelectedFrequency"]').on('change click', function () { check_frequency(); + set_required_amount(); }); } @@ -86,4 +97,4 @@ var nvtag_callbacks = nvtag_callbacks || {}; nvtag_callbacks.postRender = nvtag_callbacks.postRender || []; - nvtag_callbacks.postRender.push(initialize_form_when_ready); \ No newline at end of file + nvtag_callbacks.postRender.push(initialize_form_when_ready); diff --git a/wnet-everyaction-wp-css-and-js.php b/wnet-everyaction-wp-css-and-js.php index 5dc4e65..6c0a457 100644 --- a/wnet-everyaction-wp-css-and-js.php +++ b/wnet-everyaction-wp-css-and-js.php @@ -2,7 +2,7 @@ /* Plugin Name: WNET EveryAction WP CSS and JS Description: A container to maintain the custom JS and CSS for embedded EveryAction forms on WNET sites -Version: 2023.03.23 +Version: 2024.12.12 Authors: WNET Digital (plugin), MWD (JS and CSS) */ @@ -27,6 +27,14 @@ public function enqueue_scripts() { wp_register_script( $this->token . '_js' , $this->assets_url . 'js/ea-donate-form.js', array('jquery'), $this->version, true ); wp_enqueue_script( $this->token . '_js' ); wp_enqueue_style( $this->token . '_css', $this->assets_url . 'css/ea-donate-form-theme-styles.css', null, $this->version); + + // enqueue the pledge shim on one specific form + if ( is_singular('contribute')) { + global $post; + if ('premium-checkout' == $post->post_name) { + wp_enqueue_script('everyaction_pledge_shim',$this->assets_url . 'js/everyaction_pledge_shim.js', array('jquery','js-cookie'), $this->version, true); + } + } }