From 39b529b88b624270cbf6ee5f47d44d678f204b95 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 5 Dec 2020 13:25:50 -0500
Subject: [PATCH] pulldowns for fs selection

---
 src/facilities/fsDecoration.js     | 40 ++++++++++++++++++------------
 src/uncategorized/futureSociety.tw | 36 +++++++++------------------
 2 files changed, 36 insertions(+), 40 deletions(-)

diff --git a/src/facilities/fsDecoration.js b/src/facilities/fsDecoration.js
index 9b57c9b92c6..f50d62088c9 100644
--- a/src/facilities/fsDecoration.js
+++ b/src/facilities/fsDecoration.js
@@ -1,31 +1,39 @@
 /** Replaces <<SetFacilityDecoration>> widget
  * @param {string} variable - global property name for the facility decoration (no $ etc)
- * @returns {DocumentFragment}
+ * @returns {HTMLElement}
  */
 App.UI.facilityRedecoration = function(variable) {
-	const frag = new DocumentFragment();
+	const select = document.createElement("select");
+	select.classList.add("rajs-list");
 	const arc = V.arcologies[0];
 	for (const FS of FutureSocieties.activeFSes(arc)) {
 		if (arc[FS] > 20) {
 			const decorationName = FutureSocieties.decorationName(FS);
-			if (decorationName && V[variable] !== decorationName) {
-				const link = App.UI.DOM.link(`${decorationName} Redecoration`, () => {
-					V[variable] = decorationName;
-					cashX(-5000, "capEx");
-					App.UI.reload();
-				});
-				App.UI.DOM.appendNewElement("div", frag, link, "indent");
+			if (decorationName) {
+				const option = App.UI.DOM.makeElement("option", decorationName, "indent");
+				if (V[variable] === decorationName) {
+					option.selected = true;
+				}
+				select.append(option);
 			}
 		}
 	}
-	if (V[variable] !== "standard") {
-		const link = App.UI.DOM.link(`Remove all decorations`, () => {
-			V[variable] = "standard";
-			App.UI.reload();
-		});
-		App.UI.DOM.appendNewElement("div", frag, link, "indent");
+	const option = App.UI.DOM.makeElement("option", "standard", "indent");
+	if (V[variable] === "standard") {
+		option.selected = true;
 	}
-	return frag;
+	select.append(option);
+
+	select.onchange = () => {
+		const O = select.options[select.selectedIndex];
+		if (O.value !== "standard") {
+			cashX(-5000, "capEx");
+		}
+		V[variable] = O.value;
+		App.UI.reload();
+	};
+	select.append(option);
+	return select;
 };
 
 /**
diff --git a/src/uncategorized/futureSociety.tw b/src/uncategorized/futureSociety.tw
index 484373fc7b3..2b8a1c614d2 100644
--- a/src/uncategorized/futureSociety.tw
+++ b/src/uncategorized/futureSociety.tw
@@ -1722,61 +1722,49 @@ You are spending <<print cashFormat($FSSpending)>> each week to support your soc
 <<run FutureSocieties.DecorationCleanup()>>
 
 <<if $brothel > 0>>
-	<div><<= capFirstChar($brothelName)>> is decorated in $brothelDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("brothelDecoration")>>
+	<div><<= capFirstChar($brothelName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("brothelDecoration")>> style.</div>
 <</if>>
 
 <<if $club > 0>>
-	<div><<= capFirstChar($clubName)>> is decorated in $clubDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("clubDecoration")>>
+	<div><<= capFirstChar($clubName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("clubDecoration")>> style.</div>
 <</if>>
 
 <<if $dairy > 0>>
-	<div><<= capFirstChar($dairyName)>> is decorated in $dairyDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("dairyDecoration")>>
+	<div><<= capFirstChar($dairyName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("dairyDecoration")>> style.</div>
 <</if>>
 
 <<if $farmyard > 0>>
-	<div><<= capFirstChar($farmyardName)>> is decorated in $farmyardDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("farmyardDecoration")>>
+	<div><<= capFirstChar($farmyardName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("farmyardDecoration")>> style.</div>
 <</if>>
 
 <<if $spa > 0>>
-	<div><<= capFirstChar($spaName)>> is decorated in $spaDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("spaDecoration")>>
+	<div><<= capFirstChar($spaName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("spaDecoration")>> style.</div>
 <</if>>
 
 <<if $nursery > 0>>
-	<div><<= capFirstChar($nurseryName)>> is decorated in $nurseryDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("nurseryDecoration")>>
+	<div><<= capFirstChar($nurseryName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("nurseryDecoration")>> style.</div>
 <</if>>
 
 <<if $clinic > 0>>
-	<div><<= capFirstChar($clinicName)>> is decorated in $clinicDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("clinicDecoration")>>
+	<div><<= capFirstChar($clinicName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("clinicDecoration")>> style.</div>
 <</if>>
 
 <<if $schoolroom > 0>>
-	<div><<= capFirstChar($schoolroomName)>> is decorated in $schoolroomDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("schoolroomDecoration")>>
+	<div><<= capFirstChar($schoolroomName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("schoolroomDecoration")>> style.</div>
 <</if>>
 
 <<if $cellblock > 0>>
-	<div><<= capFirstChar($cellblockName)>> is decorated in $cellblockDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("cellblockDecoration")>>
+	<div><<= capFirstChar($cellblockName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("cellblockDecoration")>> style.</div>
 <</if>>
 
 <<if $servantsQuarters > 0>>
-	<div><<= capFirstChar($servantsQuartersName)>> is decorated in $servantsQuartersDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("servantsQuartersDecoration")>>
+	<div><<= capFirstChar($servantsQuartersName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("servantsQuartersDecoration")>> style.</div>
 <</if>>
 
 <<if $arcade > 0>>
-	<div><<= capFirstChar($arcadeName)>> is decorated in $arcadeDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("arcadeDecoration")>>
+	<div><<= capFirstChar($arcadeName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("arcadeDecoration")>> style.</div>
 <</if>>
 
 <<if $masterSuite > 0>>
-	<div><<= capFirstChar($masterSuiteName)>> is decorated in $masterSuiteDecoration style.</div>
-	<<includeDOM App.UI.facilityRedecoration("masterSuiteDecoration")>>
+	<div><<= capFirstChar($masterSuiteName)>> is decorated in <<includeDOM App.UI.facilityRedecoration("masterSuiteDecoration")>> style.</div>
 <</if>>
-- 
GitLab