@ -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" ) ;