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: | Line 10: | ||
'vh' : window.innerHeight |
'vh' : window.innerHeight |
||
}; |
}; |
||
// Don't offer recurring at all in these countries |
|||
donationForm.noRecurringCountries = [ 'AR', 'CL', 'CO', 'MX', 'PE', 'BR', 'IN' ]; |
|||
donationForm.maxUSD = 12000; |
donationForm.maxUSD = 12000; |
||
Line 678: | Line 681: | ||
donationForm.redirectPayment = function( paymentMethod, paymentSubMethod, skipAmountValidation ) { |
donationForm.redirectPayment = function( paymentMethod, paymentSubMethod, skipAmountValidation ) { |
||
var form = document.forms['donateForm']; |
var form = document.forms['donateForm']; |
||
if ( donationForm.validate( skipAmountValidation ) ) { |
if ( donationForm.validate( skipAmountValidation ) ) { |
||
Line 1,041: | Line 1,044: | ||
form.referrer.value = document.referrer.replace(/https?:\/\//i, ""); |
form.referrer.value = document.referrer.replace(/https?:\/\//i, ""); |
||
// hide frequency options |
// hide frequency options for some countries |
||
if ( form.country.value |
if ( donationForm.noRecurringCountries.indexOf( form.country.value ) !== -1 ) { |
||
$( |
$('#frequency_onetime').prop('checked', true); |
||
$( |
$('.frequency-options, #cancel-monthly').hide(); |
||
$("#cancel-monthly").hide(); |
|||
} |
} |
||
Line 1,066: | Line 1,068: | ||
// Allow preselecting monthly |
// Allow preselecting monthly |
||
if( mw.util.getParamValue('monthly') |
if( mw.util.getParamValue('monthly') |
||
&& donationForm.noRecurringCountries.indexOf( form.country.value ) === -1 ) { |
|||
$('#frequency_monthly').click(); |
$('#frequency_monthly').click(); |
||
} |
} |