Changeset 2a10445 in Klonkt for src/views/partials/post-tile.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-tile.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/partials/post-tile.ejs
r15f1cb5 r2a10445 7 7 const _isBoost = !!post.isBoost; 8 8 const _hasCover = !!post.cover_image_url || !!post.cover_video_url; 9 // A C2S post carries its media IN the content (a cover next to it showed the 10 // video twice on the post page). The tile derives its picture from the 11 // content instead, like the Cirkel card: first <video> (with its poster) or 12 // first <img>. 13 let _cVideo = null, _cPoster = null, _cImg = null; 14 if (!_hasCover && post.content) { 15 const vm = String(post.content).match(/<video[^>]*\ssrc="([^"]+)"[^>]*>/i); 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]; } 18 } 19 const _showCover = _hasCover || !!_cVideo || !!_cImg; 9 20 const _typeLabel = (post.type && post.type !== 'post') ? post.type : ''; 10 21 const _src = post.source_name || ''; // bron-site (cirkel-feed: van welke site komt deze post) … … 14 25 const _ext = !!_external; 15 26 %> 16 <a class="grid-tile<%= _ hasCover ? '' : ' grid-tile-gradient' %><%= (_isPinned || _isBoost) ? ' is-pinned' : '' %><%= post.nsfw ? ' nsfw-media' : '' %>"27 <a class="grid-tile<%= _showCover ? '' : ' grid-tile-gradient' %><%= (_isPinned || _isBoost) ? ' is-pinned' : '' %><%= post.nsfw ? ' nsfw-media' : '' %>" 17 28 href="<%= _href %>" 18 29 style="--tile-hue: <%= _tileHue %>;" 19 30 <% 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"<% } %>> 20 31 21 <% 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><% } %>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"><% } %> 22 33 23 34 <% if (_typeLabel) { %>
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)