From a2f822dd955a09e5422f70aa09c79cb20f47c129 Mon Sep 17 00:00:00 2001 From: "jakub.salavec" Date: Wed, 28 May 2025 17:41:27 +0200 Subject: [PATCH] Modified - deck builder's button to convert errata is disabled when the page loads --- .../gemp-lotr-async/src/main/web/deckBuild.html | 2 +- .../src/main/web/js/gemp-022/deckBuildingUi.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/deckBuild.html b/gemp-lotr/gemp-lotr-async/src/main/web/deckBuild.html index ef754a7b9..f097cd19d 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/deckBuild.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/deckBuild.html @@ -96,7 +96,7 @@ - diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js index 55b067dfe..1c6681d76 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js @@ -61,6 +61,7 @@ var GempLotrDeckBuildingUI = Class.extend({ cardInfoDialog: null, formats: null, + formatsInitialized:false, init:function () { var that = this; @@ -110,14 +111,14 @@ var GempLotrDeckBuildingUI = Class.extend({ that.setMapVisibility(false); } - //PC format or Anything Goes - if(formatCode.includes("pc") || formatCode == "rev_tow_sta") { + //PC format or Anything Goes (if chosen, not when being default when page loads) + if((formatCode.includes("pc") || formatCode == "rev_tow_sta") && that.formatsInitialized) { $("#convertErrataBut").button("option", "disabled", false); } else { $("#convertErrataBut").button("option", "disabled", true); } - + that.cardFilter.updateFormat(formatCode, that.formats[formatCode].blockFilters); }); @@ -1032,6 +1033,12 @@ var GempLotrDeckBuildingUI = Class.extend({ this.deckValidationDirty = true; this.deckContentsDirty = true; $("#editingDeck").html("*" + name + " - modified"); + + //Enable the errata button if user starts adding cards to empty 'Anything Goes' deck after the page was initialized + let formatCode = this.formatSelect.val(); + if(formatCode == "rev_tow_sta") { + $("#convertErrataBut").button("option", "disabled", false); + } } else { @@ -1122,6 +1129,8 @@ var GempLotrDeckBuildingUI = Class.extend({ const sleep = ms => new Promise(r => setTimeout(r, ms)); that.showNormalFilter(); + that.formatsInitialized = true; + that.getCollectionTypes(); }, {