Changeset 230e446 in Klonkt for src/assets/js/audio-player.js
- Timestamp:
- 06/20/2026 01:38:16 AM (3 months ago)
- Branches:
- main
- Children:
- fa08981
- Parents:
- d188736
- File:
-
- 1 edited
-
src/assets/js/audio-player.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/audio-player.js
rd188736 r230e446 566 566 // via htmx zodat de audio blijft spelen. Geen post bekend → val terug op de sheet. 567 567 // - MOBIEL: altijd de uitgebreide speler-sheet openen (huidig gedrag). 568 function goToPost(url) { 568 function scrollToTrack(trackId) { 569 if (!trackId) { window.scrollTo(0, 0); return; } 570 const el = document.getElementById('track-' + trackId); 571 if (!el) { window.scrollTo(0, 0); return; } 572 el.scrollIntoView({ block: 'center', behavior: 'smooth' }); 573 el.classList.add('pat-flash'); 574 setTimeout(() => el.classList.remove('pat-flash'), 1600); 575 } 576 function goToPost(url, trackId) { 577 const hash = trackId ? ('#track-' + trackId) : ''; 569 578 if (window.htmx && url.charAt(0) === '/') { 570 579 try { 571 window.htmx.ajax('GET', url, { target: '#pcms-main', swap: 'innerHTML' }); 572 history.pushState({}, '', url); 573 window.scrollTo(0, 0); 580 const p = window.htmx.ajax('GET', url, { target: '#pcms-main', swap: 'innerHTML' }); 581 history.pushState({}, '', url + hash); 582 // Na de swap naar de track scrollen (klein uitstel zodat de globale 583 // afterSwap-top-scroll eerst is geweest); val terug op top als niet gevonden. 584 const go = () => setTimeout(() => scrollToTrack(trackId), 60); 585 if (p && typeof p.then === 'function') p.then(go); else setTimeout(go, 150); 574 586 return; 575 587 } catch (e) { /* val terug op volledige navigatie */ } 576 588 } 577 location.href = url ;589 location.href = url + hash; 578 590 } 579 591 expandTrigger.addEventListener('click', () => { 580 592 const t = queue[currentIndex]; 581 593 const isDesktop = window.matchMedia && window.matchMedia('(min-width: 768px)').matches; 582 if (isDesktop && t && t.postUrl) { goToPost(t.postUrl ); return; }594 if (isDesktop && t && t.postUrl) { goToPost(t.postUrl, t.id); return; } 583 595 openSheet(); 584 596 });
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)