|
|
@@ -48,7 +48,8 @@
|
|
|
|
|
|
|
|
|
{{define "folder"}}
|
|
|
-<details open class="group">
|
|
|
+<details class="group" id="folder-{{.Nume}}"
|
|
|
+ ontoggle="saveFolderState('folder-{{.Nume}}', this.open)">
|
|
|
|
|
|
<summary class="flex items-center justify-between px-2 py-1 text-xs rounded hover:bg-zinc-800 cursor-pointer list-none text-zinc-400 group-open:text-zinc-200 transition-colors">
|
|
|
<div class="flex items-center gap-1.5 min-w-0">
|
|
|
@@ -156,4 +157,26 @@
|
|
|
</div>
|
|
|
|
|
|
</details>
|
|
|
-{{end}}
|
|
|
+{{end}}
|
|
|
+
|
|
|
+<script>
|
|
|
+ function saveFolderState(id, isOpen) {
|
|
|
+ const states = JSON.parse(localStorage.getItem('folderStates') || '{}');
|
|
|
+ states[id] = isOpen;
|
|
|
+ localStorage.setItem('folderStates', JSON.stringify(states));
|
|
|
+ }
|
|
|
+
|
|
|
+ function restoreFolderStates() {
|
|
|
+ const states = JSON.parse(localStorage.getItem('folderStates') || '{}');
|
|
|
+ document.querySelectorAll('details[id^="folder-"]').forEach(details => {
|
|
|
+ const id = details.id;
|
|
|
+ if (id in states) {
|
|
|
+ details.open = states[id];
|
|
|
+ } else {
|
|
|
+ details.open = true; // default open on first visit
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ document.addEventListener('DOMContentLoaded', restoreFolderStates);
|
|
|
+</script>
|