From 20c86a0885ab741f05ce453bb1869e067a8f1bd7 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Wed, 3 Mar 2021 21:11:50 -0800
Subject: [PATCH] Remove shitty jQuery hacks and just build the DOM directly

---
 src/npc/startingGirls/startingGirlsPassage.js | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/npc/startingGirls/startingGirlsPassage.js b/src/npc/startingGirls/startingGirlsPassage.js
index f565fe72f9d..365e30f72e4 100644
--- a/src/npc/startingGirls/startingGirlsPassage.js
+++ b/src/npc/startingGirls/startingGirlsPassage.js
@@ -24,14 +24,22 @@ App.StartingGirls.passage = function() {
 		}
 	} else {
 		const pronoun = V.slaves.length > 1 ? "they" : getPronouns(V.slaves[0]).he;
-		const makePlaceholder = (slave) => `<span id="placeholder-${slave.ID}"></span>`;
-		r.push(`${toSentence(V.slaves.map(s => makePlaceholder(s)))}'s records have been finalized; ${pronoun} will arrive with you when you take over your new arcology.`);
+		const frag = document.createDocumentFragment();
+		for (let i = 0; i < V.slaves.length; ++i) {
+			if (i > 0 && i < V.slaves.length - 1) {
+				frag.append(`, `);
+			} else if (i > 0) {
+				frag.append(` and `);
+			}
+			frag.append(App.UI.DOM.slaveDescriptionDialog(V.slaves[i]));
+			if (i === V.slaves.length - 1) {
+				frag.append(`'s`);
+			}
+		}
+		r.push(frag, `records have been finalized; ${pronoun} will arrive with you when you take over your new arcology.`);
 	}
 	r.push(App.UI.DOM.makeElement("div", "Current cash reserves can be found on the far left sidebar."));
 	App.Events.addNode(el, r, "p");
-	for (const slave of V.slaves) {
-		$(el).find(`#placeholder-${slave.ID}`).replaceWith(App.UI.DOM.slaveDescriptionDialog(slave));
-	}
 
 	const headerLinks = App.UI.DOM.appendNewElement("div", el);
 	linkArray.push(
-- 
GitLab