diff --git a/assets/gitbook-fix.css b/assets/gitbook-fix.css index 2fbfbf1..9ea7dfe 100644 --- a/assets/gitbook-fix.css +++ b/assets/gitbook-fix.css @@ -27,3 +27,44 @@ .book .book-summary .exc-trigger:before { content: "\f054"; } + +.book-summary ul.summary div.summary-container { + padding: 0; + max-height: 0; + overflow: hidden; +} + +.book-summary ul.summary div.summary-container.on { + padding: 7px 0; + max-height: unset; +} + +.book-summary ul.summary li.divider.block-end { + margin-top: 0; + position: relative; + overflow: unset; +} + +.book-summary ul.summary li.divider.block-start { + margin-bottom: 0; +} + +.book-summary ul.summary li.divider.block-end .summary-container-icon { + position: absolute; + top: 1px; + right: 20px; + padding: 0 5px 2px; + background: rgba(0,0,0,.07); + color: white; + border-bottom: 0; + border-radius: 0 0 5px 5px; + z-index: 1000; +} + +.book-summary ul.summary li.divider.block-end .summary-container-icon .fa:before { + content: "\f078"; +} + +.book-summary ul.summary div.summary-container.on + li.divider.block-end { + transform: rotateX(180deg); +} diff --git a/assets/gitbook-fix.js b/assets/gitbook-fix.js index 860e492..f7aa339 100644 --- a/assets/gitbook-fix.js +++ b/assets/gitbook-fix.js @@ -29,3 +29,16 @@ for (let node of document.getElementsByClassName("fold")) { } else node.classList.add("on"); }); } + +for (const node of document.getElementsByClassName("summary-container")) { + + node.nextElementSibling.innerHTML = node.nextElementSibling.innerHTML + ""; + node.nextElementSibling.getElementsByClassName("summary-container-icon")[0].addEventListener("click", function () { + if (node.classList.contains("on")) { + node.classList.remove("on") + } else { + node.classList.add("on") + } + }) + +} diff --git a/src/Element/Bookshelf.php b/src/Element/Bookshelf.php index 5c0cdbd..d7ee6b6 100644 --- a/src/Element/Bookshelf.php +++ b/src/Element/Bookshelf.php @@ -73,9 +73,9 @@ class Bookshelf { public function getHtml (): string { $str = "";