From f7445306de0b6a05b9dadb98434bee170bb4a09e Mon Sep 17 00:00:00 2001
From: lowercase-donkey <lowercasedonkey@gmail.com>
Date: Sun, 10 Feb 2019 14:20:17 -0500
Subject: [PATCH] tab memory for Main

---
 src/js/utilJS.js               | 17 +++++++++
 src/uncategorized/economics.tw | 16 +--------
 src/uncategorized/main.tw      | 66 +++++++++++++++++++++++-----------
 3 files changed, 63 insertions(+), 36 deletions(-)

diff --git a/src/js/utilJS.js b/src/js/utilJS.js
index 42d96946662..17611f406d2 100644
--- a/src/js/utilJS.js
+++ b/src/js/utilJS.js
@@ -1335,4 +1335,21 @@ window.HSM = function() {
 	else if (V.PC.hacking <= 75) {return 0.85;}
 	else if (V.PC.hacking <= 100) {return 0.80;}
 	else {return 0.75;}
+};
+
+window.opentab = function(evt, tabName) {
+	var i, tabcontent, tablinks;
+	const V = State.variables;
+	/*var passage = passage();*/
+	tabcontent = document.getElementsByClassName("tabcontent");
+	for (i = 0; i < tabcontent.length; i++) {
+		tabcontent[i].style.display = "none";
+	}
+	tablinks = document.getElementsByClassName("tablinks");
+	for (i = 0; i < tablinks.length; i++) {
+		tablinks[i].className = tablinks[i].className.replace(" active", "");
+	}
+	V.tabChoice[passage()] = tabName;
+	document.getElementById(tabName).style.display = "block";
+	evt.currentTarget.className += " active";
 };
\ No newline at end of file
diff --git a/src/uncategorized/economics.tw b/src/uncategorized/economics.tw
index 2f84aaa5a35..0ff50c41a7c 100644
--- a/src/uncategorized/economics.tw
+++ b/src/uncategorized/economics.tw
@@ -137,21 +137,7 @@
 <</if>>
 
 <script>
-function opentab(evt, tabName) {
-	var i, tabcontent, tablinks;
-	tabcontent = document.getElementsByClassName("tabcontent");
-	for (i = 0; i < tabcontent.length; i++) {
-		tabcontent[i].style.display = "none";
-	}
-	tablinks = document.getElementsByClassName("tablinks");
-	for (i = 0; i < tablinks.length; i++) {
-		tablinks[i].className = tablinks[i].className.replace(" active", "");
-	}
-	document.getElementById(tabName).style.display = "block";
-	evt.currentTarget.className += " active";
-}
-
-document.getElementById("defaultOpen").click();
+	document.getElementById("defaultOpen").click();
 </script>
 
 </body>
diff --git a/src/uncategorized/main.tw b/src/uncategorized/main.tw
index e0ee03cec73..850c5e893ba 100644
--- a/src/uncategorized/main.tw
+++ b/src/uncategorized/main.tw
@@ -1,7 +1,5 @@
 :: Main [nobr]
-<<if ndef $tabChoice>>
-	<<set $tabChoice = "main">>
-<</if>>
+
 <<unset $Flag>>
 <<resetAssignmentFilter>>
 <<if $releaseID >= 1000 || $ver.includes("0.9") || $ver.includes("0.8") || $ver.includes("0.7") || $ver.includes("0.6")>>
@@ -406,25 +404,51 @@ __''MAIN MENU''__&nbsp;&nbsp;&nbsp;&nbsp;//[[Summary Options]]//
 		</div>
 	</div>
 
-	<script>
-	function opentab(evt, tabName) {
-		var i, tabcontent, tablinks;
-		tabcontent = document.getElementsByClassName("tabcontent");
-		for (i = 0; i < tabcontent.length; i++) {
-			tabcontent[i].style.display = "none";
-		}
-		tablinks = document.getElementsByClassName("tablinks");
-		for (i = 0; i < tablinks.length; i++) {
-			tablinks[i].className = tablinks[i].className.replace(" active", "");
-		}
-		State.variables.tabChoice = tabName;
-		document.getElementById(tabName).style.display = "block";
-		evt.currentTarget.className += " active";
-	}
-
-	document.getElementById("tab all").click();
-	</script>
+		<div class="tab">
+		<<if $useSlaveSummaryOverviewTab == 1>>
+		<button class="tablinks" onclick="opentab(event, 'overview')" id="tab overview">Overview</button>
+		<</if>>
+		<button class="tablinks" onclick="opentab(event, 'resting')" id="tab resting">Resting</button>
+		<button class="tablinks" onclick="opentab(event, 'stay confined')" id="tab stay confined">Confined</button>
+		<button class="tablinks" onclick="opentab(event, 'take classes')" id="tab take classes">Students</button>
+		<button class="tablinks" onclick="opentab(event, 'please you')" id="tab please you">Fucktoys</button>
+		<button class="tablinks" onclick="opentab(event, 'whore')" id="tab whore">Whores</button>
+		<button class="tablinks" onclick="opentab(event, 'serve the public')" id="tab serve the public">Public Servants</button>
+		<button class="tablinks" onclick="opentab(event, 'be a servant')" id="tab be a servant">Servants</button>
+		<button class="tablinks" onclick="opentab(event, 'get milked')" id="tab milked">Cows</button>
+		<button class="tablinks" onclick="opentab(event, 'work a glory hole')" id="tab work a glory hole">Gloryhole</button>
+		<button class="tablinks" onclick="opentab(event, 'be a subordinate slave')" id="tab be a subordinate slave">Subordinate slaves</button>
+		<button class="tablinks" onclick="opentab(event, 'all')" id="tab all">All</button>
+	</div>
 
+	<<if ($tabChoice.Main == "overview")>>
+		<script>document.getElementById("tab overview").click();</script>
+	<<elseif ($tabChoice.Main == "resting")>>
+		<script>document.getElementById("tab resting").click();</script>
+	<<elseif ($tabChoice.Main == "stay confined")>>
+		<script>document.getElementById("tab stay confined").click();</script>
+	<<elseif ($tabChoice.Main == "take classes")>>
+		<script>document.getElementById("tab take classes").click();</script>
+	<<elseif ($tabChoice.Main == "please you")>>
+		<script>document.getElementById("tab please you").click();</script>
+	<<elseif ($tabChoice.Main == "whore")>>
+		<script>document.getElementById("tab whore").click();</script>
+	<<elseif ($tabChoice.Main == "serve the public")>>
+		<script>document.getElementById("tab serve the public").click();</script>
+	<<elseif ($tabChoice.Main == "be a servant")>>
+		<script>document.getElementById("tab be a servant").click();</script>
+	<<elseif ($tabChoice.Main == "get milked")>>
+		<script>document.getElementById("tab get milked").click();</script>
+	<<elseif ($tabChoice.Main == "work a glory hole")>>
+		<script>document.getElementById("tab work a glory hole").click();</script>
+	<<elseif ($tabChoice.Main == "be a subordinate slave")>>
+		<script>document.getElementById("tab be a subordinate slave").click();</script>
+	<<elseif ($tabChoice.Main == "all")>>
+		<script>document.getElementById("tab all").click();</script>
+	<<else>>
+		<script>document.getElementById("tab all").click();</script>
+	<</if>>
+	
 	</body>
 	<<if $positionMainLinks <= 0>>
 		<br><<MainLinks>>
-- 
GitLab