From 5d09115a8a5916ed969279b9b927af301a09883a Mon Sep 17 00:00:00 2001 From: Mike Lang Date: Thu, 10 Oct 2024 03:58:51 +1100 Subject: [PATCH] thrimbletrimmer: Load transition types from thrimshim and populate dropdown --- thrimbletrimmer/scripts/edit.js | 53 ++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/thrimbletrimmer/scripts/edit.js b/thrimbletrimmer/scripts/edit.js index 1c8edf4..76353ee 100644 --- a/thrimbletrimmer/scripts/edit.js +++ b/thrimbletrimmer/scripts/edit.js @@ -1,6 +1,7 @@ var googleUser = null; var videoInfo; var currentRange = 1; +let knownTransitions = []; let globalPageState = 0; const CHAPTER_MARKER_DELIMITER = "\n==========\n"; @@ -141,6 +142,7 @@ window.addEventListener("DOMContentLoaded", async (event) => { } }); + loadTransitions(); // Intentionally not awaiting, fire and forget await loadVideoInfo(); document.getElementById("stream-time-setting-start-pad").addEventListener("click", (_event) => { @@ -361,6 +363,49 @@ window.addEventListener("DOMContentLoaded", async (event) => { }); }); + +async function loadTransitions() { + const response = await fetch("/thrimshim/transitions"); + if (!response.ok) { + addError("Failed to fetch possible transition types. This probably means the wubloader host is down."); + return; + } + knownTransitions = await response.json(); + updateTransitionTypes(); +} + +// Update the given list of transition type