MediaWiki:DonationFormSandbox.js: Difference between revisions
Content deleted Content added
m Bringing this up to date with DonationForm.js |
Trying out "selectedAsk" functionality. A more selective preSelecting in essence for donors who click on LNA CTAs or Button Stack CTAs |
||
Line 679:
return amounts;
}
function setSelectedAsk() {
/* Check for a 'selectedAsk' url parameter, round up and select the equivalent ask in the array.
If there isn't an option, do nothing */
var selectedAskAmount = parseFloat( mw.util.getParamValue('selectedAsk') );
selectedAskAmount = Math.round(selectedAskAmount);
console.log(selectedAskAmount);
if ( selectedAskAmount > 0 ) {
var $selectedAskAmountOption = $('input[name="amount"][value="' + selectedAskAmount + '"]');
if ( $selectedAskAmountOption.length ) {
// Select existing input
$selectedAskAmountOption.prop('checked', true);
}
donationForm.updateFeeDisplay();
}
}
|