65 lines
2.4 KiB
HTML
65 lines
2.4 KiB
HTML
<!-- Expand sidebar tree by default -->
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
document
|
|
.querySelectorAll(".hextra-sidebar-collapsible-button")
|
|
.forEach(function (btn) {
|
|
var li = btn.closest("li");
|
|
if (li) li.classList.add("open");
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<!-- Mermaid config + viewBox from all g elements -->
|
|
<script>
|
|
(function () {
|
|
function patch() {
|
|
if (typeof mermaid === "undefined") return setTimeout(patch, 50);
|
|
var orig = mermaid.initialize;
|
|
mermaid.initialize = function (cfg) {
|
|
cfg = cfg || {};
|
|
cfg.flowchart = cfg.flowchart || {};
|
|
cfg.flowchart.useMaxWidth = true;
|
|
cfg.flowchart.wrappingWidth = 180;
|
|
cfg.theme = "base";
|
|
cfg.themeVariables = cfg.themeVariables || {};
|
|
return orig.call(this, cfg);
|
|
};
|
|
}
|
|
patch();
|
|
|
|
function fixViewBox() {
|
|
document.querySelectorAll(".mermaid svg").forEach(function (svg) {
|
|
if (svg.getAttribute("aria-roledescription") === "pie") return;
|
|
var groups = svg.querySelectorAll("g");
|
|
if (!groups.length) return;
|
|
var minX = Infinity,
|
|
minY = Infinity,
|
|
maxX = -Infinity,
|
|
maxY = -Infinity;
|
|
groups.forEach(function (g) {
|
|
var bb = g.getBBox();
|
|
if (bb.width === 0 || bb.height === 0) return;
|
|
if (bb.x < minX) minX = bb.x;
|
|
if (bb.y < minY) minY = bb.y;
|
|
if (bb.x + bb.width > maxX) maxX = bb.x + bb.width;
|
|
if (bb.y + bb.height > maxY) maxY = bb.y + bb.height;
|
|
});
|
|
if (!isFinite(minX)) return setTimeout(fixViewBox, 200);
|
|
var pad = 16;
|
|
svg.setAttribute(
|
|
"viewBox",
|
|
[
|
|
minX - pad,
|
|
minY - pad,
|
|
maxX - minX + pad * 2,
|
|
maxY - minY + pad * 2,
|
|
].join(" "),
|
|
);
|
|
});
|
|
}
|
|
setTimeout(fixViewBox, 600);
|
|
setTimeout(fixViewBox, 1200);
|
|
})();
|
|
</script>
|