BlueGit

timfa filemanager

Improve IM track selection highlighting and name-based restore

timfa Tim Falken · pushed by timfa

Authored 2026-05-16 · 6 months ago

Hash
a2656d304336242097a3691dc06e0f767978f62c
Parent
b7042cf2
2 files changed +20 −2
.github/technical-reference.md +1 −1
@@ -168,7 +168,7 @@
168 168 - setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
169 169 - buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
170 170 - buildAuthHeaders() - Builds the authenticated fetch headers used by preview-side API calls that need the bearer token plus fingerprint header.
171 - bindImageSubtitleOverlay(player, videojs, prefs, session, item) - Adds the fullscreen-safe image-subtitle button, menu, and bottom overlay used to fetch and display subtitle frames for image-based tracks; disables the track after the first failed frame request to avoid repeated polling.
171 - bindImageSubtitleOverlay(player, videojs, prefs, session, item) - Adds the fullscreen-safe image-subtitle button, menu, and bottom overlay used to fetch and display subtitle frames for image-based tracks; highlights the currently selected IM menu option; persists per-user image subtitle stream index + track name; restores by saved track name first (then stream index); disables the track after the first failed frame request to avoid repeated polling.
172 172 - renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), wires the image-subtitle overlay controller, forces caption overrides on each open (text background opacity transparent + text edge style uniform), reports watch progress, warns when subtitle streams exist but none are web-compatible, and releases the backend stream session on close/unload.
173 173 - modelPreviewType(name) - Classifies direct client-side 3D preview support for `.stl` and `.obj`.
174 174 - loadThreePreviewModules() - Lazy-loads Three.js plus OrbitControls/STLLoader/OBJLoader via import map aliases.
@@ -168,7 +168,7 @@
168- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
168- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
169- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
169- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
170- buildAuthHeaders() - Builds the authenticated fetch headers used by preview-side API calls that need the bearer token plus fingerprint header.
170- buildAuthHeaders() - Builds the authenticated fetch headers used by preview-side API calls that need the bearer token plus fingerprint header.
171- bindImageSubtitleOverlay(player, videojs, prefs, session, item) - Adds the fullscreen-safe image-subtitle button, menu, and bottom overlay used to fetch and display subtitle frames for image-based tracks; disables the track after the first failed frame request to avoid repeated polling.
171- bindImageSubtitleOverlay(player, videojs, prefs, session, item) - Adds the fullscreen-safe image-subtitle button, menu, and bottom overlay used to fetch and display subtitle frames for image-based tracks; highlights the currently selected IM menu option; persists per-user image subtitle stream index + track name; restores by saved track name first (then stream index); disables the track after the first failed frame request to avoid repeated polling.
172- renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), wires the image-subtitle overlay controller, forces caption overrides on each open (text background opacity transparent + text edge style uniform), reports watch progress, warns when subtitle streams exist but none are web-compatible, and releases the backend stream session on close/unload.
172- renderStreamedVideoPreview(item, targetEl) - Creates the Video.js player with HLS source/track config, enforces non-live playback UI for file streams, uses container-fill sizing to keep previews within bounds, restores per-user video prefs (volume + subtitle/audio track names when present), wires the image-subtitle overlay controller, forces caption overrides on each open (text background opacity transparent + text edge style uniform), reports watch progress, warns when subtitle streams exist but none are web-compatible, and releases the backend stream session on close/unload.
173- modelPreviewType(name) - Classifies direct client-side 3D preview support for `.stl` and `.obj`.
173- modelPreviewType(name) - Classifies direct client-side 3D preview support for `.stl` and `.obj`.
174- loadThreePreviewModules() - Lazy-loads Three.js plus OrbitControls/STLLoader/OBJLoader via import map aliases.
174- loadThreePreviewModules() - Lazy-loads Three.js plus OrbitControls/STLLoader/OBJLoader via import map aliases.
public/app.js +19 −1
@@ -494,6 +494,9 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
494 494 const isSelected = value === (selectedStreamIndex === null ? 'off' : String(selectedStreamIndex));
495 495 itemEl.classList.toggle('is-selected', isSelected);
496 496 itemEl.setAttribute('aria-checked', isSelected ? 'true' : 'false');
497 itemEl.style.background = isSelected ? 'rgba(90, 196, 255, 0.28)' : 'transparent';
498 itemEl.style.fontWeight = isSelected ? '600' : '400';
499 itemEl.style.boxShadow = isSelected ? 'inset 0 0 0 1px rgba(90, 196, 255, 0.55)' : 'none';
497 500 }
498 501 };
499 502
@@ -521,7 +524,11 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
521 524
522 525 const saveSelection = () =>
523 526 {
524 saveUserVideoPrefs({ imageSubtitleTrackStreamIndex: selectedStreamIndex });
527 const selectedTrack = selectedStreamIndex === null ? null : trackByStreamIndex.get(selectedStreamIndex) || null;
528 saveUserVideoPrefs({
529 imageSubtitleTrackStreamIndex: selectedStreamIndex,
530 imageSubtitleTrackName: selectedTrack ? selectedTrack.label : null,
531 });
525 532 };
526 533
527 534 const disableTrack = () =>
@@ -751,6 +758,17 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
751 758
752 759 const applySavedTracks = () =>
753 760 {
761 const savedName = normaliseTrackName(prefs.imageSubtitleTrackName);
762 if (savedName)
763 {
764 const savedByName = imageTracks.find((track) => normaliseTrackName(track.label) === savedName) || null;
765 if (savedByName)
766 {
767 setSelectedStreamIndex(savedByName.streamIndex, { persist: false });
768 return;
769 }
770 }
771
754 772 const savedIndex = Number(prefs.imageSubtitleTrackStreamIndex);
755 773 if (Number.isInteger(savedIndex) && trackByStreamIndex.has(savedIndex))
756 774 {
@@ -494,6 +494,9 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
494 const isSelected = value === (selectedStreamIndex === null ? 'off' : String(selectedStreamIndex));
494 const isSelected = value === (selectedStreamIndex === null ? 'off' : String(selectedStreamIndex));
495 itemEl.classList.toggle('is-selected', isSelected);
495 itemEl.classList.toggle('is-selected', isSelected);
496 itemEl.setAttribute('aria-checked', isSelected ? 'true' : 'false');
496 itemEl.setAttribute('aria-checked', isSelected ? 'true' : 'false');
497 itemEl.style.background = isSelected ? 'rgba(90, 196, 255, 0.28)' : 'transparent';
498 itemEl.style.fontWeight = isSelected ? '600' : '400';
499 itemEl.style.boxShadow = isSelected ? 'inset 0 0 0 1px rgba(90, 196, 255, 0.55)' : 'none';
497 }
500 }
498 };
501 };
499
502
@@ -521,7 +524,11 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
521
524
522 const saveSelection = () =>
525 const saveSelection = () =>
523 {
526 {
524 saveUserVideoPrefs({ imageSubtitleTrackStreamIndex: selectedStreamIndex });
527 const selectedTrack = selectedStreamIndex === null ? null : trackByStreamIndex.get(selectedStreamIndex) || null;
528 saveUserVideoPrefs({
529 imageSubtitleTrackStreamIndex: selectedStreamIndex,
530 imageSubtitleTrackName: selectedTrack ? selectedTrack.label : null,
531 });
525 };
532 };
526
533
527 const disableTrack = () =>
534 const disableTrack = () =>
@@ -751,6 +758,17 @@ function bindImageSubtitleOverlay (player, videojs, prefs, session, item)
751
758
752 const applySavedTracks = () =>
759 const applySavedTracks = () =>
753 {
760 {
761 const savedName = normaliseTrackName(prefs.imageSubtitleTrackName);
762 if (savedName)
763 {
764 const savedByName = imageTracks.find((track) => normaliseTrackName(track.label) === savedName) || null;
765 if (savedByName)
766 {
767 setSelectedStreamIndex(savedByName.streamIndex, { persist: false });
768 return;
769 }
770 }
771
754 const savedIndex = Number(prefs.imageSubtitleTrackStreamIndex);
772 const savedIndex = Number(prefs.imageSubtitleTrackStreamIndex);
755 if (Number.isInteger(savedIndex) && trackByStreamIndex.has(savedIndex))
773 if (Number.isInteger(savedIndex) && trackByStreamIndex.has(savedIndex))
756 {
774 {