1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add chapter titles to trickplay popup (#5832)

This commit is contained in:
enter-a-random-username 2024-08-01 18:57:35 +02:00 committed by GitHub
parent 9bceeff812
commit 1f1e9d5dad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1384,11 +1384,13 @@ export default function (view) {
let chapterThumbContainer = bubble.querySelector('.chapterThumbContainer');
let chapterThumb;
let chapterThumbText;
let chapterThumbName;
// Create bubble elements if they don't already exist
if (chapterThumbContainer) {
chapterThumb = chapterThumbContainer.querySelector('.chapterThumbWrapper');
chapterThumbText = chapterThumbContainer.querySelector('.chapterThumbText');
chapterThumbText = chapterThumbContainer.querySelector('h2.chapterThumbText');
chapterThumbName = chapterThumbContainer.querySelector('div.chapterThumbText');
} else {
doFullUpdate = true;
@ -1407,11 +1409,24 @@ export default function (view) {
chapterThumbTextContainer.classList.add('chapterThumbTextContainer');
chapterThumbContainer.appendChild(chapterThumbTextContainer);
chapterThumbName = document.createElement('div');
chapterThumbName.classList.add('chapterThumbText', 'chapterThumbText-dim');
chapterThumbTextContainer.appendChild(chapterThumbName);
chapterThumbText = document.createElement('h2');
chapterThumbText.classList.add('chapterThumbText');
chapterThumbTextContainer.appendChild(chapterThumbText);
}
let chapter;
for (const currentChapter of item.Chapters || []) {
if (positionTicks < currentChapter.StartPositionTicks) {
break;
}
chapter = currentChapter;
}
// Update trickplay values
const currentTimeMs = positionTicks / 10_000;
const currentTile = Math.floor(currentTimeMs / trickplayInfo.Interval);
@ -1435,6 +1450,7 @@ export default function (view) {
chapterThumb.style.backgroundPositionY = offsetY + 'px';
chapterThumbText.textContent = datetime.getDisplayRunningTime(positionTicks);
chapterThumbName.textContent = chapter?.Name || '';
// Set bubble innerHTML if container isn't part of DOM
if (doFullUpdate) {