MediaWiki:DonationForm T201415.js: Difference between revisions
Content deleted Content added
re-order slightly to match banners |
rm amountGiven usage |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
/* jshint strict:false */
/** MediaWiki:DonationForm.js - loaded on all donation forms
* TODO: lots of cleanup
Line 526 ⟶ 527:
};
var format = formats[currency][language] || formats[currency][
// Radio button amounts
Line 657 ⟶ 658:
/* Form functions */
function clearOther(box) {
document.getElementById(
box.value = "";
}
function selectOther() {
document.getElementById(
}
function selectAmount() {
$('#input_amount_other_box').val('');
}
Line 679:
*/
donationForm.redirectPayment = function( paymentMethod, paymentSubMethod, skipAmountValidation ) {
if ( donationForm.validate( skipAmountValidation ) ) {
Line 687 ⟶ 685:
var params = {};
// Overrides for specific cc gateways
}▼
if ( paymentMethod === 'cc-adyen' ) {
paymentMethod = 'cc';▼
params.payment_method = 'cc';
params.gateway = 'adyen';
params.ffname = 'adyen';
params.payment_method = 'cc';
params.gateway = 'astropay';
▲ } else {
params.payment_method = paymentMethod;▼
}
▲ params.payment_method = paymentMethod;
if ( paymentSubMethod ) {
params.payment_submethod = paymentSubMethod;
Line 713 ⟶ 703:
var frequency = $('input[name="frequency"]:checked').val();
if ( frequency !== 'monthly' ) {
params.recurring = false;
} else {
Line 730 ⟶ 719:
params.amount = amount;
/
if ( $('input[name="opt_in"]').length > 0 ) {
var opt_inValue = $('input[name="opt_in"]:checked').val();
params.opt_in
}
Line 751 ⟶ 740:
donationForm.extraData.time = Math.round( (Date.now() - donationForm.loadedTime)/1000 );
// Tracking data
params.utm_medium = mw.util.getParamValue( 'utm_medium' );
params.utm_campaign = mw.util.getParamValue( 'utm_campaign' );
params.utm_source = donationForm.buildUtmSource( params );
params.utm_key = donationForm.buildUtmKey( donationForm.extraData );
if ( document.referrer ) { // TODO: do we need this?▼
▲ if ( document.referrer ) {
// Strip protocol to stop firewall complaining
params.referrer = document.referrer.replace(/https?:\/\//i, '');
Line 867 ⟶ 855:
otherAmount = otherAmount.replace(/[\$£€¥,.]/g, '');
otherAmount = otherAmount.replace(/:/, '.');
amount = otherAmount;
donationForm.extraData.otherAmt = 1;
Line 900 ⟶ 887:
if ( form.opt_in ) {
if ( $(
$('#error-optin').show();
error = true;
Line 962 ⟶ 949:
*/
donationForm.calculateFee = function( amount ) {
// Minimum fee/PTF amounts. Default is 0.35.
Line 995 ⟶ 980:
if ( feeAmount < feeMinimum ) {
feeAmount = feeMinimum;
}
return parseFloat( feeAmount.toFixed(2) );
Line 1,044 ⟶ 1,029:
}
var chr = String.fromCharCode(e.which);
if (
return false;
}
Line 1,086 ⟶ 1,071:
// Disable logo link
$(
// These don't need to be tabbable on the landing page
$('#searchInput, .mw-jump-link').attr('tabindex', '-1');
$(
$(
});
|