From 70aaebb89bef2004219f6e793d3928fcf9c6db2e Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Fri, 18 Dec 2020 21:43:31 -0500 Subject: [PATCH] allow setting length of texboxes --- src/facilities/salon/salonPassage.js | 2 +- src/gui/options/options.js | 11 ++++++++++- src/npc/startingGirls/startingGirls.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/facilities/salon/salonPassage.js b/src/facilities/salon/salonPassage.js index d619a2c29d0..20b0aab8850 100644 --- a/src/facilities/salon/salonPassage.js +++ b/src/facilities/salon/salonPassage.js @@ -291,7 +291,7 @@ App.UI.salon = function(slave, cheat = false) { option = options.addOption(`${His} skin is ${slave.skin}.`, "skin", slave); if (App.Medicine.Modification.dyedSkins.includes(slave.skin)) { option.addValue("Remove coloring", slave.origSkin, billMod); - } else if (((slave.skin === "sun tanned") || (slave.skin === "spray tanned"))) { + } else if ((slave.skin === "sun tanned") || (slave.skin === "spray tanned")) { option.addValue("Remove tanning", slave.origSkin, billMod); } diff --git a/src/gui/options/options.js b/src/gui/options/options.js index 12967cf2e55..5ff496ffbfa 100644 --- a/src/gui/options/options.js +++ b/src/gui/options/options.js @@ -91,13 +91,17 @@ App.UI.OptionsGroup = (function() { /** * @param {string} [unit] + * @param {string} [length] * @returns {Option} */ - showTextBox(unit) { + showTextBox(unit, length) { this.textbox = true; if (unit) { this.unit = unit; } + if (length) { + this.textBoxLength = length; + } return this; } @@ -318,6 +322,11 @@ App.UI.OptionsGroup = (function() { if (this.unit) { buttonGroup.append(" ", this.unit); } + textbox.style.minWidth = "15em"; + textbox.style.width = currentValue.length + "ch"; + if (this.textBoxLength) { + textbox.style.width = this.textBoxLength; + } } if (this.comment) { const comment = document.createElement("span"); diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js index d9db41e2734..8839927356e 100644 --- a/src/npc/startingGirls/startingGirls.js +++ b/src/npc/startingGirls/startingGirls.js @@ -1189,7 +1189,7 @@ App.StartingGirls.profile = function(slave) { App.UI.DOM.appendNewElement("h3", el, "Optional customizations"); options = new App.UI.OptionsGroup(); - options.addOption("Origin story", "origin", slave).showTextBox().addComment("Use complete, capitalized and punctuated sentences."); + options.addOption("Origin story", "origin", slave).showTextBox("", "100em").addComment("Use complete, capitalized and punctuated sentences."); options.addOption("Origin override", "originOverride", V) .addValue("Enable", 1).on() -- GitLab