diff --git a/src/interaction/siWardrobe.js b/src/interaction/siWardrobe.js index 92d3f9baa054b7b091aedaba8a6bd6f93eaef604..fc9447c7e0dcdd9a06f640d1693a4b4dcef877ff 100644 --- a/src/interaction/siWardrobe.js +++ b/src/interaction/siWardrobe.js @@ -7,7 +7,6 @@ App.UI.SlaveInteract.wardrobe = function(slave) { const frag = new DocumentFragment(); frag.append(clothes()); if (slave.fuckdoll === 0) { - frag.append(collar()); frag.append(mask()); frag.append(mouth()); frag.append(armAccessory()); @@ -59,6 +58,23 @@ App.UI.SlaveInteract.wardrobe = function(slave) { links.appendChild(colorOptions("clothingBaseColor")); } } + + const label = document.createElement('div'); + label.append(`Collar: `); + let choice = App.UI.DOM.disabledLink(`${slave.collar}`, [clothTooltip(`${slave.collar}`)]); + choice.style.fontWeight = "bold"; + label.appendChild(choice); + // Choose her own + if (slave.collar !== `none`) { + let choiceOptionsArray = []; + choiceOptionsArray.push({text: ` None`, updateSlave: {collar: `none`}}); + label.appendChild(generateRows(choiceOptionsArray, "collar", false)); + } + el.appendChild(label); + + links = App.UI.DOM.appendNewElement("div", el, collar()); + links.id = "collar-selection"; + return el; function filtersDOM() { @@ -159,75 +175,50 @@ App.UI.SlaveInteract.wardrobe = function(slave) { // Sort array = array.sort((a, b) => (a.text > b.text) ? 1 : -1); + el.append("Choose clothing: "); if (array.length > 0) { - el.append("Choose clothing: "); el.appendChild(generateRows(array, "clothes", true)); } else { - el.append("Clothing options: "); App.UI.DOM.appendNewElement("span", el, "No available clothing meets your criteria", "note"); } return el; } - function refresh() { - jQuery("#filters").empty().append(filtersDOM()); - jQuery("#clothing-selection").empty().append(clothingSelection()); - } - } - - function collar() { - const el = document.createElement('div'); - - const label = document.createElement('div'); - label.append(`Collar: `); - - let choice = App.UI.DOM.disabledLink(`${slave.collar}`, [clothTooltip(`${slave.collar}`)]); - choice.style.fontWeight = "bold"; - label.appendChild(choice); - // Choose her own - if (slave.collar !== `none`) { - let choiceOptionsArray = []; - choiceOptionsArray.push({text: ` None`, updateSlave: {collar: `none`}}); - label.appendChild(generateRows(choiceOptionsArray, "collar", false)); - } - - el.appendChild(label); + function collar() { + const el = new DocumentFragment(); + let array = []; - let niceOptionsArray = []; - let harshOptionsArray = []; + for (const [key, object] of App.Data.slaveWear.collars) { + if (key === "choosing her own clothes") { + continue; + } + if (filters.hasOwnProperty("harsh") && ((filters.harsh === false && object.harsh) || (filters.harsh === true && !object.harsh))) { + continue; + } + const reshapedItem = { + text: object.name, + updateSlave: {collar: key}, + FS: object.fs, + }; + array.push(reshapedItem); + } - for (const [key, object] of App.Data.slaveWear.collars) { - const reshapedItem = { - text: object.name, - updateSlave: {collar: key}, - FS: object.fs, - }; - if (object.harsh) { - harshOptionsArray.push(reshapedItem); + // Sort + array = array.sort((a, b) => (a.text > b.text) ? 1 : -1); + el.append("Choose collar: "); + if (array.length > 0) { + el.appendChild(generateRows(array, "collar", true)); } else { - niceOptionsArray.push(reshapedItem); + App.UI.DOM.appendNewElement("span", el, "No available collar meets your criteria", "note"); } + return el; } - // Sort - niceOptionsArray = niceOptionsArray.sort((a, b) => (a.text > b.text) ? 1 : -1); - harshOptionsArray = harshOptionsArray.sort((a, b) => (a.text > b.text) ? 1 : -1); - - // Nice options - let links = document.createElement('div'); - links.className = "choices"; - links.append(`Nice: `); - links.appendChild(generateRows(niceOptionsArray, "collar", true)); - el.appendChild(links); - - // Harsh options - links = document.createElement('div'); - links.className = "choices"; - links.append(`Harsh: `); - links.appendChild(generateRows(harshOptionsArray, "collar", true)); - el.appendChild(links); - - return el; + function refresh() { + jQuery("#filters").empty().append(filtersDOM()); + jQuery("#clothing-selection").empty().append(clothingSelection()); + jQuery("#collar-selection").empty().append(collar()); + } } function mask() {