[#1242] DOC: Foldable TOC for User Manual and Quick Guide (adds missing parts)

This commit is contained in:
Remko Popma
2020-11-02 07:23:27 +09:00
parent 6ca7be2dcc
commit ae9e94e1ac
2 changed files with 68 additions and 0 deletions

View File

@@ -16237,5 +16237,39 @@ pre.rouge {
background-color: #f8f8f8;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/3.0.7/tocbot.min.js"></script>
<script>
/* Tocbot dynamic TOC, works with tocbot 3.0.7 */
var oldtoc = document.getElementById('toctitle').nextElementSibling;
var newtoc = document.createElement('div');
newtoc.setAttribute('id', 'tocbot');
newtoc.setAttribute('class', 'js-toc');
oldtoc.parentNode.replaceChild(newtoc, oldtoc);
tocbot.init({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: false,
collapseDepth: 3 });
var handleTocOnResize = function() {
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
if (width < 768) {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
collapseDepth: 6,
activeLinkClass: 'ignoreactive',
throttleTimeout: 1000,
smoothScroll: false });
}
else {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: false,
collapseDepth: 3 });
}
};
window.addEventListener('resize', handleTocOnResize);
handleTocOnResize();
</script>
</body>
</html>

View File

@@ -3669,5 +3669,39 @@ table.CodeRay td.code{padding:0 0 0 .75em}
.CodeRay .change .change{color:#66f}
.CodeRay .head .head{color:#f4f}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/3.0.7/tocbot.min.js"></script>
<script>
/* Tocbot dynamic TOC, works with tocbot 3.0.7 */
var oldtoc = document.getElementById('toctitle').nextElementSibling;
var newtoc = document.createElement('div');
newtoc.setAttribute('id', 'tocbot');
newtoc.setAttribute('class', 'js-toc');
oldtoc.parentNode.replaceChild(newtoc, oldtoc);
tocbot.init({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: false,
collapseDepth: 2 });
var handleTocOnResize = function() {
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
if (width < 768) {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
collapseDepth: 6,
activeLinkClass: 'ignoreactive',
throttleTimeout: 1000,
smoothScroll: false });
}
else {
tocbot.refresh({ contentSelector: '#content',
headingSelector: 'h1, h2, h3, h4',
smoothScroll: false,
collapseDepth: 2 });
}
};
window.addEventListener('resize', handleTocOnResize);
handleTocOnResize();
</script>
</body>
</html>