diff --git a/src/facilities/wardrobe/wardrobeShopping.js b/src/facilities/wardrobe/wardrobeShopping.js index 5f8b997bb8be8fda3a92461f7bb51e43d7820996..cc03ec1ce2444adb09d946fb5b5f704767c67aa7 100644 --- a/src/facilities/wardrobe/wardrobeShopping.js +++ b/src/facilities/wardrobe/wardrobeShopping.js @@ -1,5 +1,6 @@ App.UI.WardrobeShopping = function() { const el = document.createElement("p"); + el.id = "wardrobe-shopping"; App.UI.DOM.appendNewElement("H1", el, `Slave Wardrobe`); @@ -65,6 +66,7 @@ App.UI.WardrobeShopping = function() { /** @type {wardrobeItem} */ const clothingObj = App.Data.WardrobeShopping[category][clothing]; const cost = Math.trunc(clothingObj.cost * V.upgradeMultiplierTrade); + let div; if (V.seeImages === 1) { // Get a randomly chosen piece of clothing from the set to display: @@ -72,7 +74,7 @@ App.UI.WardrobeShopping = function() { App.UI.DOM.appendNewElement("div", el, App.Art.SlaveArtElement(model, 1, 0), ["imageRef", "smlImg"]); } if (!V.boughtItem.clothing[clothing]) { - if (cost > V.cash) { + if (cost < V.cash) { App.UI.DOM.appendNewElement( "div", el, @@ -87,14 +89,12 @@ App.UI.WardrobeShopping = function() { ); App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, "detail"); } else { - App.UI.DOM.appendNewElement( - "div", - el, - App.UI.DOM.disabledLink( - `Order ${clothingObj.title}`, - [`Cannot afford ¤${cost}`] - ) + div = App.UI.DOM.disabledLink( + `Order ${clothingObj.title}`, + [`Cannot afford ¤${cost}`] ); + div.style.display = "inline"; // Fixes disabledLink + el.append(div); App.UI.DOM.appendNewElement("div", el, `Costs ¤${cost}`, ["red", "detail"]); } } else { @@ -104,7 +104,7 @@ App.UI.WardrobeShopping = function() { return el; } function refresh() { - jQuery(`#id${category}`).empty().append(App.UI.WardrobeShopping(category)); + jQuery(`#wardrobe-shopping`).empty().append(App.UI.WardrobeShopping()); } - }; -} \ No newline at end of file + } +};