Changeset 600fbf3 in Klonkt


Ignore:
Timestamp:
06/28/2026 05:29:51 PM (2 months ago)
Author:
Robin Genis <roboburr@…>
Branches:
main
Children:
3038fc9
Parents:
a64d705
Message:

feat(images): accent-gradient placeholder also for timeline feed media

The News-feed media images now show the same accent-gradient placeholder while loading
(with reserved space via :has(), so no blank gap), and fade in once loaded.

  • views/pages/news.ejs — .tl-media-img gradient placeholder + img fade + :has min-height
  • views/shell.ejs — add .tl-media-img img to the cover fade-in scan
Location:
src/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/views/pages/news.ejs

    ra64d705 r600fbf3  
    185185  /* Always show the FULL image at its natural ratio — never cropped, no letterbox. */
    186186  .tl-media { display: flex; flex-direction: column; gap: .4rem; margin: .75rem 0 0; }
    187   .tl-media-img { display: block; border-radius: 12px; overflow: hidden; background: #fff; }
    188   .tl-media-img img { width: 100%; height: auto; display: block; }
     187  .tl-media-img { display: block; border-radius: 12px; overflow: hidden;
     188    background-image: linear-gradient(135deg,
     189      color-mix(in srgb, var(--accent, #888) 22%, var(--paper-2, var(--paper))) 0%,
     190      color-mix(in srgb, var(--accent, #888) 6%, var(--paper-2, var(--paper))) 100%); }
     191  .tl-media-img img { width: 100%; height: auto; display: block; background: #fff; transition: opacity .4s ease; }
     192  .tl-media-img img.is-loading { opacity: 0; }
     193  /* Reserve placeholder space while the (natural-aspect) feed image loads. */
     194  .tl-media-img:has(img.is-loading) { min-height: 220px; }
    189195
    190196  .tl-media-video, .tl-media-audio { width: 100%; margin: .75rem 0 0; border-radius: 12px; display: block; }
  • src/views/shell.ejs

    ra64d705 r600fbf3  
    743743  if (window.__coverFadeWired) return; window.__coverFadeWired = true;
    744744  function scan(root) {
    745     (root || document).querySelectorAll('.grid-tile-img, .post-list-cover img').forEach(function (img) {
     745    (root || document).querySelectorAll('.grid-tile-img, .post-list-cover img, .tl-media-img img').forEach(function (img) {
    746746      if (img.dataset.fade) return; img.dataset.fade = '1';
    747747      if (img.complete && img.naturalWidth > 0) return;   // already loaded → leave visible
Note: See TracChangeset for help on using the changeset viewer.