generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
44 lines (40 loc) · 1.09 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.type === "childList") {
try {
const [path, page] = window.location.pathname.split("/").slice(1);
// Notebooks
if (
path === "components" &&
[
"dashboard",
"chart",
"table",
"sql-editor",
"chart-editor",
"report-builder",
"examples",
].includes(page)
) {
const toc = document.querySelector("#table-of-contents");
if (toc) toc.style.display = "none";
}
const contentArea = document.querySelector("#content-area");
if (contentArea) {
contentArea.style.overflow = "visible";
}
const codeblocks = document.querySelectorAll(
"[class*='dark:bg-codeblock']"
);
for (block of codeblocks) {
block.style.maxHeight = "400px";
block.style.overflow = "auto";
}
// if (toc) toc.style.display = "none";
} catch (error) {
console.error("Error handling mutation:", error);
}
}
});
});
observer.observe(document.body, { childList: true, subtree: true });