mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 21:53:50 +01:00
Merge pull request #349 from hydroflame/fix-donate-invalid-input
Fix donate invalid input
This commit is contained in:
commit
f33bc59768
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user