From 6c97654da34e6677852f8feb29553b029f20a408 Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Mon, 11 Nov 2024 03:47:37 +1100 Subject: [PATCH] thrimbletrimmer: Don't listen for loadedmetadata in two places The first place never fires, the second one replaces it I think. --- thrimbletrimmer/scripts/edit.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/thrimbletrimmer/scripts/edit.js b/thrimbletrimmer/scripts/edit.js index 1bcbcce..a959a08 100644 --- a/thrimbletrimmer/scripts/edit.js +++ b/thrimbletrimmer/scripts/edit.js @@ -448,13 +448,6 @@ window.addEventListener("DOMContentLoaded", async (event) => { } document.getElementById("video-info-thumbnail-mode").value = videoInfo.thumbnail_mode; updateThumbnailInputState(); - if (videoInfo.thumbnail_time) { - document.getElementById("video").addEventListener("loadedmetadata", (_event) => { - document.getElementById("video-info-thumbnail-time").value = videoHumanTimeFromWubloaderTime( - videoInfo.thumbnail_time, - ); - }); - } // Ensure that changing values on load doesn't set keep the page dirty. globalPageState = PAGE_STATE.CLEAN; @@ -945,6 +938,12 @@ async function initializeVideoInfo() { firstChapterPlayFromStartTime.classList.add("hidden"); } + if (videoInfo.thumbnail_time) { + document.getElementById("video-info-thumbnail-time").value = videoHumanTimeFromWubloaderTime( + videoInfo.thumbnail_time, + ); + } + rangeDataUpdated(); videoElement.removeEventListener("loadedmetadata", handleInitialSetupForDuration); };