Changeset 5258945 in Klonkt


Ignore:
Timestamp:
06/20/2026 02:17:12 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
795c925
Parents:
ddf549f
Message:

feat(player): persistent highlight on the active track

The currently playing track gets a persistent highlight (.pat-playing, accent
border + tint) for as long as it is the current one; markPlaying() runs on
every loadTrack and is re-applied after htmx navigation. The short spring
pulse (pat-flash) remains. busters: audio-player.js?v=19, style.css?v=18.

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

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/assets/css/style.css

    rddf549f r5258945  
    28242824.post-album-track-compact.pat-flash {
    28252825    animation: patFlash 1.6s ease-out;
     2826    border-radius: 8px;
     2827}
     2828/* Blijvende highlight op de track die NU actief is in de speler. */
     2829.post-audio-track.pat-playing,
     2830.post-album-track-compact.pat-playing {
     2831    background: color-mix(in srgb, var(--accent, #c2410c) 12%, var(--paper-2, transparent));
     2832    box-shadow: inset 3px 0 0 0 var(--accent, #c2410c);
    28262833    border-radius: 8px;
    28272834}
  • src/assets/js/audio-player.js

    rddf549f r5258945  
    276276  // Used by the site pre-seed so opening a page doesn't auto-download audio;
    277277  // the blob is fetched lazily on the first play().
     278  // Markeer de huidige track persistent (blijvende highlight zolang 'ie actief is).
     279  function markPlaying(trackId) {
     280    document.querySelectorAll('.pat-playing').forEach((e) => e.classList.remove('pat-playing'));
     281    if (!trackId) return;
     282    const el = document.getElementById('track-' + trackId);
     283    if (el) el.classList.add('pat-playing');
     284  }
     285  // Na een htmx-navigatie is de post-DOM vervangen → highlight opnieuw zetten.
     286  document.body.addEventListener('htmx:afterSettle', () => {
     287    const t = queue[currentIndex];
     288    if (t) markPlaying(t.id);
     289  });
     290
    278291  function loadTrack(index, autoplay, metaOnly) {
    279292    if (!queue[index]) {
     
    300313    document.body.classList.add('has-audio-player');
    301314    renderQueue();
     315    markPlaying(t.id);
    302316
    303317    if (metaOnly) return;
  • src/views/shell.ejs

    rddf549f r5258945  
    163163
    164164<!-- v9 stylesheet (full palette system) -->
    165 <link rel="stylesheet" href="/assets/css/style.css?v=17">
     165<link rel="stylesheet" href="/assets/css/style.css?v=18">
    166166
    167167<!-- Audio player styles: loaded on every page so the mini-player works
     
    300300     ?v=N — cache-buster: bump bij elke audio-player.js wijziging zodat
    301301     Cloudflare (max-age=1y) niet de oude versie blijft serveren. -->
    302 <script src="/assets/js/audio-player.js?v=18"></script>
     302<script src="/assets/js/audio-player.js?v=19"></script>
    303303<!-- Eigen custom media-embeds (YouTube/SoundCloud/Spotify) via de echte
    304304     player-API's + gedeelde mutual-exclusion registry met de site-speler. -->
Note: See TracChangeset for help on using the changeset viewer.