You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/09/19 10:18:30 UTC

[isis-antora] 01/03: CSS improvements for tocbot

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis-antora.git

commit d0bd3e5cbb10e0043cfbba9f48e9d7c80acba998
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Sep 19 06:56:20 2019 +0200

    CSS improvements for tocbot
---
 src/css/extensions/article-toc.css | 46 ++++++++++++++++++++++++++++----------
 src/partials/footer-scripts.hbs    |  9 ++++----
 2 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/src/css/extensions/article-toc.css b/src/css/extensions/article-toc.css
index 9ec6eb2..aaab78a 100644
--- a/src/css/extensions/article-toc.css
+++ b/src/css/extensions/article-toc.css
@@ -2,18 +2,29 @@
   position: relative;
 }
 
-.doc h1::before,
-.doc h2::before,
-.doc h3::before,
-.doc h4::before,
-.doc h5::before,
-.doc h6::before {
-  display: block;
-  content: " ";
-  height: 130px;
-  margin-top: -130px;
-  visibility: hidden;
-  overflow: hidden;
+/* adapted from https://github.com/tscanlin/tocbot/issues/58 */
+@media screen {
+  .doc h2::before {
+    display: block;
+    content: " ";
+    height: 112px;
+    padding-top: -112px;
+    visibility: hidden;
+    overflow: visible;
+  }
+}
+
+@media screen {
+  .doc h3::before,
+  .doc h4::before {
+    display: block;
+    content: " ";
+    height: 112px;
+    padding-top: -56px;
+    margin-top: -56px;
+    visibility: hidden;
+    overflow: visible;
+  }
 }
 
 .article-aside {
@@ -97,3 +108,14 @@
 .is-collapsed {
   display: none;
 }
+
+/* as per https://github.com/tscanlin/tocbot/issues/121 */
+h1:focus,
+h2:focus,
+h3:focus,
+h4:focus,
+h5:focus,
+h6:focus {
+  outline: none !important;
+  box-shadow: none !important;
+}
diff --git a/src/partials/footer-scripts.hbs b/src/partials/footer-scripts.hbs
index 2a4be65..b207d97 100644
--- a/src/partials/footer-scripts.hbs
+++ b/src/partials/footer-scripts.hbs
@@ -1,4 +1,4 @@
-<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.1.1/tocbot.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.8.0/tocbot.min.js"></script>
 
 <script src="{{uiRootPath}}/js/site.js"></script>
 <script async src="{{uiRootPath}}/js/vendor/highlight.js"></script>
@@ -7,10 +7,11 @@
     tocbot.init( {
         tocSelector: '#article-toc',
         contentSelector: 'article',
-        headingSelector: 'h2, h3, h4, h5, h6',
-        collapseDepth: 6,
+        headingSelector: 'h2, h3, h4',
+        collapseDepth: 2,
         positionFixedSelector: '#article-toc',
-        scrollSmooth: false
+        scrollSmooth: true,
+        hasInnerContainers: true
     } );
     var tocList = document.getElementById( 'article-toc' ).getElementsByClassName( 'toc-list' );
     if ( tocList && tocList.length > 0 && tocList[0].childNodes.length > 0 ) {