From 56642e3b81636e6de846de4d2308d4fd79ba62e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 07:03:51 +0000 Subject: [PATCH 001/217] Bump form-data from 4.0.2 to 4.0.4 Bumps [form-data](https://github.com/form-data/form-data) from 4.0.2 to 4.0.4. - [Release notes](https://github.com/form-data/form-data/releases) - [Changelog](https://github.com/form-data/form-data/blob/master/CHANGELOG.md) - [Commits](https://github.com/form-data/form-data/compare/v4.0.2...v4.0.4) --- updated-dependencies: - dependency-name: form-data dependency-version: 4.0.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7124b7c4..4799083a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3351,14 +3351,16 @@ } }, "node_modules/form-data": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", - "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", "mime-types": "^2.1.12" }, "engines": { From c334be5bbd4b4f842dca42e86514ae48be66820f Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 10:45:33 -0500 Subject: [PATCH 002/217] Remove unused vars --- scripts/control.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/control.js b/scripts/control.js index 6fcaa357..c409bdcc 100644 --- a/scripts/control.js +++ b/scripts/control.js @@ -501,8 +501,7 @@ // elapsed is expressed as sss.xxx var thisObj, duration, lastChapterIndex, displayElapsed, updateLive, textByState, timestamp, widthUsed, - leftControls, rightControls, seekbarWidth, captionsCount, buffered, newTop, statusBarHeight, - speedHeight, statusBarWidthBreakpoint, newSvgData; + leftControls, rightControls, seekbarWidth, captionsCount, buffered, newTop, statusBarWidthBreakpoint; thisObj = this; if (this.swappingSrc) { From 5d65c391bb527456a2725036873b471d79df0ba8 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 10:46:44 -0500 Subject: [PATCH 003/217] Compact exit code in refresh controls --- scripts/control.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/control.js b/scripts/control.js index c409bdcc..16b23194 100644 --- a/scripts/control.js +++ b/scripts/control.js @@ -504,13 +504,10 @@ leftControls, rightControls, seekbarWidth, captionsCount, buffered, newTop, statusBarWidthBreakpoint; thisObj = this; - if (this.swappingSrc) { - if (this.playing) { - // wait until new source has loaded before refreshing controls - // can't wait if player is NOT playing because some critical events - // won't fire until playback of new media starts - return; - } + // wait until new source has loaded before refreshing controls + // some critical events won't fire until playback of new media starts + if ( this.swappingSrc && this.playing ) { + return; } if (context === 'timeline' || context === 'init') { From 0a291f7a64db6a67b863f27ae30fc7a4b8d3af00 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 11:49:09 -0500 Subject: [PATCH 004/217] Compact some logic to avoid extra if/else nesting. --- scripts/control.js | 205 ++++++++++++++++++--------------------------- 1 file changed, 82 insertions(+), 123 deletions(-) diff --git a/scripts/control.js b/scripts/control.js index 16b23194..b2eb0ce9 100644 --- a/scripts/control.js +++ b/scripts/control.js @@ -500,28 +500,30 @@ // duration is expressed as sss.xxx // elapsed is expressed as sss.xxx - var thisObj, duration, lastChapterIndex, displayElapsed, updateLive, textByState, timestamp, widthUsed, - leftControls, rightControls, seekbarWidth, captionsCount, buffered, newTop, statusBarWidthBreakpoint; + var thisObj, duration, textByState, timestamp, captionsCount, newTop, statusBarWidthBreakpoint; thisObj = this; // wait until new source has loaded before refreshing controls - // some critical events won't fire until playback of new media starts + // some critical events won't fire until playback of new media starts if ( this.swappingSrc && this.playing ) { return; } - if (context === 'timeline' || context === 'init') { - // all timeline-related functionality requires both duration and elapsed + if ( context === 'timeline' || context === 'init' ) { + // Update timeline controls. + var lastChapterIndex, displayElapsed, updateLive, widthUsed, + leftControls, rightControls, seekbarWidth, buffered; + // all timeline-related functionality requires duration if (typeof this.duration === 'undefined') { - // wait until duration is known before proceeding with refresh - return; + // wait until duration is known before proceeding with refresh + return; } if (this.useChapterTimes) { this.chapterDuration = this.getChapterDuration(); this.chapterElapsed = this.getChapterElapsed(); } - if (this.useFixedSeekInterval === false && this.seekIntervalCalculated === false && this.duration > 0) { + if ( !this.useFixedSeekInterval && !this.seekIntervalCalculated && this.duration > 0) { // couldn't calculate seekInterval previously; try again. this.setSeekInterval(); } @@ -535,20 +537,15 @@ // chapter ends before or after video ends // need to adjust seekbar duration to match video end this.seekBar.setDuration(this.duration - this.currentChapter.start); - } - else { + } else { this.seekBar.setDuration(this.chapterDuration); } - } - else { + } else { // this is not the last chapter this.seekBar.setDuration(this.chapterDuration); } - } - else { - if (!(this.duration === undefined || isNaN(this.duration) || this.duration === -1)) { - this.seekBar.setDuration(this.duration); - } + } else if ( !(this.duration === undefined || isNaN(this.duration) || this.duration === -1) ) { + this.seekBar.setDuration(this.duration); } if (!(this.seekBar.tracking)) { // Only update the aria live region if we have an update pending @@ -559,8 +556,7 @@ this.liveUpdatePending = false; if (this.useChapterTimes) { this.seekBar.setPosition(this.chapterElapsed, updateLive); - } - else { + } else { this.seekBar.setPosition(this.elapsed, updateLive); } } @@ -568,22 +564,15 @@ // When seeking, display the seek bar time instead of the actual elapsed time. if (this.seekBar.tracking) { displayElapsed = this.seekBar.lastTrackPosition; - } - else { - if (this.useChapterTimes) { - displayElapsed = this.chapterElapsed; - } - else { - displayElapsed = this.elapsed; - } + } else { + displayElapsed = ( this.useChapterTimes ) ? this.chapterElapsed : this.elapsed; } } // update elapsed & duration if (typeof this.$durationContainer !== 'undefined') { if (this.useChapterTimes) { this.$durationContainer.text(' / ' + this.formatSecondsAsColonTime(this.chapterDuration)); - } - else { + } else { this.$durationContainer.text(' / ' + this.formatSecondsAsColonTime(this.duration)); } } @@ -606,8 +595,7 @@ }); if (this.fullscreen) { seekbarWidth = $(window).width() - widthUsed; - } - else { + } else { // seekbar is wide enough to fill the remaining space // include a 10px buffer to account for minor browser differences or custom styles. seekbarWidth = controlWrapper.width() - widthUsed - 10; @@ -622,37 +610,24 @@ // Update buffering progress. // TODO: Currently only using the first HTML5 buffered interval, // but this fails sometimes when buffering is split into two or more intervals. - if (this.player === 'html5') { - if (this.media.buffered.length > 0) { - buffered = this.media.buffered.end(0); - if (this.useChapterTimes) { - if (buffered > this.chapterDuration) { - buffered = this.chapterDuration; - } - if (this.seekBar) { - this.seekBar.setBuffered(buffered / this.chapterDuration); - } - } - else { - if (this.seekBar) { - if (!isNaN(buffered)) { - this.seekBar.setBuffered(buffered / duration); - } - } + if (this.player === 'html5' && this.media.buffered.length > 0) { + buffered = this.media.buffered.end(0); + if (this.useChapterTimes) { + if (buffered > this.chapterDuration) { + buffered = this.chapterDuration; } - } - } - else if (this.player === 'youtube') { - if (this.seekBar) { - if (this.youTubePlayerReady) { - this.seekBar.setBuffered(this.youTubePlayer.getVideoLoadedFraction()); + if (this.seekBar) { + this.seekBar.setBuffered(buffered / this.chapterDuration); } + } else if ( this.seekBar && !isNaN(buffered) ) { + this.seekBar.setBuffered(buffered / duration); } - } - else if (this.player === 'vimeo') { + } else if (this.player === 'youtube' && this.seekBar && this.youTubePlayerReady ) { + this.seekBar.setBuffered(this.youTubePlayer.getVideoLoadedFraction()); + } else if (this.player === 'vimeo') { // TODO: Add support for Vimeo buffering update } - } // end if context == 'timeline' or 'init' + } if (context === 'descriptions' || context == 'init'){ if (this.$descButton) { @@ -665,12 +640,11 @@ } } - if (context === 'captions' || context == 'init'){ + if (context === 'captions' || context == 'init') { if (this.$ccButton) { captionsCount = this.captions.length; - if (captionsCount > 1) { this.$ccButton.attr({ 'aria-haspopup': 'true', @@ -697,8 +671,7 @@ this.$fullscreenButton.attr('aria-label', this.tt.enterFullScreen); this.getIcon( this.$fullscreenButton, 'fullscreen-expand' ); this.$fullscreenButton.find('span.able-clipped').text(this.tt.enterFullScreen); - } - else { + } else { this.$fullscreenButton.attr('aria-label',this.tt.exitFullscreen); this.getIcon( this.$fullscreenButton, 'fullscreen-collapse' ); this.$fullscreenButton.find('span.able-clipped').text(this.tt.exitFullscreen); @@ -717,13 +690,11 @@ if (this.fullscreen) { this.$bigPlayButton.width($(window).width()); this.$bigPlayButton.height($(window).height()); - } - else { + } else { this.$bigPlayButton.width(this.$mediaContainer.width()); this.$bigPlayButton.height(this.$mediaContainer.height()); } - } - else { + } else { this.$bigPlayButton.hide(); this.$bigPlayButton.attr('aria-hidden', 'true'); } @@ -737,8 +708,7 @@ if (this.prefAutoScrollTranscript === 1) { this.autoScrollTranscript = true; this.$autoScrollTranscriptCheckbox.prop('checked',true); - } - else { + } else { this.autoScrollTranscript = false; this.$autoScrollTranscriptCheckbox.prop('checked',false); } @@ -794,67 +764,58 @@ } this.getIcon( this.$playpauseButton, 'play' ); this.$playpauseButton.find('span.able-clipped').text(this.tt.play); - } - else { - if (typeof this.$status !== 'undefined' && typeof this.seekBar !== 'undefined') { - // Update the text only if it's changed since it has role="alert"; - // also don't update while tracking, since this may Pause/Play the player but we don't want to send a Pause/Play update. - this.getPlayerState().then(function(currentState) { - if (thisObj.$status.text() !== textByState[currentState] && !thisObj.seekBar.tracking) { - // Debounce updates; only update after status has stayed steadily different for a while - // "A while" is defined differently depending on context - if (thisObj.swappingSrc) { - // this is where most of the chatter occurs (e.g., playing, paused, buffering, playing), - // so set a longer wait time before writing a status message - if (!thisObj.debouncingStatus) { - thisObj.statusMessageThreshold = 2000; // in ms (2 seconds) - } - } - else { - // for all other contexts (e.g., users clicks Play/Pause) - // user should receive more rapid feedback - if (!thisObj.debouncingStatus) { - thisObj.statusMessageThreshold = 250; // in ms - } - } - timestamp = (new Date()).getTime(); - if (!thisObj.statusDebounceStart) { - thisObj.statusDebounceStart = timestamp; - // Call refreshControls() again after allotted time has passed - thisObj.debouncingStatus = true; - thisObj.statusTimeout = setTimeout(function () { - thisObj.debouncingStatus = false; - thisObj.refreshControls(context); - }, thisObj.statusMessageThreshold); - } - else if ((timestamp - thisObj.statusDebounceStart) > thisObj.statusMessageThreshold) { - thisObj.$status.text(textByState[currentState]); - thisObj.statusDebounceStart = null; - clearTimeout(thisObj.statusTimeout); - thisObj.statusTimeout = null; + } else if (typeof this.$status !== 'undefined' && typeof this.seekBar !== 'undefined') { + // Update the text only if it's changed since it has role="alert"; + // also don't update while tracking, since this may Pause/Play the player but we don't want to send a Pause/Play update. + this.getPlayerState().then(function(currentState) { + if (thisObj.$status.text() !== textByState[currentState] && !thisObj.seekBar.tracking) { + // Debounce updates; only update after status has stayed steadily different for a while + // "A while" is defined differently depending on context + if (thisObj.swappingSrc) { + // this is where most of the chatter occurs (e.g., playing, paused, buffering, playing), + // so set a longer wait time before writing a status message + if (!thisObj.debouncingStatus) { + thisObj.statusMessageThreshold = 2000; // in ms (2 seconds) } + } else if (!thisObj.debouncingStatus) { + // for all other contexts (e.g., users clicks Play/Pause) + // user should receive more rapid feedback + thisObj.statusMessageThreshold = 250; // in ms } - else { + timestamp = (new Date()).getTime(); + if (!thisObj.statusDebounceStart) { + thisObj.statusDebounceStart = timestamp; + // Call refreshControls() again after allotted time has passed + thisObj.debouncingStatus = true; + thisObj.statusTimeout = setTimeout(function () { + thisObj.debouncingStatus = false; + thisObj.refreshControls(context); + }, thisObj.statusMessageThreshold); + } else if ((timestamp - thisObj.statusDebounceStart) > thisObj.statusMessageThreshold) { + thisObj.$status.text(textByState[currentState]); thisObj.statusDebounceStart = null; - thisObj.debouncingStatus = false; clearTimeout(thisObj.statusTimeout); thisObj.statusTimeout = null; } - // Don't change play/pause button display while using the seek bar (or if YouTube stopped) - if (!thisObj.seekBar.tracking && !thisObj.stoppingYouTube) { - if (currentState === 'paused' || currentState === 'stopped' || currentState === 'ended') { - thisObj.$playpauseButton.attr('aria-label',thisObj.tt.play); - thisObj.getIcon( thisObj.$playpauseButton, 'play' ); - thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.play); - } - else { - thisObj.$playpauseButton.attr('aria-label',thisObj.tt.pause); - thisObj.getIcon( thisObj.$playpauseButton, 'pause' ); - thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.pause); - } + } else { + thisObj.statusDebounceStart = null; + thisObj.debouncingStatus = false; + clearTimeout(thisObj.statusTimeout); + thisObj.statusTimeout = null; + } + // Don't change play/pause button display while using the seek bar (or if YouTube stopped) + if (!thisObj.seekBar.tracking && !thisObj.stoppingYouTube) { + if (currentState === 'paused' || currentState === 'stopped' || currentState === 'ended') { + thisObj.$playpauseButton.attr('aria-label',thisObj.tt.play); + thisObj.getIcon( thisObj.$playpauseButton, 'play' ); + thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.play); + } else { + thisObj.$playpauseButton.attr('aria-label',thisObj.tt.pause); + thisObj.getIcon( thisObj.$playpauseButton, 'pause' ); + thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.pause); } - }); - } + } + }); } } @@ -1721,7 +1682,6 @@ if (this.mediaType === 'audio') { return; } - if (typeof width !== 'undefined' && typeof height !== 'undefined') { // this is being called the first time a player is initialized // width and height were collected from the HTML, YouTube, or Vimeo media API @@ -1856,7 +1816,6 @@ 'font-size': captionSize }); } - // Reposition alert message (video player only) below the vertical center of the mediaContainer // hopefully above captions, but not too far from the controller bar if (this.mediaType === 'video') { From 20306e6a06425e36edd3fb746c4569fa985d3be2 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 11:53:22 -0500 Subject: [PATCH 005/217] Set 'init' as the default value or refreshControls context --- scripts/buildplayer.js | 2 +- scripts/control.js | 2 +- scripts/event.js | 8 ++++---- scripts/initialize.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/buildplayer.js b/scripts/buildplayer.js index ccb19bb7..79c4691e 100644 --- a/scripts/buildplayer.js +++ b/scripts/buildplayer.js @@ -1292,7 +1292,7 @@ } // Update state-based display of controls. - this.refreshControls('init'); + this.refreshControls(); }; AblePlayer.prototype.cuePlaylistItem = function(sourceIndex) { diff --git a/scripts/control.js b/scripts/control.js index b2eb0ce9..1190d111 100644 --- a/scripts/control.js +++ b/scripts/control.js @@ -479,7 +479,7 @@ this.hideControlsTimeoutStatus = 'active'; }; - AblePlayer.prototype.refreshControls = function(context, duration, elapsed) { + AblePlayer.prototype.refreshControls = function(context = 'init', duration, elapsed) { // context is one of the following: // 'init' - initial build (or subsequent change that requires full rebuild) diff --git a/scripts/event.js b/scripts/event.js index 231de428..8afbab0e 100644 --- a/scripts/event.js +++ b/scripts/event.js @@ -59,7 +59,7 @@ this.cuePlaylistItem(this.playlistIndex) } } - this.refreshControls('init'); + this.refreshControls(); }; AblePlayer.prototype.onMediaNewSourceLoad = function () { @@ -210,7 +210,7 @@ this.userClickedPlaylist = false; this.okToPlay = false; } - this.refreshControls('init'); + this.refreshControls(); if (this.$focusedElement) { this.restoreFocus(); this.$focusedElement = null; @@ -275,7 +275,7 @@ thisObj.showDescription(position); thisObj.updateChapter(thisObj.convertChapterTimeToVideoTime(position)); thisObj.updateMeta(position); - thisObj.refreshControls('init'); + thisObj.refreshControls(); }).on('stopTracking', function (e, position) { if (thisObj.useChapterTimes) { thisObj.seekTo(thisObj.convertChapterTimeToVideoTime(position)); @@ -798,7 +798,7 @@ if (mutation.type === 'attributes' && mutation.attributeName === 'style') { // the player's style attribute has changed. Check to see if it's visible if (thisObj.$ableDiv.is(':visible')) { - thisObj.refreshControls('init'); + thisObj.refreshControls(); } } }); diff --git a/scripts/initialize.js b/scripts/initialize.js index dc3b049a..ed8b0254 100644 --- a/scripts/initialize.js +++ b/scripts/initialize.js @@ -609,7 +609,7 @@ // refreshControls is called twice building/initializing the player // this is the second. Best to pause a bit before executing, to be sure all prior steps are complete setTimeout(function() { - thisObj.refreshControls('init'); + thisObj.refreshControls(); deferred.resolve(); },100); }); From 43635f0d2724ae6df98a7265d480b004e68bf7fe Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 12:06:33 -0500 Subject: [PATCH 006/217] Return if chapteresdivlocation not set from prototype --- scripts/chapters.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/chapters.js b/scripts/chapters.js index c79dd4ce..fed8107e 100644 --- a/scripts/chapters.js +++ b/scripts/chapters.js @@ -3,7 +3,9 @@ AblePlayer.prototype.populateChaptersDiv = function() { var headingLevel, headingType, headingId, $chaptersHeading; - + if ( ! this.chaptersDivLocation ) { + return; + } if ($('#' + this.chaptersDivLocation)) { this.$chaptersDiv = $('#' + this.chaptersDivLocation); From 1379721b4ac3cb63a3185643a3346abe50715ba6 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 12:06:45 -0500 Subject: [PATCH 007/217] Remove unused vars --- scripts/preference.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/scripts/preference.js b/scripts/preference.js index accc6656..e5ad456b 100644 --- a/scripts/preference.js +++ b/scripts/preference.js @@ -335,19 +335,12 @@ // Creates a preferences form and injects it. // form is one of the supported forms (groups) defined in getPreferencesGroups() - var thisObj, available, descLangs, - $prefsDiv, formTitle, introText, - $prefsIntro,$prefsIntroP2,p3Text,$prefsIntroP3,i, j, - $fieldset, fieldsetClass, fieldsetId, - $descFieldset, $descLegend, $legend, legendId, - thisPref, $thisDiv, thisClass, thisId, $thisLabel, $thisField, - $div1,id1,$radio1,$label1, - $div2,id2,$radio2,$label2, - options,$thisOption,optionValue,optionLang,optionText,sampleCapsDiv, - changedPref,changedSpan,changedText, - currentDescState, prefDescVoice, - $kbHeading,$kbList,kbLabels,keys,kbListText,$kbListItem, - dialog,saveButton,cancelButton; + var thisObj, available, + $prefsDiv, formTitle, introText, $prefsIntro,$prefsIntroP2,p3Text,$prefsIntroP3,i, j, + $fieldset, fieldsetClass, fieldsetId, $legend, legendId, thisPref, $thisDiv, thisClass, + thisId, $thisLabel, $thisField, options,$thisOption,optionValue,optionLang,optionText, + changedPref,changedSpan,changedText, currentDescState, prefDescVoice, $kbHeading,$kbList, + kbLabels,keys,kbListText,$kbListItem, dialog,saveButton,cancelButton; thisObj = this; available = this.getAvailablePreferences(); @@ -635,7 +628,6 @@ } if (thisPref === 'prefDescVoice' && !this.descVoices.length) { // No voices are available (e.g., in Safari 15.4 on Mac OS) - // Do not add a Voice select field } else { $fieldset.append($thisDiv); From 3681b5fcf92b7111120749f990db38f498e29578 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 12:06:56 -0500 Subject: [PATCH 008/217] Minor tweaks --- scripts/vts.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/vts.js b/scripts/vts.js index eeca8e79..b00f6e63 100644 --- a/scripts/vts.js +++ b/scripts/vts.js @@ -6,22 +6,16 @@ (function ($) { AblePlayer.prototype.injectVTS = function() { - // To add a transcript sorter to a web page: - // Add
to the web page + // To add a transcript sorter to a web page:
- // Define all variables var thisObj, $heading, $instructions, $p1, $p2, $ul, $li1, $li2, $li3, $fieldset, $legend, i, $radioDiv, radioId, $label, $radio, $saveButton, $savedTable; thisObj = this; - if ($('#able-vts').length) { - // Page includes a container for a VTS instance - + if ( null !== document.getElementById( 'able-vts' ) ) { // Are they qualifying tracks? if (this.vtsTracks.length) { - // Yes - there are! - // Build an array of unique languages this.langs = []; this.getAllLangs(this.vtsTracks); From e6f7ca8899b6523e62dceaa81a79dfa394224ba3 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Thu, 31 Jul 2025 12:07:16 -0500 Subject: [PATCH 009/217] Use ternary operators to compact mediatype check --- scripts/initialize.js | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/scripts/initialize.js b/scripts/initialize.js index ed8b0254..8b1f7439 100644 --- a/scripts/initialize.js +++ b/scripts/initialize.js @@ -592,9 +592,7 @@ thisObj.setupPopups(); thisObj.updateCaption(); thisObj.injectVTS(); - if (thisObj.chaptersDivLocation) { - thisObj.populateChaptersDiv(); - } + thisObj.populateChaptersDiv(); thisObj.showSearchResults(); // Go ahead and load media, without user requesting it @@ -841,30 +839,15 @@ // return 'html5', 'youtube', 'vimeo', or null if (this.testFallback) { return null; - } - else if (this.youTubeId) { - if (this.mediaType !== 'video') { - // attempting to play a YouTube video using an element other than