diff --git a/src/002-config/mousetrapConfig.js b/src/002-config/mousetrapConfig.js index 7abaaf4731c1b03b9967b1bf95392b102e027055..c82ac4be193661aef007b894ecbb0a50630f938a 100644 --- a/src/002-config/mousetrapConfig.js +++ b/src/002-config/mousetrapConfig.js @@ -235,6 +235,7 @@ App.UI.Hotkeys = (function() { const save = SugarCube.storage.get("hotkeys"); for (const saveKey in save) { + // discard obsolete hotkeys if (actions[saveKey]) { actions[saveKey].combinations = save[saveKey]; } @@ -262,42 +263,42 @@ App.UI.Hotkeys = (function() { })(); // add hotkeys -App.UI.Hotkeys.add("Advance week", { +App.UI.Hotkeys.add("endWeek", { callback: function() { $("#story-caption #endWeekButton a.macro-link").trigger("click"); - }, combinations: ["enter"] + }, combinations: ["enter"], uiName: "Next Week" }); -App.UI.Hotkeys.add("Continue/Back", { +App.UI.Hotkeys.add("nextLink", { callback: function() { $("#story-caption #nextButton a.macro-link").trigger("click"); - }, combinations: ["space"] + }, combinations: ["space"], uiName: "Continue/Back" }); -App.UI.Hotkeys.add("Previous Slave", { +App.UI.Hotkeys.add("prevSlave", { callback: function() { $("#prevSlave a.macro-link").trigger("click"); - }, combinations: ["left", "q"] + }, combinations: ["left", "q"], uiName: "Previous Slave" }); -App.UI.Hotkeys.add("Next Slave", { +App.UI.Hotkeys.add("nextSlave", { callback: function() { $("#nextSlave a.macro-link").trigger("click"); - }, combinations: ["right", "e"] + }, combinations: ["right", "e"], uiName: "Next Slave" }); -App.UI.Hotkeys.add("Previous Child", { +App.UI.Hotkeys.add("prevChild", { callback: function() { $("#prevChild a.macro-link").trigger("click"); - }, combinations: ["left", "q"] + }, combinations: ["left", "q"], uiName: "Previous Child" }); -App.UI.Hotkeys.add("Next Child", { +App.UI.Hotkeys.add("nextChild", { callback: function() { $("#nextChild a.macro-link").trigger("click"); - }, combinations: ["right", "e"] + }, combinations: ["right", "e"], uiName: "Next Child" }); App.UI.Hotkeys.add("walkpast", { callback: function() { $("#walkpast a.macro-link").trigger("click"); }, combinations: ["f"] }); -App.UI.Hotkeys.add("Manage HG", { +App.UI.Hotkeys.add("HG Select", { callback: function() { $("#manageHG a").trigger("click"); }, combinations: ["h"] diff --git a/src/arcologyBuilding/penthouse.js b/src/arcologyBuilding/penthouse.js index f4d9e75ca14cfddc5bb908064c603dc88f2c4463..89c3126993199518f6beb71b0535d4894a520fb7 100644 --- a/src/arcologyBuilding/penthouse.js +++ b/src/arcologyBuilding/penthouse.js @@ -25,7 +25,7 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { const fragment = document.createDocumentFragment(); const link = App.UI.DOM.passageLink("Penthouse", "Manage Penthouse"); - const hotkey = App.UI.DOM.makeElement("span", "[P]", "hotkey"); + const hotkey = App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Manage Penthouse"), "hotkey"); if (V.verticalizeArcologyLinks === 0) { const div = document.createElement("div"); div.append(link, " ", hotkey); diff --git a/src/facilities/nursery/childInteract.tw b/src/facilities/nursery/childInteract.tw index db203972cd30f9a6dc2811261df9ee9d49be7cde..eac1877bcd5b558ddd48419e6a4672e5ec0af104 100644 --- a/src/facilities/nursery/childInteract.tw +++ b/src/facilities/nursery/childInteract.tw @@ -18,7 +18,9 @@ <</if>> <center> -@@.cyan;[â†,Q] @@ +<span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("prevChild")>> +</span> <span id="prevChild"> <b> <<link "Prev" "Previous Child In Line">><</link>> @@ -30,7 +32,9 @@ <<link "Next" "Next Child In Line">><</link>> </b> </span> -@@.cyan; [E,→]@@ +<span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("nextChild")>> +</span> </center> <br> diff --git a/src/gui/storyCaptionWidgets.tw b/src/gui/storyCaptionWidgets.tw index a8616c836cd97a0ccaa8c7a5a96f418853a33889..3242e2b91f508d773fa094bc13b6f1a8f560b3f0 100644 --- a/src/gui/storyCaptionWidgets.tw +++ b/src/gui/storyCaptionWidgets.tw @@ -7,7 +7,14 @@ <<if _Pass != "End Week">> <<if _Pass == "Main">> <strong> - <div id="endWeekButton"><<link "END WEEK">><<run endWeek()>><</link>> @@.cyan;[Ent]@@</div> + <div id="endWeekButton"> + <<link "END WEEK">> + <<run endWeek()>> + <</link>> + <span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("endWeek")>> + </span> + </div> </strong> <<if $rulesAssistantAuto == 1 && DefaultRulesError()>> <div>@@.yellow;WARNING: Rules Assistant has rules with errors!@@</div> @@ -17,7 +24,10 @@ <<if $nextButton != " ">> <<link "$nextButton">> <<goto $nextLink>> - <</link>> @@.cyan;[Space]@@ + <</link>> + <span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("nextLink")>> + </span> <</if>> </div></strong> <</if>> diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index a41eff26a9c25f0eebc58391665fbfcca9973862..d2be8893bee20de2008b2bc227d5a8d62731d11f 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -85,7 +85,7 @@ App.UI.View.mainLinks = function() { if (V.PC.health.shortDamage < 30) { const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Change plans", "Personal Attention Select"), "major-link"); link.id = "managePA"; - fragment.append(" ", link, " ", App.UI.DOM.makeElement("span", "[A]", "hotkey")); + fragment.append(" ", link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Personal Attention"), "hotkey")); } if (V.useSlaveSummaryOverviewTab === 0) { @@ -97,7 +97,7 @@ App.UI.View.mainLinks = function() { } div.append(". ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Head Girl", "HG Select"), "major-link"), - " ", App.UI.DOM.makeElement("span", "[H]", "hotkey")); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("HG Select"), "hotkey")); div.id = "manageHG"; } else if (V.slaves.length > 1) { div.append(`You have not selected a Head Girl`); @@ -106,7 +106,7 @@ App.UI.View.mainLinks = function() { } div.append(". ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select One", "HG Select"), "major-link"), - " ", App.UI.DOM.makeElement("span", "[H]", "hotkey")); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("HG Select"), "hotkey")); div.id = "manageHG"; } else { div.append(App.UI.DOM.makeElement("span", "You do not have enough slaves to keep a Head Girl", "note")); @@ -121,7 +121,7 @@ App.UI.View.mainLinks = function() { div.append("You have not selected a Recruiter. ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select one", "Recruiter Select"), "major-link")); } - div.append(" ", App.UI.DOM.makeElement("span", "[U]", "hotkey")); + div.append(" ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Recruiter Select"), "hotkey")); div.id = "manageRecruiter"; fragment.append(div); @@ -134,7 +134,7 @@ App.UI.View.mainLinks = function() { div.append("You have not selected a Bodyguard. ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select one", "BG Select"), "major-link")); } - div.append(" ", App.UI.DOM.makeElement("span", "[B]", "hotkey")); + div.append(" ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("BG Select"), "hotkey")); div.id = "manageBG"; fragment.append(div); } diff --git a/src/js/main.js b/src/js/main.js index 1854c4e6343b57ee130cb45a5faad2fcb66b0a0e..2dea7157fec6271d7db5200973c606b85d512b5d 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -225,7 +225,7 @@ App.MainView.full = function() { const raLink = document.createElement("span"); raLink.id = "RAButton"; raLink.append(" | ", App.UI.DOM.passageLink("Rules Assistant Options", "Rules Assistant"), - " ", App.UI.DOM.makeElement("span", "[R]", ["clear-formatting", "hotkey"])); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Rules Assistant"), ["clear-formatting", "hotkey"])); span.append(raLink); if (V.rulesAssistantAuto !== 1) { diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index 09d47f01788c95c72f6eff1d037af2e1ac7842f6..ee2d2088cd5d0ce7e2ca51b30cb08ea2a8239823 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -864,7 +864,7 @@ App.UI.SlaveList.penthousePage = function() { slaveWrapper.append(". "); const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Head Girl", "HG Select"), "major-link"); link.id = "manageHG"; - slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[H]", "hotkey")); + slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("HG Select"), "hotkey")); slaveWrapper.append(App.UI.SlaveList.render.listDOM([HG.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); } else { @@ -874,7 +874,7 @@ App.UI.SlaveList.penthousePage = function() { slaveWrapper.append(" and Consort"); } slaveWrapper.append(". ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select One", "HG Select"), "major-link"), - " ", App.UI.DOM.makeElement("span", "[H]", "hotkey")); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("HG Select"), "hotkey")); slaveWrapper.id = "manageHG"; if (V.slavePanelStyle === 2) { slaveWrapper.classList.add("slaveSummary", "card"); @@ -907,13 +907,13 @@ App.UI.SlaveList.penthousePage = function() { slaveWrapper.append(". "); const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Recruiter", "Recruiter Select"), "major-link"); link.id = "manageRecruiter"; - slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[U]", "hotkey")); + slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Recruiter Select"), "hotkey")); slaveWrapper.append(App.UI.SlaveList.render.listDOM([RC.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); } else { slaveWrapper.append("You have ", App.UI.DOM.makeElement("span", "not", "warning"), " selected a Recruiter. ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select one", "Recruiter Select"), "major-link"), - " ", App.UI.DOM.makeElement("span", "[U]", "hotkey")); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("Recruiter Select"), "hotkey")); slaveWrapper.id = "manageRecruiter"; if (V.slavePanelStyle === 2) { slaveWrapper.classList.add("slaveSummary", "card"); @@ -930,14 +930,14 @@ App.UI.SlaveList.penthousePage = function() { " is serving as your bodyguard. "); const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Bodyguard", "BG Select"), "major-link"); link.id = "manageBG"; - slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[B]", "hotkey")); + slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("BG Select"), "hotkey")); slaveWrapper.append(App.UI.SlaveList.render.listDOM([BG.ID], [], App.UI.SlaveList.SlaveInteract.penthouseInteract)); slaveWrapper.append(App.MainView.useGuard()); } else { slaveWrapper.append("You have ", App.UI.DOM.makeElement("span", "not", "warning"), " selected a Bodyguard. ", App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Select one", "BG Select"), "major-link"), - " ", App.UI.DOM.makeElement("span", "[B]", "hotkey")); + " ", App.UI.DOM.makeElement("span", App.UI.Hotkeys.hotkeys("BG Select"), "hotkey")); slaveWrapper.id = "manageBG"; if (V.slavePanelStyle === 2) { slaveWrapper.classList.add("slaveSummary", "card"); diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw index 3052912793446c8b4de549988409c765eda39cec..ea3c2115bf8e613d1f03a6fc621b52ab78d9124f 100644 --- a/src/uncategorized/slaveInteract.tw +++ b/src/uncategorized/slaveInteract.tw @@ -62,8 +62,8 @@ [[Cheat Edit Slave Alternative|MOD_Edit Slave Cheat New][$cheater = 1]] </div> <</if>> - <span class="cyan"> - [â†,Q] + <span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("prevSlave")>> </span> <span id="prevSlave" style="font-weight:bold"> <<link "Prev" "Slave Interact">><<set $activeSlave = getSlave(_slavesInLine[0])>><</link>> @@ -76,8 +76,8 @@ <span id="nextSlave" style="font-weight:bold"> <<link "Next" "Slave Interact">><<set $activeSlave = getSlave(_slavesInLine[1])>><</link>> </span> - <span class="cyan"> - [E,→] + <span class="hotkey"> + <<print App.UI.Hotkeys.hotkeys("nextSlave")>> </span> </p> <div class="tabbar">