MediaWiki:Resources/landingpage.js: Difference between revisions

Content deleted Content added
No edit summary
move hpc and otherVal adjustments into functions
Line 30:
}
 
function adjustHPC() {
 
 
$(document).ready(function(){
 
$.getScript('//meta.wikimedia.org/w/index.php?' + $.param( { title:'MediaWiki:FR2013/Resources/PaymentOutages.js', action:'raw' } ),
function() {
setTimeout(checkPaymentOutages(), 250); // allow time for script to have _executed_ (not just loaded)
});
 
// Disable submitting form with return key
$( 'form' ).bind( 'keypress', function(e) {
var code = ( e.keyCode ? e.keyCode : e.which );
if ( code == 13 ) return false;
} );
 
// Disable logo link
$("#p-logo a").attr("href", "#");
$("#p-logo a").attr("title", "");
 
// Highest previous contribution adjustments (for emails)
var hpc = getQuerystring( 'hpc' );
Line 157 ⟶ 139:
$('.consider-amounts').html(considerAmountString);
}
}
 
function adjustOtherVal() {
// prefill other amount box if param provided
var otherVal = getQuerystring( 'otherVal' );
Line 166 ⟶ 150:
$("#input_amount_other").attr( 'checked', true );
$("#input_amount_other_box").val( otherVal );
}
 
 
$(document).ready(function(){
 
$.getScript('//meta.wikimedia.org/w/index.php?' + $.param( { title:'MediaWiki:FR2013/Resources/PaymentOutages.js', action:'raw' } ),
function() {
setTimeout(checkPaymentOutages(), 250); // allow time for script to have _executed_ (not just loaded)
});
 
// Disable submitting form with return key
$( 'form' ).bind( 'keypress', function(e) {
var code = ( e.keyCode ? e.keyCode : e.which );
if ( code == 13 ) return false;
} );
 
// Disable logo link
$("#p-logo a").attr("href", "#");
$("#p-logo a").attr("title", "");
 
adjustHPC();
adjustOtherVal();
 
});
</script>