Modified - deck builder's button to convert errata is disabled when the page loads

This commit is contained in:
jakub.salavec
2025-05-28 17:41:27 +02:00
parent ff000900f2
commit a2f822dd95
2 changed files with 13 additions and 4 deletions

View File

@@ -96,7 +96,7 @@
<span class="ui-icon ui-icon-suitcase"></span>
</button>
<button id="convertErrataBut" title="Convert to PC Errata" class="menu-button">
<button id="convertErrataBut" title="Convert to PC Errata" class="menu-button" disabled>
<span class="ui-icon ui-icon-transferthick-e-w"></span>
</button>

View File

@@ -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("<font color='orange'>*" + name + " - modified</font>");
//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();
},
{