From 7d6bf548fb755d1ee3386ec2d1fca08fb8dd8bef Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Thu, 27 Aug 2020 09:18:10 -0400
Subject: [PATCH] fix keybinds

---
 src/002-config/mousetrapConfig.js |  4 ++--
 src/gui/userButton.js             | 25 +++++++++++++------------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/002-config/mousetrapConfig.js b/src/002-config/mousetrapConfig.js
index 17135f873a4..d0bc8f6dba1 100644
--- a/src/002-config/mousetrapConfig.js
+++ b/src/002-config/mousetrapConfig.js
@@ -266,12 +266,12 @@ App.UI.Hotkeys = (function() {
 // add hotkeys
 App.UI.Hotkeys.add("endWeek", {
 	callback: function() {
-		$("#story-caption #endWeekButton a.macro-link").trigger("click");
+		$("#story-caption #endWeekButton").trigger("click");
 	}, combinations: ["enter"], uiName: "Next Week"
 });
 App.UI.Hotkeys.add("nextLink", {
 	callback: function() {
-		$("#story-caption #nextButton a.macro-link").trigger("click");
+		$("#story-caption #nextButton").trigger("click");
 	}, combinations: ["space"], uiName: "Continue/Back"
 });
 App.UI.Hotkeys.add("prev-slave", {
diff --git a/src/gui/userButton.js b/src/gui/userButton.js
index b173ef506a4..f9372df68e9 100644
--- a/src/gui/userButton.js
+++ b/src/gui/userButton.js
@@ -2,17 +2,17 @@ globalThis.userButton = function(nextButton = V.nextButton, nextLink = V.nextLin
 	const el = new DocumentFragment();
 	const _Pass = passage();
 	let div = document.createElement("div");
+	let link;
 	div.style.fontWeight = "bold";
 	// We must always have a named element so we have something to refresh even if the button is hidden for a scene
 	if (_Pass !== "End Week") {
 		if (_Pass === "Main") {
-			div.id = "endWeekButton";
-			div.append(
-				App.UI.DOM.link(
-					"END WEEK",
-					() => endWeek()
-				)
+			link = App.UI.DOM.link(
+				"END WEEK",
+				() => endWeek()
 			);
+			link.id = "endWeekButton";
+			div.append(link);
 			div.append(" ");
 			App.UI.DOM.appendNewElement("span", div, App.UI.Hotkeys.hotkeys("endWeek"), "hotkey");
 			el.append(div);
@@ -20,16 +20,17 @@ globalThis.userButton = function(nextButton = V.nextButton, nextLink = V.nextLin
 				App.UI.DOM.appendNewElement("div", el, `WARNING: Rules Assistant has rules with errors!`, "yellow");
 			}
 		} else {
-			div.id = "nextButton";
 			if (nextButton !== " ") {
-				div.append(
-					App.UI.DOM.passageLink(
-						nextButton,
-						nextLink
-					)
+				link = App.UI.DOM.passageLink(
+					nextButton,
+					nextLink
 				);
+				link.id = "nextButton";
+				div.append(link);
 				div.append(" ");
 				App.UI.DOM.appendNewElement("span", div, App.UI.Hotkeys.hotkeys("nextLink"), "hotkey");
+			} else {
+				div.id = "nextButton";
 			}
 			el.append(div);
 		}
-- 
GitLab