MediaWiki:DonationForm.js: Difference between revisions

Content deleted Content added
just hide the errors when amount is changed
merge in annual recurring js from MediaWiki:DonationFormAnnualRecurring.js
Line 795:
}
 
varlet frequency = $('input[name="frequency"]:checked')donationForm.valgetFrequency();
if ( frequency !=== 'monthly' ) {
params.recurring = false'1';
} else { params.frequency_unit = 'month';
} else if ( params.recurringfrequency === 'annual' ) true;{
params.recurring = '1';
params.frequency_unit = 'year';
}
 
Line 1,062 ⟶ 1,064:
};
 
donationForm.toggleMonthlygetFrequency = function(monthly) {
return document.forms.donateForm.dataset.frequency || 'onetime';
if (monthly) {
};
$('#form-wrapper').addClass('form-monthly');
 
donationForm.setFrequency = function( frequency ) {
// TODO: add some validation to reject invalid frequency values
let form = document.forms.donateForm;
 
form.frequency.value = frequency; // change input
form.dataset.frequency = frequency;
};
 
/* Wrapper for compatibility with old forms */
donationForm.toggleMonthly = function( monthly ) {
if ( monthly ) {
donationForm.setFrequency( 'monthly' );
} else {
$('#form-wrapper')donationForm.removeClasssetFrequency( 'form-monthlyonetime' );
}
};
Line 1,470 ⟶ 1,485:
});
 
// Allow preselecting monthlyfrequency if possible
if (
donationForm.noRecurringCountries.indexOf( donationForm.country ) === -1
mw.util.getParamValue('monthly')
&& mw.util.getParamValue( 'monthlyutm_medium' ) !== '0endowment'
&& donationFormmw.noRecurringCountriesutil.indexOfgetParamValue( donationForm.country'wmf_medium' ) =!== -1'endowment'
&& mw.util.getParamValue('utm_medium') !== 'endowment'
&& mw.util.getParamValue('wmf_medium') !== 'endowment'
) {
$if ( mw.util.getParamValue( '#frequency_monthlyfrequency' ).click( ); {
donationForm.setFrequency( mw.util.getParamValue( 'monthlyfrequency' ) );
} else if ( mw.util.getParamValue('monthly') && mw.util.getParamValue('utm_mediummonthly') !== 'endowment0' ) {
// old method with "monthly=" parameter
donationForm.setFrequency( 'monthly' );
} else {
donationForm.setFrequency( 'onetime' );
}
}