Changeset 28267519 in Klonkt for src/assets/js
- Timestamp:
- 07/25/2026 07:43:37 AM (7 weeks ago)
- Branches:
- main
- Children:
- 5c373b8
- Parents:
- 05665bc
- File:
-
- 1 edited
-
src/assets/js/guardian2.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/guardian2.js
r05665bc r28267519 133 133 function renderAll() { renderHelp(); renderPending(); renderWards(); } 134 134 135 // ── 0. Wards' corner: read-only feed of your wards' posts ─────────────── 136 function renderFeed(items) { 137 var list = document.getElementById('feed-list'); 138 list.textContent = ''; 139 (items || []).forEach(function (p) { 140 var card = el('div', 'g-card feed'); 141 var head = el('div', 'row'); 142 head.appendChild(el('span', 'who grow', p.author)); 143 if (p.published) head.appendChild(el('span', 'g-when', when(p.published))); 144 card.appendChild(head); 145 var body = el('div', 'feed-body'); 146 if (p.cw) { 147 var d = document.createElement('details'); 148 var sum = document.createElement('summary'); sum.textContent = p.cw; d.appendChild(sum); 149 var inner = el('div'); inner.innerHTML = p.content || ''; d.appendChild(inner); 150 body.appendChild(d); 151 } else { 152 body.innerHTML = p.content || ''; // server-sanitized HTML (same as Berichten) 153 } 154 card.appendChild(body); 155 list.appendChild(card); 156 }); 157 show('feed-section', (items || []).length > 0); 158 } 159 160 function loadFeed() { 161 return fetch('/guardian2/api/feed?site=' + encodeURIComponent(S.site)) 162 .then(function (r) { return r.json(); }) 163 .then(function (f) { if (f && !f.error) renderFeed(f.items); }) 164 .catch(function () { /* corner just stays hidden */ }); 165 } 166 135 167 function refresh() { 136 168 return fetch('/guardian2/api/state?site=' + encodeURIComponent(S.site)) 137 169 .then(function (r) { return r.json(); }) 138 .then(function (s) { if (s && !s.error) { S = s; T = s.strings || T; renderAll(); } }); 170 .then(function (s) { if (s && !s.error) { S = s; T = s.strings || T; renderAll(); } }) 171 .then(loadFeed); 139 172 } 140 173 … … 230 263 }); 231 264 232 renderAll(); pushState(); 265 renderAll(); pushState(); loadFeed(); 233 266 setInterval(refresh, 45000); // live-ish while open 234 267 } catch (e) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)