MediaWiki:DonationForm mctest.js: Difference between revisions

Content deleted Content added
split finalStep from redirectPayments, so we can call it back from monthlyconvert if needed
hook in monthly convert
Line 711:
params.country = donationForm.country;
params.uselang = mw.config.get('wgPageContentLanguage'); // see T281285 for why not wgUserLanguage
 
if ( params.uselang === 'pt' && params.country === 'BR' ) {
params.uselang = 'pt-br';
Line 750:
}
 
// Check for monthly convert. TODO: make it possible to test JS variants
donationForm.finalStep( params );
if ( mw.util.getParamValue('monthlyconvert') ) {
mc.main( params, donationForm.finalStep );
} else {
donationForm.finalStep( params );
}
 
} else {
Line 787 ⟶ 792:
window.location.href = uri.toString();
}
};
 
/**
Line 881 ⟶ 886:
* Does some awful regex stuff to rm symbols and turn the string into a number
* Remember some locales flip . & , for decimal point/thousands separator
*
* @param {string} value Value of "Other" field
* @return {float} Float with amount, or 0 if NaN
Line 892 ⟶ 897:
value = value.replace(/[\$£€¥,.]/g, '');
value = value.replace(/:/, '.');
 
amount = parseFloat( value );
if ( isNaN( amount ) ) {
Line 1,051 ⟶ 1,056:
 
var form = document.forms['donateForm'];
 
// Load monthly convert JS if needed
// TODO: allow loading different JS variants, either here or defined in the Template