diff --git a/src/interaction/siDescription.js b/src/interaction/siDescription.js new file mode 100644 index 0000000000000000000000000000000000000000..947e35814808278ea65884e1833d1363bb634752 --- /dev/null +++ b/src/interaction/siDescription.js @@ -0,0 +1,61 @@ +App.UI.SlaveInteract.description = function(slave) { + const el = document.createElement("p"); + el.id = "si-description"; + el.append(wardrobeContent()); + return el; + + function wardrobeContent() { + const el = new DocumentFragment(); + const descriptionLink = document.createElement("div"); + descriptionLink.style.fontStyle = "italic"; + descriptionLink.id = "description-link"; + if (V.seeDetails === 1) { + descriptionLink.append(showOptions()); + el.append(descriptionLink); + + const descriptionOptions = document.createElement("div"); + descriptionOptions.id = "description-options"; + el.append(descriptionOptions); + + // <span id="LSD"></span> + } else { + descriptionLink.append( + App.UI.DOM.link( + "Show descriptions", + () => { + V.seeDetails = 1; + }, + [], + "Slave Interact" + ) + ); + el.append(descriptionLink); + } + + + return el; + + function showOptions() { + return App.UI.DOM.link( + "Description Options", + () => { + jQuery("#description-link").empty().append(hideOptions()); + jQuery("#description-options").empty().append(App.UI.renderPassage("Description Options")); + } + ); + } + + function hideOptions() { + return App.UI.DOM.link( + "Description Options", + () => { + jQuery("#description-link").empty().append(showOptions()); + jQuery("#description-options").empty().append(App.UI.renderPassage()); + } + ); + } + } + function refresh() { + jQuery("#si-description").empty().append(description()); + } +}; diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 426aa8d00c3c328b74cda3fd0fd75955707d5aa0..cbd7ea5329ab5920f6a74b4de75923699e823f47 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -77,31 +77,7 @@ <div id="Description" class="tab-content"> <div class="content"> - <<if $seeDetails == 1>> - <div style="font-style:italic"> - <<link "Description Options">> - <<replace #hideOptionPages>> - <<link "(hide)">> - <<replace #hideOptionPages>> - <</replace>> - <<replace #optionPages>> - /* Hide */ - <</replace>> - <</link>> - <</replace>> - <<replace #optionPages>> - <<include "Description Options">> - <</replace>> - <</link>> - <span id="hideOptionPages"></span> - <p id="optionPages"></p> - </div> - <span id="LSD"></span> - <<else>> - <div style="font-style:italic"> - [[Show descriptions|Slave Interact][$seeDetails = 1]] - </div> - <</if>> + </div> </div>