Correct logic

This commit is contained in:
Nathaniel Bond
2024-12-30 10:07:39 -05:00
parent c14aefa04c
commit f71eda27ac

View File

@@ -148,26 +148,27 @@ var GempLotrDeckBuildingUI = Class.extend({
newDeckBut.click( newDeckBut.click(
function () { function () {
if (that.deckContentsDirty && confirm("Do you wish to save this deck?")) if (that.deckContentsDirty) {
{ if (confirm("Do you wish to save this deck?")) {
if (that.deckName == null) { if (that.deckName == null) {
var newDeckName = prompt("Enter the name of the deck", ""); var newDeckName = prompt("Enter the name of the deck", "");
if (newDeckName != null) { if (newDeckName != null) {
if (newDeckName.length < 3 || newDeckName.length > 100) if (newDeckName.length < 3 || newDeckName.length > 100)
alert("Deck name has to have at least 3 characters and at most 100 characters."); alert("Deck name has to have at least 3 characters and at most 100 characters.");
else { else {
that.deckName = newDeckName; that.deckName = newDeckName;
that.saveDeck(false); that.saveDeck(false);
that.deckName = null; that.deckName = null;
$("#editingDeck").text("New deck"); $("#editingDeck").text("New deck");
that.clearDeck(); that.clearDeck();
}
} }
} else {
that.saveDeck(false);
that.deckName = null;
$("#editingDeck").text("New deck");
that.clearDeck();
} }
} else {
that.saveDeck(false);
that.deckName = null;
$("#editingDeck").text("New deck");
that.clearDeck();
} }
} else { } else {
that.deckName = null; that.deckName = null;