aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2024-01-22 07:48:00 +0800
committerAstound <kirito@disroot.org>2024-01-22 07:48:00 +0800
commit89ae1e265b61069b87443997b3b0d93987eeaebe (patch)
tree86daa472ca885c4927068714dcb6cd1707547590
parent00bd9fee6f59900f80272babd610055d0d38fced (diff)
downloadyt-local-89ae1e265b61069b87443997b3b0d93987eeaebe.tar.lz
yt-local-89ae1e265b61069b87443997b3b0d93987eeaebe.tar.xz
yt-local-89ae1e265b61069b87443997b3b0d93987eeaebe.zip
Refactor captions logic in Plyr video player initialization
Simplify the captions logic in the Plyr video player initialization by using a conditional statement. Cleaner and more concise code.
-rw-r--r--youtube/static/js/plyr-start.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/youtube/static/js/plyr-start.js b/youtube/static/js/plyr-start.js
index d9fde90..15e096b 100644
--- a/youtube/static/js/plyr-start.js
+++ b/youtube/static/js/plyr-start.js
@@ -1,17 +1,10 @@
(function main() {
'use strict';
- let captionsActive;
-
- switch(true) {
- case data.settings.subtitles_mode == 2:
- captionsActive = true;
- break;
- case data.settings.subtitles_mode == 1 && data.has_manual_captions:
- captionsActive = true;
- break;
- default:
- captionsActive = false;
+ // Captions
+ let captionsActive = false;
+ if (data.settings.subtitles_mode === 2 || (data.settings.subtitles_mode === 1 && data.has_manual_captions)) {
+ captionsActive = true;
}
// AutoPlay