diff --git a/static/give/afac26.html b/static/give/afac26.html
index d5edd37..2c5acc9 100644
--- a/static/give/afac26.html
+++ b/static/give/afac26.html
@@ -149,7 +149,18 @@
history.replaceState({}, '', location.pathname);
}
+ const amountParam = params.get('a');
let selectedDonation = 10;
+ if (amountParam) {
+ const amount = parseFloat(amountParam);
+ if (amount > 0) {
+ document.getElementById('custom-amount').value = amount % 1 === 0 ? amount : amount.toFixed(2);
+ const group = document.getElementById('donation-group');
+ group.querySelectorAll('wa-button').forEach(b => b.classList.remove('selected'));
+ group.querySelector('wa-button[data-value="custom"]').classList.add('selected');
+ selectedDonation = 'custom';
+ }
+ }
function setupButtonGroup(groupId, onChange) {
const group = document.getElementById(groupId);
@@ -178,7 +189,7 @@
donateBtn.addEventListener('click', async () => {
let donationCents = 0;
if (selectedDonation === 'custom') {
- donationCents = (parseInt(document.getElementById('custom-amount').value) || 0) * 100;
+ donationCents = Math.round((parseFloat(document.getElementById('custom-amount').value) || 0) * 100);
} else {
donationCents = selectedDonation * 100;
}