-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmisc.html
27 lines (25 loc) · 840 Bytes
/
misc.html
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
<!-- collapse buttons -->
<script>
var container = document.querySelector(".sidebar-title");
var button = document.createElement("button");
button.style.border = "none";
button.style.backgroundColor = "unset";
var icon = document.createElement("i");
icon.classList = "bi bi-arrows-collapse";
button.appendChild(icon);
button.onclick = onbuttonclicked;
container.appendChild(button);
function onbuttonclicked() {
if (icon.classList == "bi bi-arrows-collapse") {
document.querySelectorAll(
"a.sidebar-item-toggle:not(.collapsed)"
).forEach((x) => x.click());
icon.classList = "bi bi-arrows-expand";
} else {
document.querySelectorAll(
"a.sidebar-item-toggle.collapsed"
).forEach((x) => x.click());
icon.classList = "bi bi-arrows-collapse";
}
}
</script>