From 7721bfc6c865a73f333bc5673ddfdc9005ab167a Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Thu, 5 Jul 2018 12:59:20 -0400 Subject: [PATCH] clearing the faction donate text field no longer says invalid amount, also formatting --- src/Faction.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Faction.js b/src/Faction.js index 0ab119517..6c2e87275 100644 --- a/src/Faction.js +++ b/src/Faction.js @@ -306,13 +306,16 @@ function displayFactionContent(factionName) { var donateDivWrapper = createElement("div", {class:"faction-work-div-wrapper"}); donateDiv.appendChild(donateDivWrapper); 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", { placeholder:"Donation amount", inputListener:()=>{ - var amt = parseFloat(donateAmountInput.value); - if (isNaN(amt) || amt < 0) { + let amt = 0; + if(donateAmountInput.value !== "") { + amt = parseFloat(donateAmountInput.value); + } + if (isNaN(amt)) { donateRepGain.innerText = "Invalid donate amount entered!"; } else { var repGain = amt / 1e6 * Player.faction_rep_mult;