MediaWiki:DonationFormSelectedAsk.js: Difference between revisions

Content deleted Content added
Creating DonationFormSelectedAsk.js from latest DonationFormSandbox.js edits
 
Adding selectedAsk functionality
 
Line 696:
donationForm.updateFeeDisplay();
}
}
 
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();
}
}
 
Line 1,533 ⟶ 1,549:
adjustHPC();
preSelect(); // Make sure to do this *after* other fiddling with values
setSelectedAsk();
donationForm.localizeErrors();
}