From bddb47ad7557853b80ddcffabc6d39199b56ec13 Mon Sep 17 00:00:00 2001 From: Arkerthan <arkerthan@gmail.com> Date: Wed, 20 May 2020 10:44:28 +0200 Subject: [PATCH] Categories are never passage links --- src/003-assets/CSS/quicklinks.css | 1 - src/gui/quicklinks.js | 20 +++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/003-assets/CSS/quicklinks.css b/src/003-assets/CSS/quicklinks.css index 32cab7b039f..05a90ade95b 100644 --- a/src/003-assets/CSS/quicklinks.css +++ b/src/003-assets/CSS/quicklinks.css @@ -50,7 +50,6 @@ div.quick-links div:not(.menu-link):not(.collapsed) + div.menu-link /* give the } /* notification */ - div.quick-links div.notification:not(.category)::after /* notification for entry */, div.quick-links div.category.notification.collapsed > div.toggle::after /* notification for category, disable when uncollapsed */ { diff --git a/src/gui/quicklinks.js b/src/gui/quicklinks.js index 59ea03947d7..c2e487fa1fc 100644 --- a/src/gui/quicklinks.js +++ b/src/gui/quicklinks.js @@ -15,6 +15,7 @@ App.UI.quickMenu = (function() { 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. + // category titles are never links to passages // Only two values are allowed: true or an object following the same rules const layout = addOtherCategory({ Main: true, @@ -65,7 +66,7 @@ App.UI.quickMenu = (function() { Tools: { "Find Slave": true, }, - " Options ": { // we trick here so it's handled as pure deco + Options: { Options: true, "Summary Options": true, "Description Options": true, @@ -342,7 +343,7 @@ App.UI.quickMenu = (function() { function generateCategory(name, group) { const toggle = document.createElement("div"); toggle.classList.add("toggle"); - addMenuLink(toggle, name, true); + toggle.append(name); const content = document.createElement("div"); content.classList.add("content"); content.append(generateLinkList(group)); @@ -357,22 +358,15 @@ App.UI.quickMenu = (function() { return wrapper; } - function addMenuLink(container, passage, toggle = false) { + function addMenuLink(container, passage) { // passage is hidden - let hidden = false; if (hiddenPassages.hasOwnProperty(passage) && hiddenPassages[passage]()) { - // only return if the passage is not a category, if it's a category, we handle it like a deco element - if (!toggle) { - return; - } - hidden = true; + return; } // we show some kind of text/link const div = document.createElement("div"); container.append(div); - if (!toggle) { - div.classList.add("menu-link"); - } + div.classList.add("menu-link"); // this passage has a notification if (notifications[passage] && notifications[passage]()) { notificationPassages.push(div); @@ -389,7 +383,7 @@ App.UI.quickMenu = (function() { return; } // That is not a passage we can safely jump to, it's a deco element - if (hidden || !jumpTo.includes(passage)) { + if (!jumpTo.includes(passage)) { div.prepend(uiName(passage)); return; } -- GitLab