Merge pull request #696 from SalavecJ/ui_annoyances

UI Anything Goes js annoyances
This commit is contained in:
Christian McCarty
2025-06-15 20:13:43 -05:00
committed by GitHub
3 changed files with 16 additions and 6 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,8 +111,8 @@ 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 {
@@ -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();
},
{

View File

@@ -1119,7 +1119,8 @@ var GempLotrHallUI = Class.extend({
var format = formats[i].childNodes[0].nodeValue;
var type = formats[i].getAttribute("type");
var item = "<option value='" + type + "'>" + format + "</option>"
var selected = (format === "Fellowship Block") ? " selected" : "";
var item = "<option value='" + type + "'" + selected + ">" + format + "</option>";
this.supportedFormatsSelect.append(item);
}