Fix formatting

pull/350/head
ElementalAlchemist 1 year ago committed by Mike Lang
parent cbf3269001
commit f5c171f5ca

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />

@ -23,7 +23,7 @@ const PLAYBACK_RATES = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
function commonPageSetup() { function commonPageSetup() {
if (!Hls.isSupported()) { if (!Hls.isSupported()) {
addError( addError(
"Your browser doesn't support MediaSource extensions. Video playback and editing won't work." "Your browser doesn't support MediaSource extensions. Video playback and editing won't work.",
); );
} }
@ -69,7 +69,7 @@ async function loadVideoPlayer(playlistURL) {
const endTime = getEndTime(); const endTime = getEndTime();
if (endTime && endTime.diff(startTime).milliseconds < 0) { if (endTime && endTime.diff(startTime).milliseconds < 0) {
addError( addError(
"End time is before the start time. This will prevent video loading and cause other problems." "End time is before the start time. This will prevent video loading and cause other problems.",
); );
} }
globalPlayer.loadSource(rangedPlaylistURL); globalPlayer.loadSource(rangedPlaylistURL);
@ -80,7 +80,7 @@ async function loadVideoPlayer(playlistURL) {
case Hls.ErrorTypes.NETWORK_ERROR: case Hls.ErrorTypes.NETWORK_ERROR:
if (data.reason === "no level found in manifest") { if (data.reason === "no level found in manifest") {
addError( addError(
"There is no video data between the specified start and end times. Change the times so that there is video content to play." "There is no video data between the specified start and end times. Change the times so that there is video content to play.",
); );
} else { } else {
console.log("A fatal network error occurred; retrying", data); console.log("A fatal network error occurred; retrying", data);
@ -94,7 +94,7 @@ async function loadVideoPlayer(playlistURL) {
default: default:
console.log("A fatal error occurred; resetting video player", data); console.log("A fatal error occurred; resetting video player", data);
addError( addError(
"Some sort of video player error occurred. Thrimbletrimmer is resetting the video player." "Some sort of video player error occurred. Thrimbletrimmer is resetting the video player.",
); );
resetVideoPlayer(); resetVideoPlayer();
} }
@ -497,7 +497,7 @@ function downloadFrame() {
const videoElement = document.getElementById("video"); const videoElement = document.getElementById("video");
const dateTime = dateTimeFromVideoPlayerTime(videoElement.currentTime); const dateTime = dateTimeFromVideoPlayerTime(videoElement.currentTime);
const url = `/frame/${globalStreamName}/source.png?timestamp=${wubloaderTimeFromDateTime( const url = `/frame/${globalStreamName}/source.png?timestamp=${wubloaderTimeFromDateTime(
dateTime dateTime,
)}`; )}`;
// Avoid : as it causes problems on Windows // Avoid : as it causes problems on Windows
const filename = `${dateTime.toFormat("yyyy-LL-dd'T'HH-mm-ss.SSS")}.png`; const filename = `${dateTime.toFormat("yyyy-LL-dd'T'HH-mm-ss.SSS")}.png`;

@ -27,7 +27,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
if (!videoInfo) { if (!videoInfo) {
addError( addError(
"Time updates are ignored before the video metadata has been retrieved from Wubloader." "Time updates are ignored before the video metadata has been retrieved from Wubloader.",
); );
return; return;
} }
@ -125,7 +125,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
} }
if (rangeErrorCount > 0) { if (rangeErrorCount > 0) {
addError( addError(
"Some ranges couldn't be updated for the new video time endpoints. Please verify the time range values." "Some ranges couldn't be updated for the new video time endpoints. Please verify the time range values.",
); );
} }
@ -209,7 +209,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
} }
if (canEditMetadata()) { if (canEditMetadata()) {
for (const addChapterMarker of document.getElementsByClassName( for (const addChapterMarker of document.getElementsByClassName(
"add-range-definition-chapter-marker" "add-range-definition-chapter-marker",
)) { )) {
addChapterMarker.addEventListener("click", addChapterMarkerHandler); addChapterMarker.addEventListener("click", addChapterMarkerHandler);
} }
@ -291,7 +291,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
if (videoInfo.thumbnail_time) { if (videoInfo.thumbnail_time) {
document.getElementById("video").addEventListener("loadedmetadata", (_event) => { document.getElementById("video").addEventListener("loadedmetadata", (_event) => {
document.getElementById("video-info-thumbnail-time").value = videoHumanTimeFromWubloaderTime( document.getElementById("video-info-thumbnail-time").value = videoHumanTimeFromWubloaderTime(
videoInfo.thumbnail_time videoInfo.thumbnail_time,
); );
}); });
} }
@ -342,7 +342,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
document.getElementById("reset-entire-video").addEventListener("click", (_event) => { document.getElementById("reset-entire-video").addEventListener("click", (_event) => {
const forceResetConfirmationContainer = document.getElementById( const forceResetConfirmationContainer = document.getElementById(
"data-correction-force-reset-confirm" "data-correction-force-reset-confirm",
); );
forceResetConfirmationContainer.classList.remove("hidden"); forceResetConfirmationContainer.classList.remove("hidden");
}); });
@ -351,7 +351,7 @@ window.addEventListener("DOMContentLoaded", async (event) => {
}); });
document.getElementById("data-correction-force-reset-no").addEventListener("click", (_event) => { document.getElementById("data-correction-force-reset-no").addEventListener("click", (_event) => {
const forceResetConfirmationContainer = document.getElementById( const forceResetConfirmationContainer = document.getElementById(
"data-correction-force-reset-confirm" "data-correction-force-reset-confirm",
); );
forceResetConfirmationContainer.classList.add("hidden"); forceResetConfirmationContainer.classList.add("hidden");
}); });
@ -371,7 +371,7 @@ async function loadVideoInfo() {
const dataResponse = await fetch("/thrimshim/" + videoID); const dataResponse = await fetch("/thrimshim/" + videoID);
if (!dataResponse.ok) { if (!dataResponse.ok) {
addError( addError(
"Failed to load video data. This probably means that the URL is out of date (video ID changed) or that everything is broken (or that the Wubloader host is down)." "Failed to load video data. This probably means that the URL is out of date (video ID changed) or that everything is broken (or that the Wubloader host is down).",
); );
return; return;
} }
@ -500,7 +500,7 @@ async function initializeVideoInfo() {
} }
const uploadLocationSelection = document.getElementById( const uploadLocationSelection = document.getElementById(
"advanced-submission-option-upload-location" "advanced-submission-option-upload-location",
); );
for (locationName of videoInfo.upload_locations) { for (locationName of videoInfo.upload_locations) {
const option = document.createElement("option"); const option = document.createElement("option");
@ -518,7 +518,7 @@ async function initializeVideoInfo() {
if (videoInfo.uploader_whitelist) { if (videoInfo.uploader_whitelist) {
modifiedAdvancedOptions = true; modifiedAdvancedOptions = true;
const uploaderAllowlistBox = document.getElementById( const uploaderAllowlistBox = document.getElementById(
"advanced-submission-option-uploader-allow" "advanced-submission-option-uploader-allow",
); );
uploaderAllowlistBox.value = videoInfo.uploader_whitelist.join(","); uploaderAllowlistBox.value = videoInfo.uploader_whitelist.join(",");
} }
@ -613,14 +613,14 @@ async function initializeVideoInfo() {
if (startWubloaderTime) { if (startWubloaderTime) {
const startField = const startField =
rangeDefinitionsContainer.children[rangeIndex].getElementsByClassName( rangeDefinitionsContainer.children[rangeIndex].getElementsByClassName(
"range-definition-start" "range-definition-start",
)[0]; )[0];
startField.value = videoHumanTimeFromVideoPlayerTime(startPlayerTime); startField.value = videoHumanTimeFromVideoPlayerTime(startPlayerTime);
} }
if (endWubloaderTime) { if (endWubloaderTime) {
const endField = const endField =
rangeDefinitionsContainer.children[rangeIndex].getElementsByClassName( rangeDefinitionsContainer.children[rangeIndex].getElementsByClassName(
"range-definition-end" "range-definition-end",
)[0]; )[0];
endField.value = videoHumanTimeFromVideoPlayerTime(endPlayerTime); endField.value = videoHumanTimeFromVideoPlayerTime(endPlayerTime);
} }
@ -637,13 +637,13 @@ async function initializeVideoInfo() {
) { ) {
const chapterMarker = chapterMarkerDefinitionDOM(); const chapterMarker = chapterMarkerDefinitionDOM();
const chapterStartField = chapterMarker.getElementsByClassName( const chapterStartField = chapterMarker.getElementsByClassName(
"range-definition-chapter-marker-start" "range-definition-chapter-marker-start",
)[0]; )[0];
chapterStartField.value = videoHumanTimeFromVideoPlayerTime( chapterStartField.value = videoHumanTimeFromVideoPlayerTime(
chapterData[currentChapterIndex].start - rangeStartOffset + startPlayerTime chapterData[currentChapterIndex].start - rangeStartOffset + startPlayerTime,
); );
const chapterDescField = chapterMarker.getElementsByClassName( const chapterDescField = chapterMarker.getElementsByClassName(
"range-definition-chapter-marker-description" "range-definition-chapter-marker-description",
)[0]; )[0];
chapterDescField.value = chapterData[currentChapterIndex].description; chapterDescField.value = chapterData[currentChapterIndex].description;
chapterContainer.appendChild(chapterMarker); chapterContainer.appendChild(chapterMarker);
@ -733,7 +733,7 @@ function updateThumbnailInputState(event) {
} }
for (const optionElement of document.getElementsByClassName( for (const optionElement of document.getElementsByClassName(
"video-info-thumbnail-mode-options" "video-info-thumbnail-mode-options",
)) { )) {
optionElement.classList.add("hidden"); optionElement.classList.add("hidden");
} }
@ -805,7 +805,7 @@ async function sendVideoData(newState, overrideChanges) {
let videoDescription = document.getElementById("video-info-description").value; let videoDescription = document.getElementById("video-info-description").value;
if (videoDescription.indexOf(CHAPTER_MARKER_DELIMITER_PARTIAL) !== -1) { if (videoDescription.indexOf(CHAPTER_MARKER_DELIMITER_PARTIAL) !== -1) {
addError( addError(
"Couldn't submit edits: Description contains manually entered chapter marker delimiter" "Couldn't submit edits: Description contains manually entered chapter marker delimiter",
); );
return; return;
} }
@ -858,13 +858,13 @@ async function sendVideoData(newState, overrideChanges) {
if (chaptersEnabled && rangeStartSubmit && rangeEndSubmit) { if (chaptersEnabled && rangeStartSubmit && rangeEndSubmit) {
const rangeChapters = []; const rangeChapters = [];
for (const chapterContainer of rangeContainer.getElementsByClassName( for (const chapterContainer of rangeContainer.getElementsByClassName(
"range-definition-chapter-markers" "range-definition-chapter-markers",
)[0].children) { )[0].children) {
const startField = chapterContainer.getElementsByClassName( const startField = chapterContainer.getElementsByClassName(
"range-definition-chapter-marker-start" "range-definition-chapter-marker-start",
)[0]; )[0];
const descField = chapterContainer.getElementsByClassName( const descField = chapterContainer.getElementsByClassName(
"range-definition-chapter-marker-description" "range-definition-chapter-marker-description",
)[0]; )[0];
const startFieldTime = videoPlayerTimeFromVideoHumanTime(startField.value); const startFieldTime = videoPlayerTimeFromVideoHumanTime(startField.value);
@ -950,7 +950,7 @@ async function sendVideoData(newState, overrideChanges) {
let thumbnailImage = null; let thumbnailImage = null;
if (thumbnailMode === "BARE" || thumbnailMode === "TEMPLATE") { if (thumbnailMode === "BARE" || thumbnailMode === "TEMPLATE") {
thumbnailTime = wubloaderTimeFromVideoHumanTime( thumbnailTime = wubloaderTimeFromVideoHumanTime(
document.getElementById("video-info-thumbnail-time").value document.getElementById("video-info-thumbnail-time").value,
); );
if (thumbnailTime === null) { if (thumbnailTime === null) {
submissionResponseElem.innerText = "The thumbnail time is invalid"; submissionResponseElem.innerText = "The thumbnail time is invalid";
@ -1004,10 +1004,10 @@ async function sendVideoData(newState, overrideChanges) {
const allowHoles = document.getElementById("advanced-submission-option-allow-holes").checked; const allowHoles = document.getElementById("advanced-submission-option-allow-holes").checked;
const isPublic = !document.getElementById("advanced-submission-option-unlisted").checked; const isPublic = !document.getElementById("advanced-submission-option-unlisted").checked;
const uploadLocation = document.getElementById( const uploadLocation = document.getElementById(
"advanced-submission-option-upload-location" "advanced-submission-option-upload-location",
).value; ).value;
const uploaderAllowlistValue = document.getElementById( const uploaderAllowlistValue = document.getElementById(
"advanced-submission-option-uploader-allow" "advanced-submission-option-uploader-allow",
).value; ).value;
const uploaderAllowlist = uploaderAllowlistValue ? uploaderAllowlistValue.split(",") : null; const uploaderAllowlist = uploaderAllowlistValue ? uploaderAllowlistValue.split(",") : null;
@ -1202,7 +1202,7 @@ function updateDownloadLink() {
timeRanges, timeRanges,
downloadType, downloadType,
allowHoles, allowHoles,
videoInfo.video_quality videoInfo.video_quality,
); );
document.getElementById("download-link").href = downloadURL; document.getElementById("download-link").href = downloadURL;
} }
@ -1293,7 +1293,7 @@ async function resetVideoRow() {
if (response.ok) { if (response.ok) {
responseElem.innerText = "Row has been reset."; responseElem.innerText = "Row has been reset.";
const forceResetConfirmationContainer = document.getElementById( const forceResetConfirmationContainer = document.getElementById(
"data-correction-force-reset-confirm" "data-correction-force-reset-confirm",
); );
forceResetConfirmationContainer.classList.add("hidden"); forceResetConfirmationContainer.classList.add("hidden");
setTimeout(() => { setTimeout(() => {
@ -1450,7 +1450,7 @@ function getRangeSetClickHandler(startOrEnd) {
} }
const setButton = event.currentTarget; const setButton = event.currentTarget;
const setField = setButton.parentElement.getElementsByClassName( const setField = setButton.parentElement.getElementsByClassName(
`range-definition-${startOrEnd}` `range-definition-${startOrEnd}`,
)[0]; )[0];
const videoElement = document.getElementById("video"); const videoElement = document.getElementById("video");
@ -1535,7 +1535,7 @@ function chapterMarkerDefinitionDOM() {
setStartTime.addEventListener("click", (event) => { setStartTime.addEventListener("click", (event) => {
const chapterContainer = event.currentTarget.parentElement; const chapterContainer = event.currentTarget.parentElement;
const startTimeField = chapterContainer.getElementsByClassName( const startTimeField = chapterContainer.getElementsByClassName(
"range-definition-chapter-marker-start" "range-definition-chapter-marker-start",
)[0]; )[0];
const videoElement = document.getElementById("video"); const videoElement = document.getElementById("video");
startTimeField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime); startTimeField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime);
@ -1552,7 +1552,7 @@ function chapterMarkerDefinitionDOM() {
playFromStartTime.addEventListener("click", (event) => { playFromStartTime.addEventListener("click", (event) => {
const chapterContainer = event.currentTarget.parentElement; const chapterContainer = event.currentTarget.parentElement;
const startTimeField = chapterContainer.getElementsByClassName( const startTimeField = chapterContainer.getElementsByClassName(
"range-definition-chapter-marker-start" "range-definition-chapter-marker-start",
)[0]; )[0];
const newVideoTime = videoPlayerTimeFromVideoHumanTime(startTimeField.value); const newVideoTime = videoPlayerTimeFromVideoHumanTime(startTimeField.value);
if (newVideoTime !== null) { if (newVideoTime !== null) {
@ -1638,7 +1638,7 @@ function setCurrentRangeStartToVideoTime() {
} }
const rangeStartField = document.querySelector( const rangeStartField = document.querySelector(
`#range-definitions > div:nth-child(${currentRange}) .range-definition-start` `#range-definitions > div:nth-child(${currentRange}) .range-definition-start`,
); );
const videoElement = document.getElementById("video"); const videoElement = document.getElementById("video");
rangeStartField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime); rangeStartField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime);
@ -1651,7 +1651,7 @@ function setCurrentRangeEndToVideoTime() {
} }
const rangeEndField = document.querySelector( const rangeEndField = document.querySelector(
`#range-definitions > div:nth-child(${currentRange}) .range-definition-end` `#range-definitions > div:nth-child(${currentRange}) .range-definition-end`,
); );
const videoElement = document.getElementById("video"); const videoElement = document.getElementById("video");
rangeEndField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime); rangeEndField.value = videoHumanTimeFromVideoPlayerTime(videoElement.currentTime);
@ -1666,7 +1666,7 @@ function enableChapterMarkers(enable) {
function changeEnableChaptersHandler() { function changeEnableChaptersHandler() {
const chaptersEnabled = document.getElementById("enable-chapter-markers").checked; const chaptersEnabled = document.getElementById("enable-chapter-markers").checked;
for (const chapterMarkerContainer of document.getElementsByClassName( for (const chapterMarkerContainer of document.getElementsByClassName(
"range-definition-chapter-markers" "range-definition-chapter-markers",
)) { )) {
if (chaptersEnabled) { if (chaptersEnabled) {
chapterMarkerContainer.classList.remove("hidden"); chapterMarkerContainer.classList.remove("hidden");
@ -1675,7 +1675,7 @@ function changeEnableChaptersHandler() {
} }
} }
for (const addChapterMarkerElem of document.getElementsByClassName( for (const addChapterMarkerElem of document.getElementsByClassName(
"add-range-definition-chapter-marker" "add-range-definition-chapter-marker",
)) { )) {
if (chaptersEnabled) { if (chaptersEnabled) {
addChapterMarkerElem.classList.remove("hidden"); addChapterMarkerElem.classList.remove("hidden");

@ -70,7 +70,7 @@ async function loadDefaults() {
const defaultDataResponse = await fetch("/thrimshim/defaults"); const defaultDataResponse = await fetch("/thrimshim/defaults");
if (!defaultDataResponse.ok) { if (!defaultDataResponse.ok) {
addError( addError(
"Failed to load Thrimbletrimmer data. This probably means that everything is broken (or, possibly, just that the Wubloader host is down). Please sound the alarm." "Failed to load Thrimbletrimmer data. This probably means that everything is broken (or, possibly, just that the Wubloader host is down). Please sound the alarm.",
); );
return; return;
} }
@ -169,7 +169,7 @@ function updateStoredTimeSettings() {
function convertEnteredTimes() { function convertEnteredTimes() {
let timeConvertFrom = undefined; let timeConvertFrom = undefined;
const timeConvertFromSelection = document.querySelectorAll( const timeConvertFromSelection = document.querySelectorAll(
"#time-converter input[name=time-converter-from]" "#time-converter input[name=time-converter-from]",
); );
for (const convertFromItem of timeConvertFromSelection) { for (const convertFromItem of timeConvertFromSelection) {
if (convertFromItem.checked) { if (convertFromItem.checked) {
@ -184,7 +184,7 @@ function convertEnteredTimes() {
let timeConvertTo = undefined; let timeConvertTo = undefined;
const timeConvertToSelection = document.querySelectorAll( const timeConvertToSelection = document.querySelectorAll(
"#time-converter input[name=time-converter-to]" "#time-converter input[name=time-converter-to]",
); );
for (const convertToItem of timeConvertToSelection) { for (const convertToItem of timeConvertToSelection) {
if (convertToItem.checked) { if (convertToItem.checked) {
@ -208,7 +208,7 @@ function convertEnteredTimes() {
let time = dateTimeFromTimeString(enteredTime, timeConvertFrom); let time = dateTimeFromTimeString(enteredTime, timeConvertFrom);
if (!time) { if (!time) {
addError( addError(
`Failed to parse the time '${enteredTime}' as a value of the selected "convert from" time format.` `Failed to parse the time '${enteredTime}' as a value of the selected "convert from" time format.`,
); );
continue; continue;
} }

Loading…
Cancel
Save