MediaWiki:Common.js: Difference between revisions
Content deleted Content added
move initialisation to function, only run on actual landing pages |
|||
Line 290:
/* End form functions */
function donationPageInit() {
mw.loader.using( ['mediawiki.util'] ).done( function() {▼
//
// https://phabricator.wikimedia.org/T118741▼
document.getElementById('input_amount_other_box').onkeypress = function(e) {▼
};▼
// Block typing symbols in input field, otherwise Safari allows them and then chokes
// Disable submitting form with return key▼
var code = ( e.keyCode ? e.keyCode : e.which );▼
var chr =
if ("$£€¥".indexOf(chr) !== -1) {
});▼
};
▲ if ( document.paypalcontribution ) {
$(
▲ document.paypalcontribution.utm_campaign.value = mw.util.getParamValue( 'utm_campaign' );
if ( code == 13 ) return false;
▲ document.paypalcontribution.utm_key.value = mw.util.getParamValue( 'utm_key' );
});
▲ // Strip protocol to stop firewall throwing fits
▲ document.paypalcontribution.referrer.value = document.referrer.replace(/https?:\/\//i, "");
$("#p-logo a").attr("title", "");
▲ if (document.paypalcontribution.country.value === 'IN') {
▲ $("#frequency_onetime").prop('checked', true);
$("#cancel-monthly").hide();▼
}▼
▲ // Disable logo link
$("#
});
▲ $("#p-logo a").attr("title", "");
▲ // This is 1 by default, make it 0
if( mw.util.getParamValue('monthly') ) {
▲ $('#searchInput').attr('tabindex', 0);
▲ $(".input_amount_other").click(function() {
▲ });
▲ // Allow preselecting monthly
▲ $('#frequency_monthly').click();
}
);
}
▲ try {
▲ adjustHPC();
▲ preSelect(); // Make sure to do this *after* other fiddling with values
▲ }
▲ finally {
▲ $('.consider-amounts').show();
▲ $('#actual-form').show();
▲ }
$(document).ready(function() {
▲ // Load list of payment outages from meta, and hide any which are current
▲ $.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','mediawiki.config'] ).done( function() {
if ( mw.config.get('wgPageName') === 'Special:LandingPage' ) {
});
|