-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcode-tools-fix.html
More file actions
40 lines (35 loc) · 1.1 KB
/
Copy pathcode-tools-fix.html
File metadata and controls
40 lines (35 loc) · 1.1 KB
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
<script>
document.addEventListener("DOMContentLoaded", function () {
function setAllCodeVisibility(show) {
document.querySelectorAll(".cell details.code-fold").forEach(function (details) {
if (show) {
details.open = true;
} else {
details.removeAttribute("open");
}
});
document.querySelectorAll(".cell div.sourceCode.cell-code").forEach(function (code) {
var fromClass = show ? "hidden" : "unhidden";
var toClass = show ? "unhidden" : "hidden";
if (code.classList.contains(fromClass)) {
code.classList.remove(fromClass);
code.classList.add(toClass);
}
});
}
var showAllCode = document.getElementById("quarto-show-all-code");
var hideAllCode = document.getElementById("quarto-hide-all-code");
if (showAllCode) {
showAllCode.addEventListener("click", function (event) {
event.preventDefault();
setAllCodeVisibility(true);
});
}
if (hideAllCode) {
hideAllCode.addEventListener("click", function (event) {
event.preventDefault();
setAllCodeVisibility(false);
});
}
});
</script>