dialog: Wortmeldungs-Zähler am „→ Dialog"-Link + Live via Polling (10s)

- Artikel-Link zeigt „→ Dialog · N" wenn Wortmeldungen existieren
- Widget lädt alle 10s nach, rendert nur bei Änderung neu (kein Flackern),
  pausiert im Hintergrund-Tab. Echtes Supabase-Realtime bleibt optional.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 14:25:55 +02:00
parent 1284747341
commit 3594e78d4a
2 changed files with 17 additions and 3 deletions
+10 -1
View File
@@ -64,7 +64,16 @@
{{- end }}
{{/* Dialog liegt auf eigener Seite — der Beitrag bleibt sauber */}}
<a class="dialog-link" href="/dialog/?thread={{ .RelPermalink }}">→ Dialog</a>
<a class="dialog-link" id="dialog-link" data-thread="{{ .RelPermalink }}" href="/dialog/?thread={{ .RelPermalink }}">→ Dialog</a>
<script>
(function () {
var l = document.getElementById('dialog-link'); if (!l) return;
fetch('/api/comments?thread=' + encodeURIComponent(l.dataset.thread))
.then(function (r) { return r.ok ? r.json() : []; })
.then(function (d) { var n = d.filter(function (c) { return !c.deleted; }).length; if (n) l.textContent = '→ Dialog · ' + n; })
.catch(function () {});
})();
</script>
</article>
{{ end }}