diff --git a/src/interaction/siWardrobe.js b/src/interaction/siWardrobe.js index 88ac8a7d09c26d99177516c570ea41daefe7f075..92d3f9baa054b7b091aedaba8a6bd6f93eaef604 100644 --- a/src/interaction/siWardrobe.js +++ b/src/interaction/siWardrobe.js @@ -64,6 +64,35 @@ App.UI.SlaveInteract.wardrobe = function(slave) { function filtersDOM() { const el = new DocumentFragment(); el.append("Filter clothing: "); + + const niceFilters = new Map([ + [false, "Nice"], + [true, "Harsh"], + ]); + let linkArray = []; + for (const [bool, string] of niceFilters) { + if (filters.harsh === bool) { + linkArray.push( + App.UI.DOM.disabledLink( + string, + ["Currently selected"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + string, + () => { + filters.harsh = bool; + refresh(); + } + ) + ); + } + } + App.UI.DOM.appendNewElement("span", el, App.UI.DOM.generateLinksStrip(linkArray)); + + el.append(" / "); const exposureFilters = new Map([ [0, "Modest"], [1, "Normal"], @@ -71,44 +100,35 @@ App.UI.SlaveInteract.wardrobe = function(slave) { [3, "Humiliating"], [4, "Practically nude"], ]); - let linkArray = []; - for (const [num, string] of exposureFilters) { - linkArray.push( - App.UI.DOM.link( - string, - () => { - filters.exposure = num; - jQuery("#clothing-selection").empty().append(clothingSelection()); - } - ) - ); - } - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); - - const niceFilters = new Map([ - [false, "Nice"], - [true, "Harsh"], - ]); linkArray = []; - for (const [bool, string] of niceFilters) { - linkArray.push( - App.UI.DOM.link( - string, - () => { - filters.harsh = bool; - jQuery("#clothing-selection").empty().append(clothingSelection()); - } - ) - ); + for (const [num, string] of exposureFilters) { + if (filters.exposure === num) { + linkArray.push( + App.UI.DOM.disabledLink( + string, + ["Currently selected"] + ) + ); + } else { + linkArray.push( + App.UI.DOM.link( + string, + () => { + filters.exposure = num; + refresh(); + } + ) + ); + } } - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray)); + App.UI.DOM.appendNewElement("span", el, App.UI.DOM.generateLinksStrip(linkArray)); + el.append(" / "); - App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link( + App.UI.DOM.appendNewElement("span", el, App.UI.DOM.link( "Reset Filters", () => { filters = {}; - jQuery("#filters").empty().append(filtersDOM()); - jQuery("#clothing-selection").empty().append(clothingSelection()); + refresh(); } )); // clear filters return el; @@ -140,7 +160,7 @@ App.UI.SlaveInteract.wardrobe = function(slave) { // Sort array = array.sort((a, b) => (a.text > b.text) ? 1 : -1); if (array.length > 0) { - el.append("Clothing options: "); + el.append("Choose clothing: "); el.appendChild(generateRows(array, "clothes", true)); } else { el.append("Clothing options: "); @@ -148,6 +168,10 @@ App.UI.SlaveInteract.wardrobe = function(slave) { } return el; } + function refresh() { + jQuery("#filters").empty().append(filtersDOM()); + jQuery("#clothing-selection").empty().append(clothingSelection()); + } } function collar() {