From 63df396b8a65c95e66db3cbbf0a9bea6d3481e08 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Thu, 5 Mar 2020 10:52:21 +0100
Subject: [PATCH] add fucktoy interactions to fucktoy tab

---
 js/003-data/gameVariableData.js |   1 +
 src/js/main.js                  | 102 +++++++++++++++++---------------
 src/js/slaveListing.js          |  13 ++++
 src/uncategorized/main.tw       |   8 +--
 src/uncategorized/options.tw    |   6 ++
 5 files changed, 79 insertions(+), 51 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 31a91048ab7..0ec207fc971 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -143,6 +143,7 @@ App.Data.defaultGameStateVariables = {
 	useSlaveSummaryTabs: 0,
 	useSlaveSummaryOverviewTab: 0,
 	useSlaveListInPageJSNavigation: 0,
+	fucktoyInteractionsPosition: 1,
 	killChoice: -1,
 	assignmentRecords: {},
 	verboseDescriptions: 0,
diff --git a/src/js/main.js b/src/js/main.js
index 6460d82940e..3e23169bacb 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -83,71 +83,79 @@ App.MainView.fcnn = function() {
 
 App.MainView.useFucktoys = function() {
 	const fragment = document.createDocumentFragment();
-
-	function setEnvironment(slave) {
-		return () => {
-			V.activeSlave = slave;
-			V.nextButton = "Back";
-			V.nextLink = "AS Dump";
-			V.returnTo = passage();
-		};
-	}
-
 	for (const slave of V.slaves) {
 		if (slave.assignment !== "please you") {
 			continue;
 		}
+		fragment.append(App.MainView.useFucktoy(slave));
+	}
+	return fragment;
+};
+
+/**
+ * @param {App.Entity.SlaveState} slave
+ * @returns {HTMLDivElement}
+ */
+App.MainView.useFucktoy = function(slave) {
+	const fragment = document.createDocumentFragment();
+
+	function setEnvironment() {
+		V.activeSlave = slave;
+		V.nextButton = "Back";
+		V.nextLink = "AS Dump";
+		V.returnTo = passage();
+	}
 
-		const {him, his} = getPronouns(slave);
+	const {him, his} = getPronouns(slave);
 
-		const div = document.createElement("div");
-		div.classList.add("note");
+	const div = document.createElement("div");
+	div.classList.add("note");
 
-		div.append(App.Interact.ToyChest(slave));
+	div.append(App.Interact.ToyChest(slave));
 
-		div.append(" In the coming week you plan to concentrate on ");
+	div.append(" In the coming week you plan to concentrate on ");
 
-		if (slave.toyHole !== "all her holes") {
-			div.append(`${his} ${slave.toyHole}`);
-		} else {
-			div.append(`all of ${his} holes equally`);
-		}
+	if (slave.toyHole !== "all her holes") {
+		div.append(`${his} ${slave.toyHole}`);
+	} else {
+		div.append(`all of ${his} holes equally`);
+	}
 
-		if (slave.fuckdoll === 0) {
-			div.append(", but for now:");
+	if (slave.fuckdoll === 0) {
+		div.append(", but for now:");
 
-			const optionDiv = document.createElement("div");
-			optionDiv.classList.add("indent");
+		const optionDiv = document.createElement("div");
+		optionDiv.classList.add("indent");
 
-			optionDiv.append(App.UI.DOM.passageLink(`Use ${his} mouth`, "FLips", setEnvironment(slave)),
-				" | ", App.UI.DOM.passageLink("Play with " + his + " tits", "FBoobs", setEnvironment(slave)));
+		optionDiv.append(App.UI.DOM.passageLink(`Use ${his} mouth`, "FLips", setEnvironment(slave)),
+			" | ", App.UI.DOM.passageLink("Play with " + his + " tits", "FBoobs", setEnvironment(slave)));
 
-			if (canDoVaginal(slave)) {
-				optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${him}`, "FVagina", setEnvironment(slave)));
-				if (canDoAnal(slave)) {
-					optionDiv.append(" | ", App.UI.DOM.passageLink(`Use ${his} holes`, "FButt", setEnvironment(slave)));
-				}
-			}
+		if (canDoVaginal(slave)) {
+			optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${him}`, "FVagina", setEnvironment(slave)));
 			if (canDoAnal(slave)) {
-				optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${his} ass`, "FAnus", setEnvironment(slave)));
+				optionDiv.append(" | ", App.UI.DOM.passageLink(`Use ${his} holes`, "FButt", setEnvironment(slave)));
 			}
-			if (canDoVaginal(slave) || canDoAnal(slave)) {
-				if (slave.belly >= 300000) {
-					optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${him} over ${his} belly`, "FBellyFuck", setEnvironment(slave)));
-				}
-			}
-			if (canPenetrate(slave)) {
-				optionDiv.append(" | ", App.UI.DOM.passageLink(`Ride ${him}`, "FDick", setEnvironment(slave)));
+		}
+		if (canDoAnal(slave)) {
+			optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${his} ass`, "FAnus", setEnvironment(slave)));
+		}
+		if (canDoVaginal(slave) || canDoAnal(slave)) {
+			if (slave.belly >= 300000) {
+				optionDiv.append(" | ", App.UI.DOM.passageLink(`Fuck ${him} over ${his} belly`, "FBellyFuck", setEnvironment(slave)));
 			}
-			optionDiv.append(" | ", App.UI.DOM.passageLink(`Abuse ${him}`, "FAbuse", setEnvironment(slave)));
-
-			div.append(optionDiv);
-		} else {
-			div.append(".");
 		}
-		fragment.append(div);
+		if (canPenetrate(slave)) {
+			optionDiv.append(" | ", App.UI.DOM.passageLink(`Ride ${him}`, "FDick", setEnvironment(slave)));
+		}
+		optionDiv.append(" | ", App.UI.DOM.passageLink(`Abuse ${him}`, "FAbuse", setEnvironment(slave)));
+
+		div.append(optionDiv);
+	} else {
+		div.append(".");
 	}
-	return fragment;
+	fragment.append(div);
+
+	return div;
 };
 
 /**
diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js
index 9fee57e1768..1153c43e87a 100644
--- a/src/js/slaveListing.js
+++ b/src/js/slaveListing.js
@@ -913,6 +913,19 @@ App.UI.SlaveList.penthousePage = function() {
 		}
 
 		SlaveSort.indices(employeesIndices);
+
+		if (V.fucktoyInteractionsPosition === 1 && job === "fucktoy") {
+			const fragment = document.createDocumentFragment();
+			for (const i of employeesIndices) {
+				fragment.append(App.UI.SlaveList.render.listDOM([i], [], App.UI.SlaveList.SlaveInteract.penthouseInteract));
+				fragment.append(App.MainView.useFucktoy(V.slaves[i]));
+			}
+			return {
+				n: employeesIndices.length,
+				dom: fragment
+			};
+		}
+
 		return {
 			n: employeesIndices.length,
 			dom: App.UI.SlaveList.render.listDOM(employeesIndices, [], App.UI.SlaveList.SlaveInteract.penthouseInteract)
diff --git a/src/uncategorized/main.tw b/src/uncategorized/main.tw
index b877403e3fb..e9f68e81429 100644
--- a/src/uncategorized/main.tw
+++ b/src/uncategorized/main.tw
@@ -95,18 +95,18 @@ __''MAIN MENU''__&nbsp;&nbsp;&nbsp;&nbsp;//[[Summary Options]]//
 
 <<print App.UI.SlaveList.penthousePage()>>
 
-<<if $useSlaveSummaryTabs === 0>>
-	<span id="fucktoy"></span>
+<<if $fucktoyInteactionsPosition === 0>>
+	<span id="fucktoyDOM"></span>
 	<<script>>
 		$(document).one(':passageend', () => {
-			$('#fucktoy').append(
+			$('#fucktoyDOM').append(
 				App.MainView.useFucktoys(),
 			);
 		});
 	<</script>>
 <</if>>
 
-<<if $useSlaveSummaryOverviewTab === 0>>
+<<if $fucktoyInteractionsPosition === 0>>
 	<span id="BG"></span>
 	<<script>>
 		$(document).one(':passageend', () => {
diff --git a/src/uncategorized/options.tw b/src/uncategorized/options.tw
index d7160133660..d9dba380570 100644
--- a/src/uncategorized/options.tw
+++ b/src/uncategorized/options.tw
@@ -238,6 +238,12 @@ This save was created using FC version $ver build $releaseID.
 			<<option 0 "Disabled">>
 		<</options>>
 
+		<<options $fucktoyInteractionsPosition>>
+			Interactions with your fucktoys are
+			<<option 1 "next to them">>
+			<<option 0 "at page bottom">>
+		<</options>>
+
 		<<options $lineSeparations "Summary Options">>
 			Line separations are
 			<<option 1 "Shown">>
-- 
GitLab