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:
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user