MediaWiki:DonationFormSandbox.js: Difference between revisions
Content deleted Content added
m Reverted edits by PPenloglou-WMF (talk) to last revision by Pcoombe Tag: Rollback |
m Bringing this up to date with DonationForm.js |
||
Line 795:
}
if ( frequency
params.recurring =
} else if (
params.recurring = '1';
params.frequency_unit = 'year';
}
Line 1,027 ⟶ 1,029:
if ( form.opt_in ) {
if ( $('input[name="opt_in"]:checked').val() === undefined ) {
$('#error-optin').show().focus();
error = true;
} else {
Line 1,048 ⟶ 1,050:
$('.amount-options').addClass('lp-haserror');
$('.lp-error-bigamount').hide();
$('.lp-error-smallamount').show().focus();
return false;
} else if ( amount > donationForm.maxLocal ) {
$('.amount-options').addClass('lp-haserror');
$('.lp-error-bigamount').show().focus();
return false;
} else {
Line 1,062 ⟶ 1,064:
};
donationForm.
return document.forms.donateForm.dataset.frequency || 'onetime';
if (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 ) {
} else {
}
};
Line 1,390 ⟶ 1,405:
donationForm.otherInputControl( document.getElementById('input_amount_other_box') );
//
$('.amount-options').on( 'input change', function() {
// Ideally we would validate the amount, but this causes issues with focus
▲ donationForm.validateAmount();
$('.amount-options .lp-error').hide();
donationForm.updateFeeDisplay();
});
Line 1,469 ⟶ 1,485:
});
// Allow preselecting
if (
donationForm.noRecurringCountries.indexOf( donationForm.country ) === -1
mw.util.getParamValue('monthly')▼
&& mw.util.getParamValue( '
&&
&& mw.util.getParamValue('utm_medium') !== 'endowment'▼
) {
▲ } else if ( mw.util.getParamValue('monthly') && mw.util.getParamValue('
// old method with "monthly=" parameter
donationForm.setFrequency( 'monthly' );
} else {
donationForm.setFrequency( 'onetime' );
}
}
|