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"});
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user