Donate form: remove the form after a successful donation until page reload
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXhhC8xipsBR7e3o76i
This commit is contained in:
1 parent
565ee0a352
commit
55d1c34b1f
3 files changed
+6
-18
No files matched your search
@@ -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}
|
||||
+5
-15
@@ -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() {
|
||||
|
||||
@@ -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' ),
|
||||
|
||||
Reference in new issue
Block a user