MediaWiki:DonationForm.js: Difference between revisions
Content deleted Content added
moving inline javascript from Template:Optin/Default |
using slightly better syntax for accessing form |
||
Line 210:
/* Localize the amount errors. Call when initialising form. */
donationForm.localizeErrors = function() {
var
var currency = form.currency_code.value;
var minAmount = donationForm.minimums[ currency ];
Line 677 ⟶ 678:
donationForm.redirectPayment = function( paymentMethod, paymentSubMethod, skipAmountValidation ) {
var form = document.forms['paypalcontribution']; // we should really change this some day
if ( donationForm.validate( skipAmountValidation ) ) {
Line 805 ⟶ 806:
/* Return amount selected or input */
donationForm.getAmount = function() {
var form = document.forms['paypalcontribution'];
var amount = null;
donationForm.extraData.otherAmt = 0;
Line 847 ⟶ 848:
var error = false;
var form = document.forms['paypalcontribution'];
// Reset all errors
Line 875 ⟶ 876:
donationForm.validateAmount = function() {
var form = document.forms['paypalcontribution'];
var amount = donationForm.getAmount();
var currency =
var minAmount = donationForm.minimums[ currency ] || 1;
Line 921 ⟶ 923:
*/
donationForm.calculateFee = function( amount ) {
var form = document.forms['paypalcontribution'];
// Minimum fee/PTF amounts. Default is 0.35.
Line 948 ⟶ 952:
var feeMultiplier = 0.04,
feeMinimum = feeMinimums[
feeAmount = amount * feeMultiplier;
Line 982 ⟶ 986:
mw.loader.using( ['mediawiki.util'] ).done( function() {
var form = document.forms['paypalcontribution'];
// Block typing symbols in input field, otherwise Safari allows them and then chokes
// https://phabricator.wikimedia.org/T118741, https://phabricator.wikimedia.org/T173431
var amountOtherInput = document.getElementById('input_amount_other_box');
if ( amountOtherInput ) {
Line 1,023 ⟶ 1,028:
});
if (
// Strip protocol to stop firewall throwing fits
// hide frequency options in India, where we can only handle one-time donations
if (
$("#frequency_onetime").prop('checked', true);
$(".frequency-options").hide();
Line 1,038 ⟶ 1,043:
}
addCardTypesClass(
}
|