Changeset 6dd26e5 in Klonkt for src/views/partials/post-tile.ejs
- Timestamp:
- 07/30/2026 11:48:53 AM (6 weeks ago)
- Branches:
- main
- Children:
- 1f640ff
- Parents:
- 67f7150
- File:
-
- 1 edited
-
src/views/partials/post-tile.ejs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/partials/post-tile.ejs
r67f7150 r6dd26e5 11 11 // content instead, like the Cirkel card: first <video> (with its poster) or 12 12 // first <img>. 13 let _cVideo = null, _cPoster = null, _cImg = null ;13 let _cVideo = null, _cPoster = null, _cImg = null, _cAudio = false, _cWave = null; 14 14 if (!_hasCover && post.content) { 15 15 const vm = String(post.content).match(/<video[^>]*\ssrc="([^"]+)"[^>]*>/i); 16 16 if (vm) { _cVideo = vm[1]; const pm = vm[0].match(/poster="([^"]+)"/i); if (pm) _cPoster = pm[1]; } 17 else { const im = String(post.content).match(/<img[^>]*\ssrc="([^"]+)"/i); if (im) _cImg = im[1]; } 17 else { 18 const im = String(post.content).match(/<img[^>]*\ssrc="([^"]+)"/i); 19 if (im) _cImg = im[1]; 20 else { 21 // An audio post (Robins vraag, 30-7): the waveform the upload leg drew 22 // (data-poster) goes OVER the gradient, so the tile keeps its own hue. 23 const am = String(post.content).match(/<audio[^>]*>/i); 24 if (am) { _cAudio = true; const wm = am[0].match(/data-poster="([^"]+)"/i); if (wm) _cWave = wm[1]; } 25 } 26 } 18 27 } 19 const _showCover = _hasCover || !!_cVideo || !!_cImg; 28 const _showCover = _hasCover || !!_cVideo || !!_cImg; // the wave keeps the gradient 29 // A C2S post has no title: fall back to the post's own words, and for a 30 // media-only post to a friendly type label instead of "(untitled)". A tile 31 // that already shows its picture needs no forced label at all. 32 let _title = post.title || ''; 33 if (!_title && post.content) { 34 const _txt = String(post.content).replace(/<[^>]*>/g, ' ').replace(/&[a-zA-Z#0-9]+;/g, ' ').replace(/\s+/g, ' ').trim(); 35 if (_txt) _title = _txt.length > 64 ? _txt.slice(0, 63).replace(/\s+\S*$/, '') + '…' : _txt; 36 } 37 if (!_title) _title = _cAudio ? '♪ audio' : (_cVideo || _cImg) ? '' : '(untitled)'; 20 38 const _typeLabel = (post.type && post.type !== 'post') ? post.type : ''; 21 39 const _src = post.source_name || ''; // bron-site (cirkel-feed: van welke site komt deze post) … … 30 48 <% if (_ext) { %>target="_blank" rel="noopener"<% } else { %>hx-get="<%= _href %>?partial=1" hx-target="#pcms-main" hx-swap="innerHTML" hx-push-url="<%= _href %>" hx-indicator="#pcms-loading"<% } %>> 31 49 32 <% if (post.cover_image_url) { %><img class="grid-tile-img" src="<%= thumb(post.cover_image_url, 480) %>" alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>><% } else if (post.cover_video_url) { %><video class="grid-tile-img" src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } else if (_cVideo) { %><video class="grid-tile-img" src="<%= _cVideo %>"<% if (_cPoster) { %> poster="<%= _cPoster %>"<% } %> autoplay loop muted playsinline preload="metadata"></video><% } else if (_cImg) { %><img class="grid-tile-img" src="<%= _cImg %>" alt="" loading="lazy" decoding="async"><% } %>50 <% if (post.cover_image_url) { %><img class="grid-tile-img" src="<%= thumb(post.cover_image_url, 480) %>" alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>><% } else if (post.cover_video_url) { %><video class="grid-tile-img" src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } else if (_cVideo) { %><video class="grid-tile-img" src="<%= _cVideo %>"<% if (_cPoster) { %> poster="<%= _cPoster %>"<% } %> autoplay loop muted playsinline preload="metadata"></video><% } else if (_cImg) { %><img class="grid-tile-img" src="<%= _cImg %>" alt="" loading="lazy" decoding="async"><% } else if (_cWave) { %><img class="grid-tile-img grid-tile-wave" src="<%= _cWave %>" alt="" loading="lazy" decoding="async"><% } %> 33 51 34 52 <% if (_typeLabel) { %> … … 43 61 <% if (_hasCover) { %> 44 62 <div class="grid-tile-overlay"> 45 <strong><%= post.title || '(untitled)'%></strong>63 <strong><%= _title %></strong> 46 64 <% if (_src) { %><span class="grid-tile-overlay-src">van <%= _src %></span><% } %> 47 65 </div> 48 66 <% } else { %> 49 <span class="grid-tile-title"><%= post.title || '(untitled)'%></span>67 <span class="grid-tile-title"><%= _title %></span> 50 68 <% if (_src) { %><span class="grid-tile-gradient-src">van <%= _src %></span><% } %> 51 69 <% } %>
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)