diff --git a/assets/gitbook-fix.css b/assets/gitbook-fix.css new file mode 100644 index 0000000..2fbfbf1 --- /dev/null +++ b/assets/gitbook-fix.css @@ -0,0 +1,29 @@ + +.fold > ul { + max-height: 0; + overflow: hidden; + transition-duration: 0.5s; +} + +.fold.on > ul { + max-height: unset; +} + +.book .book-summary ul.summary li a, .book .book-summary ul.summary li span { + padding-left: 30px; + cursor: pointer; +} + +.book .book-summary .exc-trigger { + position: absolute; + left: 12px; + top: 12px; +} + +.book .book-summary .on > a .exc-trigger:before { + content: "\f078"; +} + +.book .book-summary .exc-trigger:before { + content: "\f054"; +} diff --git a/assets/gitbook-fix.js b/assets/gitbook-fix.js index b64674b..860e492 100644 --- a/assets/gitbook-fix.js +++ b/assets/gitbook-fix.js @@ -21,3 +21,11 @@ window.onload = function () { } }; + +for (let node of document.getElementsByClassName("fold")) { + node.childNodes[0].addEventListener("click", function () { + if (node.classList.contains("on")) { + node.classList.remove("on"); + } else node.classList.add("on"); + }); +} diff --git a/src/Data/SiteMeta.php b/src/Data/SiteMeta.php index ca01ecb..8e498be 100644 --- a/src/Data/SiteMeta.php +++ b/src/Data/SiteMeta.php @@ -24,6 +24,7 @@ class SiteMeta { public static function getGitbookStylesheetsList (): array { return array( "/assets/gitbook/style.css", + "/assets/gitbook-fix.css", ); } diff --git a/src/Element/BookCollection.php b/src/Element/BookCollection.php index 7c3a2be..774487e 100644 --- a/src/Element/BookCollection.php +++ b/src/Element/BookCollection.php @@ -72,7 +72,7 @@ class BookCollection { public function getHtml (): string { $str = ""; - if ($this->name != self::ROOT) $str .= "