Hide API code examples using expand containers by default

This commit is contained in:
RichardG867
2022-03-20 14:31:25 -03:00
parent 7a90860982
commit 5be83357c5
7 changed files with 695 additions and 503 deletions

View File

@@ -54,3 +54,28 @@ div.bit-table > div.wy-table-responsive > table > thead > tr > th:not(.stub), di
min-width: 26px;
padding: 0;
}
/* Toggle containers. */
.toggle {
background: #f3f6f6;
border: 1px solid #e1e4e5;
padding: 1em;
margin: 0 0 24px;
}
.toggle-closed > .toggle-header, .toggle-open > .toggle-header {
cursor: pointer;
}
.toggle > .toggle-header > p {
font-weight: bold;
margin-bottom: 0;
}
.toggle > div:nth-child(2) {
margin-top: 12px;
margin-bottom: 0;
}
.toggle-closed > .toggle-header > p:before {
content: "\0025B6 ";
}
.toggle-open > .toggle-header > p:before {
content: "\0025BC ";
}

25
_static/js/86box.js Normal file
View File

@@ -0,0 +1,25 @@
/* Toggle containers, modified from: https://stackoverflow.com/questions/2454577/sphinx-restructuredtext-show-hide-code-snippets */
$(document).ready(function() {
/* Hide all toggle containers. */
$('.toggle').children().not('.toggle-header').hide();
$('.toggle').toggleClass('toggle-closed');
/* Add click handlers for the header. */
$('.toggle-header').click(function() {
/* Toggle the container. */
$(this).parent().children().not('.toggle-header').toggle(400);
$(this).parent().toggleClass('toggle-open toggle-closed');
});
/* Fix scroll position if a heading is provided in the URL.
Actually hit or miss but I can't think of a better solution. */
if ($('.toggle').length && document.location.hash) {
$(window).on('load', function() {
setTimeout(function() {
var hash = document.location.hash;
document.location.hash = hash + '_';
document.location.hash = hash;
}, 0);
});
}
});