MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
rv all until I have time to look more closely
Line 290:
/* End form functions */
 
function donationPageInit() {
 
if $( document).paypalcontribution ready(function() {
document.paypalcontribution.utm_medium.value = mw.util.getParamValue( 'utm_medium' );
document.paypalcontribution.utm_campaign.value = mw.util.getParamValue( 'utm_campaign' );
document.paypalcontribution.utm_key.value = mw.util.getParamValue( 'utm_key' );
 
mw.loader.using( ['mediawiki.util'] ).done( function() {
// Strip protocol to stop firewall throwing fits
document.paypalcontribution.referrer.value = document.referrer.replace(/https?:\/\//i, "");
 
// hideBlock frequencytyping optionssymbols in Indiainput field, whereotherwise weSafari canallows onlythem handleand one-timethen donationschokes
// https://phabricator.wikimedia.org/T118741
if (document.paypalcontribution.country.value === 'IN') {
document.getElementById('input_amount_other_box').onkeypress = function(e) {
$("#frequency_onetime").prop('checked', true);
$var chr = String.fromCharCode("e.frequency-options").hide(which);
$if ("#cancel-monthly$£€¥").hideindexOf(chr) !== -1); {
} return false;
}
};
 
// Disable submitting form with return key
// Block typing symbols in input field, otherwise Safari allows them and then chokes
$( 'form[name="paypalcontribution"]' ).bind( 'keypress', function(e) {
// https://phabricator.wikimedia.org/T118741
var code = ( e.keyCode ? e.keyCode : e.which );
document.getElementById('input_amount_other_box').onkeypress = function(e) {
var chr = String.fromCharCode if (e.which code == 13 ) return false;
});
if ("$£€¥".indexOf(chr) !== -1) {
return false;
}
};
 
if ( document.paypalcontribution.country.value === 'IN') {
// Disable submitting form with return key
$( 'form[name=" document.paypalcontribution"]'.utm_medium.value )= mw.bindutil.getParamValue( 'keypressutm_medium', function(e) {;
document.paypalcontribution.utm_campaign.value = mw.util.getParamValue( 'utm_campaign' );
var code = ( e.keyCode ? e.keyCode : e.which );
document.paypalcontribution.utm_mediumutm_key.value = mw.util.getParamValue( 'utm_mediumutm_key' );
if ( code == 13 ) return false;
});
 
// Strip protocol to stop firewall throwing fits
// Disable logo link
document.paypalcontribution.referrer.value = document.referrer.replace(/https?:\/\//i, "");
$("#p-logo a").attr("href", "#");
$("#p-logo a").attr("title", "");
 
// hide frequency options in India, where we can only handle one-time donations
// This is 1 by default, make it 0
if (document.paypalcontribution.utm_keycountry.value = mw.util.getParamValue(== 'utm_keyIN' ); {
$('#searchInput').attr('tabindex', 0);
$("#frequency_onetime").prop('checked', true);
$(".frequency-options").hide();
$('"#actualcancel-form-loading'monthly").hide();
}
}
 
// Disable logo link
$(".input_amount_other").click(function() {
$("#input_amount_other_boxp-logo a").focusattr("href", "#");
$("#p-logo a").attr("hreftitle", "#");
});
 
// This is 1 by default, make it 0
// Allow preselecting monthly
$('#searchInput').attr('tabindex', 0);
if( mw.util.getParamValue('monthly') ) {
$('#frequency_monthly').click();
}
 
$(".input_amount_other").click(function() {
try {
adjustHPC $("#input_amount_other_box").focus();
});
preSelect(); // Make sure to do this *after* other fiddling with values
}
finally {
$('.consider-amounts').show();
$('#actual-form').show();
$('#actual-form-loading').hide();
}
 
 
// Load list of payment outages from meta, and hide any which are current
// Allow preselecting monthly
$.getScript('//meta.wikimedia.org/w/index.php?' + $.param( { title:'MediaWiki:FR2013/Resources/PaymentOutages.js', action:'raw', ctype:'text/javascript' } ),
functionif( mw.util.getParamValue('monthly') ) {
$('#frequency_monthly').click();
setTimeout(checkPaymentOutages(), 250); // allow time for script to have _executed_ (not just loaded)
}
);
}
 
try {
return falseadjustHPC();
preSelect(); // Make sure to do this *after* other fiddling with values
}
finally {
$('.consider-amounts').show();
$('#actual-form').show();
$('#actual-form-loading').hide();
}
 
// Load list of payment outages from meta, and hide any which are current
$(document).ready(function() {
$.getScript('//meta.wikimedia.org/w/index.php?' + $.param( { title:'MediaWiki:FR2013/Resources/PaymentOutages.js', action:'raw', ctype:'text/javascript' } ),
function() {
setTimeout(checkPaymentOutages(), 250); // allow time for script to have _executed_ (not just loaded)
});
 
mw.loader.using( ['mediawiki.util'] ).done( function() {
donationPageInit();
});