diff --git a/src/js/slaveInteract.js b/src/js/slaveInteract.js index e169d9de9a15cc5bcbfb6c894e87a382d62fa4d7..8461b888d376059b6e121f7b76c94e286ddbd411 100644 --- a/src/js/slaveInteract.js +++ b/src/js/slaveInteract.js @@ -876,7 +876,6 @@ App.UI.SlaveInteract.bloating = function(slave) { return jQuery('#bloating').empty().append(bloating); }; - App.UI.SlaveInteract.fertility = function(slave) { const { diff --git a/src/js/wardrobeUse.js b/src/js/wardrobeUse.js index f7dea2a3f401f1e11ca7a8988377c623d5a44d4b..af36556a7207b51b3a8675d842159dbb5be19ba1 100644 --- a/src/js/wardrobeUse.js +++ b/src/js/wardrobeUse.js @@ -302,9 +302,123 @@ App.UI.Wardrobe.collar = function(slave) { } }; +App.UI.Wardrobe.armAccessory = function(slave) { + if (slave.fuckdoll !== 0) { + return; + } + + const + { + // eslint-disable-next-line no-unused-vars + he, him, his, hers, himself, boy, He, His + } = getPronouns(slave); + + let el = document.createElement('div'); + + let label = document.createElement('div'); + label.append(`Arm accessory: `); + + let choice = document.createElement('span'); + choice.style.fontWeight = "bold"; + choice.textContent = (`${slave.armAccessory} `); + label.appendChild(choice); + + let array = []; + + // Choose her own + if (slave.armAccessory !== "none") { + array.push({text: `None`, updateSlave: {armaccessory: `none`}}); + label.appendChild(generateRows(array)); + } + + el.appendChild(label); + + let links = document.createElement('div'); + links.className = "choices"; + array = [ + {text: "Hand gloves", updateSlave: {armAccessory: "hand gloves"}}, + {text: "Elbow gloves", updateSlave: {armAccessory: "elbow gloves"}} + ]; + links.appendChild(generateRows(array)); + el.appendChild(links); + + return jQuery('#armAccessory').empty().append(el); + + + function generateRows(array) { + let row = document.createElement('span'); + for (let i = 0; i < array.length; i++) { + let link; + const separator = document.createTextNode(` | `); + const keys = Object.keys(array[i]); + + // Test to see if there was a problem with the key + for (let j = 0; j < keys.length; j++) { + if (["FS", "text", "updateSlave", "update", "note", "disabled"].includes(keys[j])) { + continue; + } else { + array[i].text += " ERROR, THIS SCENE WAS NOT ENTERED CORRECTLY"; + console.log("Trash found while generateRows() was running: " + keys[j] + ": " + array[i][keys[j]]); + break; + } + } + // if (array[i].updateSlave.armAccessory === `none` || isClothingAccessible.entry(array[i].updateSlave.armAccessory, "armAccessory")) { + // is it just text? + if (array[i].disabled) { + link = App.UI.DOM.disabledLink(array[i].text, [array[i].disabled]); + } else { + link = document.createElement('span'); + + // Set up the link + link.appendChild( + App.UI.DOM.link( + `${array[i].text} `, + () => { click(array[i]); }, + ) + ); + + if (array[i].FS) { + let FS = array[i].FS.substring(2); // Given "FSEdoRevivalist", cut off the first two letters to start a user friendly tooltip + FS = FS.replace(/([A-Z])/g, ` $1`); // Given "EdoRevivalist", find every capital letter and put a space in front of it + FS = App.UI.DOM.disabledLink(`FS`, [FS]); // Tooltip should read "Edo Revivalist" + FS.style.fontStyle = "italic"; + link.appendChild(FS); + } + + // add a note node if required + if (array[i].note) { + let note = document.createElement('span'); + note.textContent = (` ${array[i].note}`); + note.className = "note"; + link.appendChild(note); + } + } + row.appendChild(link); + if (i < array.length-1) { + row.appendChild(separator); + } + //} + } + + return row; + + function click(arrayOption) { + if (arrayOption.updateSlave) { + Object.assign(slave, arrayOption.updateSlave); + } + if (arrayOption.update) { + Object.assign(V, arrayOption.update); + } + App.UI.Wardrobe.refreshAll(slave); + return; + } + } +}; + App.UI.Wardrobe.refreshAll = function(slave) { App.UI.Wardrobe.clothes(slave); App.UI.Wardrobe.collar(slave); + App.UI.Wardrobe.armAccessory(slave); return; }; diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index eafafbf507d0aeba361a0d1ff8c3f80567fb61ac..e28c00e5f14e32992ffee3964c40b71a6020c910 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -202,12 +202,9 @@ <span id="collar"></span> <script>App.UI.Wardrobe.collar(V.activeSlave)</script> - <<if hasAnyArms($activeSlave)>> - <br>Arm accessory: ''<span id="armAccessory">$activeSlave.armAccessory</span>.'' - <<link "None">><<set $activeSlave.armAccessory = "none">><<replace "#armAccessory">>$activeSlave.armAccessory<</replace>><</link>> - | <<link "Hand gloves">><<set $activeSlave.armAccessory = "hand gloves">><<replace "#armAccessory">>$activeSlave.armAccessory<</replace>><</link>> - | <<link "Elbow gloves">><<set $activeSlave.armAccessory = "elbow gloves">><<replace "#armAccessory">>$activeSlave.armAccessory<</replace>><</link>> - <</if>> + <span id="armAccessory"></span> + <script>App.UI.Wardrobe.armAccessory(V.activeSlave)</script> + <<if hasAnyLegs($activeSlave)>> <br>Shoes: ''<span id="shoes">$activeSlave.shoes</span>.''