MediaWiki:Common.js: Difference between revisions

Content deleted Content added
add try/finally around amount adjustments
add basic preSelect() option
Line 314:
$("#input_amount_other").attr( 'checked', true );
$("#input_amount_other_box").val( otherVal );
}
 
function preSelect() {
/* Check for a 'preSelect' url parameter, and select that option */
if ( mw.util.getParamValue('preSelect') ) {
$preSelectOption = $('input[name="amount"][value="' + mw.util.getParamValue('preSelect') + '"]');
if ($preSelectOption) {
// Select existing input, and add class to label for IE
$preSelectOption.prop('checked', true);
$preSelectOption.siblings('label').addClass('checked');
}
}
}
 
Line 381 ⟶ 393:
adjustHPC();
adjustOtherVal();
preSelect(); // Make sure to do this *after* other fiddling with values
}
finally {