diff --git a/src/facilities/farmyard/farmerSelect.tw b/src/facilities/farmyard/farmerSelect.tw index e94fb005024f84ead1a820fcc4e6bf75d210d905..8ea9151878320174b1fb79caa18beaa0fa466853 100644 --- a/src/facilities/farmyard/farmerSelect.tw +++ b/src/facilities/farmyard/farmerSelect.tw @@ -1,4 +1,4 @@ -:: Farmer Select [nobr jump-from-safe] +:: Farmer Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Farmyard", $encyclopedia = "Farmer">> <<if ($Farmer != 0)>> diff --git a/src/facilities/nursery/matronSelect.tw b/src/facilities/nursery/matronSelect.tw index 334c05b7a2356cc2b7173502765c72563b0f40e1..0b52309d0ff93d1b91e2d27dc1f76f066caefa6b 100644 --- a/src/facilities/nursery/matronSelect.tw +++ b/src/facilities/nursery/matronSelect.tw @@ -1,4 +1,4 @@ -:: Matron Select [nobr jump-from-safe] +:: Matron Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Nursery", $encyclopedia = "Matron">> <<if ($Matron != 0)>> diff --git a/src/gui/quicklinks.js b/src/gui/quicklinks.js index 1930c43d79224339f1fb2f6b2105e79d11d0d9e8..85418531546bc74e1cdbdc31f4fcbfcfbc54572c 100644 --- a/src/gui/quicklinks.js +++ b/src/gui/quicklinks.js @@ -4,14 +4,16 @@ * Tags are: * jump-to-safe: Allow to jump to this passage from anywhere * jump-from-safe: Allow to jump from this passage to anywhere + * hidden: Allows to jump to via history, but does not show up in the quick links menu; use together with jump-to-safe * no-history: Do not record history for this passage, act as if was never opened; mutually exclusive with the jump tags * * @returns {DocumentFragment} */ App.UI.quickMenu = (function() { - // setup safe passages + // setup passage lists const jumpFrom = Story.lookup("tags", "jump-from-safe").map(passage => passage.title); const jumpTo = Story.lookup("tags", "jump-to-safe").map(passage => passage.title); + const hidden = Story.lookup("tags", "jump-hidden").map(passage => passage.title); const noHistory = Story.lookup("tags", "no-history").map(passage => passage.title); // if property name is a passage name, then it's a link, otherwise only text. @@ -267,9 +269,9 @@ App.UI.quickMenu = (function() { /** * Add a "Return" link at second position if there is a history. - * @param {HTMLDivElement} container + * @param {Array<HTMLElement>} linkList */ - function addBackLink(container) { + function addBackLink(linkList) { if (history.length > 0) { const div = document.createElement("div"); div.classList.add("menu-link"); @@ -278,7 +280,7 @@ App.UI.quickMenu = (function() { a.onclick = goBack; div.append(a, " ", App.UI.DOM.makeElement("span", "[backspace]", "hotkey")); // insert at second position - container.insertBefore(div, container.firstChild.nextSibling); + linkList.splice(1, 0, div); } } @@ -300,8 +302,18 @@ App.UI.quickMenu = (function() { try { // quick menu - div.append(...generateLinkList(layout)); - addBackLink(div); + const links = generateLinkList(layout); + + if (V.debugMode) { + addCategory(links, "Hidden", hidden.reduce((acc, cur) => { + acc[cur] = true; + return acc; + }, {})); + } + + addBackLink(links); + div.append(...links); + // traverse from current passage up to uncollapse. if (currentPassage !== null) { @@ -449,8 +461,19 @@ App.UI.quickMenu = (function() { */ function addOtherCategory(layout) { const passages = jumpTo.slice(); + + // filter out passages used in layout filterPassages(passages, layout); + // filter out hidden passages + for (let i = 0; i < hidden.length; i++) { + const index = passages.indexOf(hidden[i]); + if (index > -1) { + passages.splice(index, 1); + } + } + + // Other category if (passages.length > 0) { const other = {}; for (let i = 0; i < passages.length; i++) { @@ -469,8 +492,8 @@ App.UI.quickMenu = (function() { */ function filterPassages(passages, layout) { for (const category in layout) { - const index = passages.indexOf(category); if (layout[category] === true) { + const index = passages.indexOf(category); if (index > -1) { passages.splice(index, 1); } diff --git a/src/uncategorized/attendantSelect.tw b/src/uncategorized/attendantSelect.tw index f6d21e712e56d517ca691d222711b4910f324853..9145c5cb49f08cf0b87873ef76cf8558d8dc6ae2 100644 --- a/src/uncategorized/attendantSelect.tw +++ b/src/uncategorized/attendantSelect.tw @@ -1,4 +1,4 @@ -:: Attendant Select [nobr jump-from-safe] +:: Attendant Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Spa", $encyclopedia = "Attendant">> <<if _S.Attendant>> diff --git a/src/uncategorized/concubineSelect.tw b/src/uncategorized/concubineSelect.tw index 4911d97db586459cde01553710fb136f056b8d79..9f153e7544385ea6b05ec7b253285604f9b0fd08 100644 --- a/src/uncategorized/concubineSelect.tw +++ b/src/uncategorized/concubineSelect.tw @@ -1,4 +1,4 @@ -:: Concubine Select [nobr jump-from-safe] +:: Concubine Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Master Suite", $encyclopedia = "Concubine">> <<if ($Concubine != 0)>> diff --git a/src/uncategorized/djSelect.tw b/src/uncategorized/djSelect.tw index b96cb766b59193f820975a399f5de8e61732fc3f..a2c43a88d432afeb1590a8ca20cb3a21d21638a3 100644 --- a/src/uncategorized/djSelect.tw +++ b/src/uncategorized/djSelect.tw @@ -1,4 +1,4 @@ -:: DJ Select [nobr jump-from-safe] +:: DJ Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Club", $encyclopedia = "DJ">> <<if ($DJ != 0)>> diff --git a/src/uncategorized/hgSelect.tw b/src/uncategorized/hgSelect.tw index d84ed190e4314ebd3c5dc33362ed1be2c55bfae5..f729326e0e55e7b14bd8c46ce20f2db40176bba3 100644 --- a/src/uncategorized/hgSelect.tw +++ b/src/uncategorized/hgSelect.tw @@ -1,4 +1,4 @@ -:: HG Select [nobr jump-to-safe jump-from-safe] +:: HG Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back to Main", $nextLink = "Main", $encyclopedia = "Head Girl">> diff --git a/src/uncategorized/madamSelect.tw b/src/uncategorized/madamSelect.tw index 9ba7e7ef90caad2c2c5639db5311ac5f88ac46b2..e72ea4a101805ba5b7f76eda8709d2ee7a88ad01 100644 --- a/src/uncategorized/madamSelect.tw +++ b/src/uncategorized/madamSelect.tw @@ -1,4 +1,4 @@ -:: Madam Select [nobr jump-from-safe] +:: Madam Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Brothel", $encyclopedia = "Madam">> <<if ($Madam != 0)>> diff --git a/src/uncategorized/milkmaidSelect.tw b/src/uncategorized/milkmaidSelect.tw index f10c82b5ebef70ec58b1089db42709376ddff0a7..1123fb3d52790e7d81708c6330d72b4e06133fe1 100644 --- a/src/uncategorized/milkmaidSelect.tw +++ b/src/uncategorized/milkmaidSelect.tw @@ -1,4 +1,4 @@ -:: Milkmaid Select [nobr jump-from-safe] +:: Milkmaid Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Dairy", $encyclopedia = "Milkmaid">> <<if ($Milkmaid != 0)>> diff --git a/src/uncategorized/nurseSelect.tw b/src/uncategorized/nurseSelect.tw index debce7c0d981fe95efba21d0ba0805323ceb237b..87f88a86f690b6e340a7d9f32a947c23781311ab 100644 --- a/src/uncategorized/nurseSelect.tw +++ b/src/uncategorized/nurseSelect.tw @@ -1,4 +1,4 @@ -:: Nurse Select [nobr jump-from-safe] +:: Nurse Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Clinic", $encyclopedia = "Nurse">> <<if ($Nurse != 0)>> diff --git a/src/uncategorized/schoolteacherSelect.tw b/src/uncategorized/schoolteacherSelect.tw index 43cb233361149a1d9d5db3b098661e99afde3b0e..745cc48ed9e1419e2824e3a71ed20b91b9299069 100644 --- a/src/uncategorized/schoolteacherSelect.tw +++ b/src/uncategorized/schoolteacherSelect.tw @@ -1,4 +1,4 @@ -:: Schoolteacher Select [nobr jump-from-safe] +:: Schoolteacher Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Schoolroom", $encyclopedia = "Schoolteacher">> <<if ($Schoolteacher != 0)>> diff --git a/src/uncategorized/stewardessSelect.tw b/src/uncategorized/stewardessSelect.tw index 8ea988a80db05d4de778ff68be0c637e8c317a5f..1c5c4f97b7c7efc3b391293baa551769833d98dd 100644 --- a/src/uncategorized/stewardessSelect.tw +++ b/src/uncategorized/stewardessSelect.tw @@ -1,4 +1,4 @@ -:: Stewardess Select [nobr jump-from-safe] +:: Stewardess Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Servants' Quarters", $encyclopedia = "Stewardess">> <<if ($Stewardess != 0)>> diff --git a/src/uncategorized/wardenessSelect.tw b/src/uncategorized/wardenessSelect.tw index 7180dd34750985c253a84ad2a2dcd41b42c5420d..09e2071672a67317ce29df446d05602c6dcb4c45 100644 --- a/src/uncategorized/wardenessSelect.tw +++ b/src/uncategorized/wardenessSelect.tw @@ -1,4 +1,4 @@ -:: Wardeness Select [nobr jump-from-safe] +:: Wardeness Select [nobr jump-to-safe jump-hidden jump-from-safe] <<set $nextButton = "Back", $nextLink = "Cellblock", $encyclopedia = "Wardeness">> <<if ($Wardeness != 0)>>