Changeset 230e446 in Klonkt for src/services/AudioEmbedService.js


Ignore:
Timestamp:
06/20/2026 01:38:16 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
fa08981
Parents:
d188736
Message:

feat(player): mini-player jumps to post AND scrolls to the track (desktop)

Track embed gets id="track-<id>" (anchor) + id in the track JSON. goToPost
now carries the track id: after the htmx swap to the post it scrolls to the
track embed (block:center, smooth) with a brief highlight, instead of
scrolling to the top. Busters: audio-player.js?v=17, style.css?v=16.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/AudioEmbedService.js

    rd188736 r230e446  
    248248      if (!t || !t.url) return match;
    249249      const trackJson = JSON.stringify({
     250        id,
    250251        url: t.url,
    251252        title: t.title || 'Untitled',
     
    258259      const dataAttr = trackJson
    259260        .replace(/&/g, '&amp;').replace(/'/g, '&#39;').replace(/</g, '&lt;');
    260       return `<div class="post-audio-track" data-pcms-track-url="${urlH}" data-pcms-track='${dataAttr}'>
     261      // id="track-<id>" = anker zodat de mini-speler hierheen kan scrollen.
     262      return `<div class="post-audio-track" id="track-${id}" data-pcms-track-id="${id}" data-pcms-track-url="${urlH}" data-pcms-track='${dataAttr}'>
    261263  <button type="button" class="pat-play" aria-label="Play ${titleH}">
    262264    <svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M8 4l12 8-12 8z"/></svg>
Note: See TracChangeset for help on using the changeset viewer.