MediaWiki:DonationForm mctest.js: Difference between revisions
Content deleted Content added
moved monthllyconvert js loading to common.js |
make the code controlling input into Other field a function, so we can re-use it for monthlyconvert Other |
||
Line 1,047:
}
});
};
/**
* Block typing letters and symbols in given input. Used for Other amount inputs
*
* If we don't do this, Safari allows typing them and then chokes on submit
*
* @param {Element} inputElement The element to block typing on
*/
donationForm.otherInputControl = function( inputElement ) {
if ( inputElement ) {
};▼
}
};
Line 1,061 ⟶ 1,086:
donationForm.country = mw.util.getParamValue('country');
// Block typing symbols in
▲ // https://phabricator.wikimedia.org/T118741, https://phabricator.wikimedia.org/T173431
▲ var amountOtherInput = document.getElementById('input_amount_other_box');
▲ amountOtherInput.onkeypress = function(e) {
▲ // Allow special keys in Firefox
▲ if ((e.code == 'ArrowLeft') || (e.code == 'ArrowRight') ||
▲ (e.code == 'ArrowUp') || (e.code == 'ArrowDown') ||
▲ (e.code == 'Delete') || (e.code == 'Backspace')) {
▲ return;
▲ }
▲ var chr = String.fromCharCode(e.which);
▲ if ('0123456789., '.indexOf(chr) === -1) {
▲ return false;
▲ };
▲ }
// Validate amount and update fee when selected/entered
|