Changeset 2a58d76 in Klonkt


Ignore:
Timestamp:
06/30/2026 11:46:46 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
b31c119
Parents:
38120c7
Message:

fix(cirkel): video covers were blank in the grid view

The cover fade-in script grabbed <video class=grid-tile-img> too and
set is-loading (opacity:0) waiting for a 'load' event a <video> never
fires (it fires loadeddata/canplay), so grid video covers stayed
invisible and the tile's accent-gradient placeholder showed through.
The list view was unaffected (its selector is img-only).

  • src/views/shell.ejs — qualify the fade selector as img.grid-tile-img so it no longer touches <video> elements (they show + autoplay directly)
  • src/views/partials/post-tile.ejs — give the grid video a poster (still frame via the thumb proxy) so the cover is never blank even if autoplay is throttled
  • src/views/partials/post-card.ejs — same poster on the list video

Co-Authored-By: Claude <noreply@…>

Location:
src/views
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/views/partials/post-card.ejs

    r38120c7 r2a58d76  
    5353           sizes="(min-width: 768px) 120px, 100vw"
    5454           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 %>" autoplay loop muted playsinline></video><% } %>
     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><% } %>
    5656      <% if (post.nsfw) { %><span class="nsfw-veil"><span class="nsfw-veil-label">🔞 <%= post.content_warning || t('post.nsfw_warning') %></span><span class="nsfw-veil-btn"><%= t('post.nsfw_show') %></span></span><% } %>
    5757    </a>
  • src/views/partials/post-tile.ejs

    r38120c7 r2a58d76  
    1919   <% 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"<% } %>>
    2020
    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 %>" autoplay loop muted playsinline></video><% } %>
     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><% } %>
    2222
    2323  <% if (_typeLabel) { %>
  • src/views/shell.ejs

    r38120c7 r2a58d76  
    759759  if (window.__coverFadeWired) return; window.__coverFadeWired = true;
    760760  function scan(root) {
    761     (root || document).querySelectorAll('.grid-tile-img, .post-list-cover img, .tl-media-img img').forEach(function (img) {
     761    (root || document).querySelectorAll('img.grid-tile-img, .post-list-cover img, .tl-media-img img').forEach(function (img) {
    762762      if (img.dataset.fade) return; img.dataset.fade = '1';
    763763      if (img.complete && img.naturalWidth > 0) return;   // already loaded → leave visible
Note: See TracChangeset for help on using the changeset viewer.