diff --git a/about.json b/about.json index 7616d2a..edbb57a 100644 --- a/about.json +++ b/about.json @@ -2,5 +2,8 @@ "name": "DiscoTOC", "about_url": "https://meta.discourse.org/t/discotoc-automatic-table-of-contents/111143", "component": true, - "license_url": "https://github.com/discourse/DiscoTOC/blob/main/LICENSE" + "license_url": "https://github.com/discourse/DiscoTOC/blob/main/LICENSE", + "assets": { + "icons-sprite": "/assets/sprite.svg" + } } diff --git a/assets/sprite.svg b/assets/sprite.svg new file mode 100644 index 0000000..e2bc562 --- /dev/null +++ b/assets/sprite.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/common/common.scss b/common/common.scss index a64ffe9..e8586c7 100644 --- a/common/common.scss +++ b/common/common.scss @@ -150,6 +150,21 @@ opacity: 0.6; } } + #bottom-anchor { + opacity: 0; + height: 0; + margin: 0; + } + + .post-bottom-wrapper { + padding: 0.8em 0.5em 0 0.5em; + a { + color: var(--primary-med-or-secondary-med); + } + } + .d-toc { + margin-top: 1em; + } } // large screens @@ -169,7 +184,6 @@ .d-toc { max-height: 85vh; padding-left: 0; - margin-top: 50px; position: -webkit-sticky; position: sticky; top: 75px; @@ -217,6 +231,9 @@ // small screens @media screen and (max-width: $large-width) { .d-toc-regular { + .post-bottom-wrapper { + display: none; + } #d-toc { z-index: z("header") + 1; background: var(--secondary, $secondary); diff --git a/common/header.html b/common/header.html index b712089..2a1e23c 100644 --- a/common/header.html +++ b/common/header.html @@ -268,6 +268,8 @@ }); }); + body.append(``); + let dTocHeadingSelectors = "h1,h2,h3,h4,h5,h6"; if (!body.has(">h1").length) { dTocHeadingSelectors = "h2,h3,h4,h5,h6"; @@ -308,22 +310,31 @@ .addClass("d-toc-cooked") .prepend( ` - ${dtocIcon} ${I18n.t(themePrefix("table_of_contents"))} - ` + ${dtocIcon} ${I18n.t(themePrefix("table_of_contents"))} + ` ) .parents(".regular") .addClass("d-toc-regular") .parents("article") .addClass("d-toc-article") .append( - `` + `
+
+ ${iconHTML("bottom")} +
+ +
+ ` ) + .parents(".topic-post") .addClass("d-toc-post") .parents("body") diff --git a/locales/en.yml b/locales/en.yml index 3f16910..b7142b0 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -1,3 +1,4 @@ en: table_of_contents: "table of contents" insert_table_of_contents: "Insert table of contents" + post_bottom_tooltip: "Navigate to post controls"