-
Notifications
You must be signed in to change notification settings - Fork 1
/
sidebar.html
46 lines (42 loc) · 1.41 KB
/
sidebar.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<input type="checkbox" id="hamburger" class="hamburger-btn">
<label for="hamburger" class="hamburger-btn">≡</label>
<nav id="seitenleiste">
<div style="margin: 10px;">
<h2 id="überschrift">{{ T "toc" }}</h2>
<a href="/Bedienungsanleitung">Die Deutsche<br>Programmiersprache</a>
<ol id="artikel-links">
{{ define "links" -}}
{{- range .page.Pages -}}
{{- if .IsSection -}}
<li>
<details id="Section-{{ .Title }}" {{ if (in $.ancestors .) }} open {{ end }}>
<summary><a href="{{ .RelPermalink }}">{{ .Title }}</a></summary>
<ol>
{{ template "links" (dict "page" . "ancestors" $.ancestors) }}
</ol>
</details>
</li>
{{ else }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end -}}
{{- end -}}
{{- end -}}
{{- template "links" (dict "page" (.GetPage "") "ancestors" .Ancestors) -}}
<script>
const details = document.querySelectorAll('#artikel-links details');
for (const detail of details) {
detail.open = window.localStorage.getItem(detail.id) === "true";
detail.addEventListener('toggle', (event) => {
window.localStorage.setItem(event.target.id, event.target.open);
})
}
</script>
</ol>
</div>
</nav>
<script>
const sbtop = localStorage.getItem("sidebar-scroll");
if (sbtop !== null) {
document.getElementById("seitenleiste").scrollTop = parseInt(sbtop, 10);
}
</script>