diff --git a/assets/donate/donate.css b/assets/donate/donate.css index 0167e31..86a890d 100644 --- a/assets/donate/donate.css +++ b/assets/donate/donate.css @@ -55,6 +55,5 @@ @media (prefers-reduced-motion:reduce){.sg-donate .sg-progress-fill{transition:none}} .sg-donate .sg-thanks{margin:.5rem 0 0;padding:1.1rem 1rem;border:1px solid rgba(26,127,55,.55);border-left-width:4px;border-radius:.4rem;text-align:center} .sg-donate .sg-thanks:focus{outline:0} -.sg-donate .sg-thanks-title{margin:0 0 .8rem;font-size:1.15em;font-weight:700;line-height:1.4;overflow-wrap:anywhere} -.sg-donate .sg-again{cursor:pointer;min-height:44px} +.sg-donate .sg-thanks-title{margin:0;font-size:1.15em;font-weight:700;line-height:1.4;overflow-wrap:anywhere} .sg-donate [hidden]{display:none!important} diff --git a/assets/donate/donate.js b/assets/donate/donate.js index c5b95b2..533d8bd 100644 --- a/assets/donate/donate.js +++ b/assets/donate/donate.js @@ -262,26 +262,16 @@ }; } - // Swap the form for a clear confirmation (keeps the progress bar); "Donate again" restores it. + // Replace the form with a confirmation (keeps the progress bar). No way back until the page is reloaded, + // so the donor does not pay twice thinking it failed. function showThanks(text) { - var hidden = []; - Array.prototype.forEach.call(root.children, function (n) { - if (n === barBox || n.hidden) { return; } - n.hidden = true; hidden.push(n); - }); - var again = el('button', { type: 'button', 'class': 'sg-again', text: T.donateAgain || 'Donate again' }); + state.renderToken++; + Array.prototype.forEach.call(root.children, function (n) { if (n !== barBox) { n.hidden = true; } }); var panel = el('div', { 'class': 'sg-thanks', role: 'status', tabindex: '-1' }, [ - el('p', { 'class': 'sg-thanks-title', text: text }), - again + el('p', { 'class': 'sg-thanks-title', text: text }) ]); root.appendChild(panel); try { panel.focus(); panel.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); } catch (e) { /* ignore */ } - again.addEventListener('click', function () { - root.removeChild(panel); - hidden.forEach(function (n) { n.hidden = false; }); - msg.value = ''; say(''); - refresh(); renderButtons(); - }); } function renderButtons() { diff --git a/includes/Rest/DonateController.php b/includes/Rest/DonateController.php index f5a2dc9..c54543e 100644 --- a/includes/Rest/DonateController.php +++ b/includes/Rest/DonateController.php @@ -240,7 +240,6 @@ final class DonateController { 'coverFees' => __( 'Cover the processing fees', 'streamgoals-donate' ), 'total' => __( 'Total you will pay', 'streamgoals-donate' ), 'thanks' => __( 'Thank you for your donation!', 'streamgoals-donate' ), - 'donateAgain' => __( 'Donate again', 'streamgoals-donate' ), 'processing' => __( 'Your payment is being processed. Thank you!', 'streamgoals-donate' ), 'error' => __( 'Something went wrong. Please try again.', 'streamgoals-donate' ), 'sdkError' => __( 'Could not load PayPal.', 'streamgoals-donate' ),