MediaWiki:DonationForm.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
don't just overwrite existing utm_key phab:T256681
create noRecurringCountries to hide monthly option, disallow monthly preselect for them - phab:T234235
Line 10:
'vh' : window.innerHeight
};
 
// Don't offer recurring at all in these countries
donationForm.noRecurringCountries = [ 'AR', 'CL', 'CO', 'MX', 'PE', 'BR', 'IN' ];
 
donationForm.maxUSD = 12000;
Line 678 ⟶ 681:
donationForm.redirectPayment = function( paymentMethod, paymentSubMethod, skipAmountValidation ) {
 
var form = document.forms['donateForm']; // we should really change this some day
 
if ( donationForm.validate( skipAmountValidation ) ) {
Line 1,041 ⟶ 1,044:
form.referrer.value = document.referrer.replace(/https?:\/\//i, "");
 
// hide frequency options infor India,some where we can only handle one-time donationscountries
if ( donationForm.noRecurringCountries.indexOf( form.country.value =) !== 'IN'-1 ) {
$("'#frequency_onetime"').prop('checked', true);
$("'.frequency-options", #cancel-monthly').hide();
$("#cancel-monthly").hide();
}
 
Line 1,066 ⟶ 1,068:
 
// Allow preselecting monthly
if( mw.util.getParamValue('monthly') ) {
&& donationForm.noRecurringCountries.indexOf( form.country.value ) === -1 ) {
$('#frequency_monthly').click();
}