MediaWiki:DonationForm.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
aligning amounts, mention tracking doc
modify updateFeeDisplay to not show PTF if it would take donation over max amount
Line 945: Line 945:


donationForm.updateFeeDisplay = function() {
donationForm.updateFeeDisplay = function() {
var feeAmount = donationForm.calculateFee( donationForm.getAmount() );
var selectedAmount = donationForm.getAmount(),
feeAmount = donationForm.calculateFee( selectedAmount ),
minAmount = donationForm.minimums[ donationForm.currency ] || 1,
maxAmount = donationForm.maxUSD * minAmount,
feeText;

if ( feeAmount % 1 !== 0 ) { // Not a whole number
if ( feeAmount % 1 !== 0 ) { // Not a whole number
feeAmount = feeAmount.toFixed(2);
feeText = feeAmount.toFixed(2);
} else {
} else {
feeAmount = feeAmount.toString();
feeText = feeAmount.toString();
}

$('.ptf label span').text( feeText );
if ( selectedAmount + feeAmount <= maxAmount ) {
$('.ptf').slideDown();
}
}
$('.ptf label span').text( feeAmount );
$('.ptf').slideDown();
};
};