clearing the faction donate text field no longer says invalid amount, also formatting

This commit is contained in:
Olivier Gagnon 2018-07-05 12:59:20 -04:00
parent a165880fff
commit 7721bfc6c8

@ -306,13 +306,16 @@ function displayFactionContent(factionName) {
var donateDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); var donateDivWrapper = createElement("div", {class:"faction-work-div-wrapper"});
donateDiv.appendChild(donateDivWrapper); donateDiv.appendChild(donateDivWrapper);
var donateRepGain = createElement("p", { var donateRepGain = createElement("p", {
innerText:"This donation will result in 0 reputation gain" innerText:"This donation will result in 0.000 reputation gain"
}); });
var donateAmountInput = createElement("input", { var donateAmountInput = createElement("input", {
placeholder:"Donation amount", placeholder:"Donation amount",
inputListener:()=>{ inputListener:()=>{
var amt = parseFloat(donateAmountInput.value); let amt = 0;
if (isNaN(amt) || amt < 0) { if(donateAmountInput.value !== "") {
amt = parseFloat(donateAmountInput.value);
}
if (isNaN(amt)) {
donateRepGain.innerText = "Invalid donate amount entered!"; donateRepGain.innerText = "Invalid donate amount entered!";
} else { } else {
var repGain = amt / 1e6 * Player.faction_rep_mult; var repGain = amt / 1e6 * Player.faction_rep_mult;