From 30cbbfc24ed7aa4d9c88ecc29c25b050a94eb5d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=98=A0Fake=5FDev=E2=98=A0?=
 <wpwjvqyzwolgwaqjhx@awdrt.com>
Date: Tue, 31 Mar 2020 13:49:29 -0700
Subject: [PATCH] added an option to enable a confirmation before ending a week

---
 js/003-data/gameVariableData.js                           | 2 +-
 src/data/backwardsCompatibility/backwardsCompatibility.js | 3 +++
 src/gui/storyCaption.tw                                   | 4 ++--
 src/uncategorized/options.tw                              | 8 ++++++++
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index 58d0c33ede8..3ae681aad58 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -1385,7 +1385,7 @@ App.Data.resetOnNGPlus = {
 	postSexCleanUp: 1,
 
 	sideBarOptions: {
-		compact: 1, Cash: 1, Upkeep: 1, SexSlaveCount: 1, roomPop: 1, Rep: 1, GSP: 1, Authority: 1, Security: 1, Crime: 1
+		compact: 1, Cash: 1, Upkeep: 1, SexSlaveCount: 1, roomPop: 1, Rep: 1, GSP: 1, Authority: 1, Security: 1, Crime: 1, confirmWeekEnd: 0,
 	},
 	DefaultBirthDestination: "individually decided fates",
 	abbreviateHormoneBalance: 2,
diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js
index eea233a5d34..40e7b1dd992 100644
--- a/src/data/backwardsCompatibility/backwardsCompatibility.js
+++ b/src/data/backwardsCompatibility/backwardsCompatibility.js
@@ -182,6 +182,9 @@ App.Update.globalVariables = function(node) {
 		if (typeof V.sideBarOptions.compact === "undefined") {
 			V.sideBarOptions.compact = 1;
 		}
+		if (typeof V.sideBarOptions.confirmWeekEnd === "undefined") {
+			V.sideBarOptions.confirmWeekEnd = 0;
+		}
 		if (V.sortSlavesBy === "income" || V.sortSlavesBy === "lastWeeksCashIncome") {
 			V.sortSlavesBy = "weeklyIncome";
 		}
diff --git a/src/gui/storyCaption.tw b/src/gui/storyCaption.tw
index 8e00530340e..5bb3c9a4dae 100644
--- a/src/gui/storyCaption.tw
+++ b/src/gui/storyCaption.tw
@@ -22,8 +22,8 @@
 	<</if>>
 	<<script>>
 		$(document).one(':passageend', () => {
-			$('#endWeekButton').click(function() {
-				if (confirm("Are you sure you want to end the week?")) {
+			$('#endWeekButton').click(() => {
+				if (!V.sideBarOptions.confirmWeekEnd || confirm("Are you sure you want to end the week?")) {
 					Engine.play(V.nextLink);
 				}
 			});
diff --git a/src/uncategorized/options.tw b/src/uncategorized/options.tw
index dd546e29ee8..27e7fb9e308 100644
--- a/src/uncategorized/options.tw
+++ b/src/uncategorized/options.tw
@@ -297,6 +297,14 @@ This save was created using FC version $ver build $releaseID.
 			<<option 0 "Hidden">>
 		<</options>>
 
+		<<options $sideBarOptions.confirmWeekEnd>>
+			Confirmation before ending a week:
+			<<option 1 "Enabled">>
+			<<option 0 "Disabled">>
+			<<comment>>
+			Enabling this will open a dialog box to confirm you meant to end a week.
+		<</options>>
+
 		<<if $secExpEnabled > 0>>
 			<<options $sideBarOptions.Authority>>
 				Authority is
-- 
GitLab