MediaWiki:Resources/landingpage.js: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
fix 150 variant
some minor cleanup, formatting
Line 1: Line 1:
<html>
<html>
<script type="text/javascript">
<script>
$( document ).ready( function () {
// Disable submitting form with return key
$( 'form' ).bind( 'keypress', function(e) {
var code = ( e.keyCode ? e.keyCode : e.which );
if ( code == 13 ) return false;
} );

$("#p-logo a").attr("href", "#");
$("#p-logo a").attr("title", "");
} );

function getQuerystring( key ) {
function getQuerystring( key ) {
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
Line 19: Line 8:
}
}


</script>
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function(){

// 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' );
var hpc = getQuerystring( 'hpc' );
if( hpc == '' || isNaN( parseFloat( hpc ) ) ){
if( hpc == '' || isNaN( parseFloat( hpc ) ) ){
Line 92: Line 91:
}
}
}
}

});
// prefill other amount box if param provided
$(document).ready(function(){
var otherVal = getQuerystring( 'otherVal' );
var otherVal = getQuerystring( 'otherVal' );
if( otherVal == '' || isNaN( parseFloat( otherVal ) ) ){
if( otherVal == '' || isNaN( parseFloat( otherVal ) ) ){
Line 99: Line 98:
}
}
otherVal = parseFloat( otherVal );
otherVal = parseFloat( otherVal );

$("#input_amount_other").attr( 'checked', true );
$("#input_amount_other").attr( 'checked', true );
$("#input_amount_other_box").val( otherVal );
$("#input_amount_other_box").val( otherVal );