Changeset 2a10445 in Klonkt for src/views/partials/post-card.ejs
- Timestamp:
- 07/30/2026 08:23:47 AM (6 weeks ago)
- Branches:
- main
- Children:
- 094f7d0
- Parents:
- 15f1cb5
- File:
-
- 1 edited
-
src/views/partials/post-card.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/partials/post-card.ejs
r15f1cb5 r2a10445 16 16 const _ext = !!_external; 17 17 const _src = post.source_name || ''; 18 const _hasCover = !!post.cover_image_url || !!post.cover_video_url; 18 const _realCover = !!post.cover_image_url || !!post.cover_video_url; 19 // Content-derived fallback (see post-tile.ejs): a C2S post's media lives in 20 // its content, and the card fronts it from there. 21 let _cVideo = null, _cPoster = null, _cImg = null; 22 if (!_realCover && post.content) { 23 const vm = String(post.content).match(/<video[^>]*\ssrc="([^"]+)"[^>]*>/i); 24 if (vm) { _cVideo = vm[1]; const pm = vm[0].match(/poster="([^"]+)"/i); if (pm) _cPoster = pm[1]; } 25 else { const im = String(post.content).match(/<img[^>]*\ssrc="([^"]+)"/i); if (im) _cImg = im[1]; } 26 } 27 const _hasCover = _realCover || !!_cVideo || !!_cImg; 19 28 const _typeLabel = (post.type && post.type !== 'overig' && post.type !== 'post') ? post.type : ''; 20 29 const _isPinned = !!post.pinned; … … 53 62 sizes="(min-width: 768px) 120px, 100vw" 54 63 alt="" loading="lazy" decoding="async"<% if (post.cover_video_url) { %> data-ios-mp4="<%= post.cover_video_url %>"<% } %>> 55 <% } else if (post.cover_video_url) { %><video src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } %>64 <% } else if (post.cover_video_url) { %><video src="<%= post.cover_video_url %>" poster="<%= thumb(post.cover_video_url, 480) %>" autoplay loop muted playsinline></video><% } else if (_cVideo) { %><video src="<%= _cVideo %>"<% if (_cPoster) { %> poster="<%= _cPoster %>"<% } %> autoplay loop muted playsinline preload="metadata"></video><% } else if (_cImg) { %><img src="<%= _cImg %>" alt="" loading="lazy" decoding="async"><% } %> 56 65 <% if (post.nsfw) { %><span class="nsfw-veil"><%- include('nsfw-veil', { cw: post.content_warning }) %></span><% } %> 57 66 </a>
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)