From 006067b01929f32c535fe2f7259fb44562efd003 Mon Sep 17 00:00:00 2001
From: JdM <julien@rmbi.ch>
Date: Fri, 19 May 2023 17:38:11 +0200
Subject: [PATCH] Add settings option

---
 src/components/PreferencesPage.vue | 13 +++++++++++++
 src/locales/en.json                |  1 +
 2 files changed, 14 insertions(+)

diff --git a/src/components/PreferencesPage.vue b/src/components/PreferencesPage.vue
index ac5a9d80..f8dbab91 100644
--- a/src/components/PreferencesPage.vue
+++ b/src/components/PreferencesPage.vue
@@ -45,6 +45,16 @@
             @change="onChange($event)"
         />
     </label>
+    <label class="pref" for="chkAutoDisplayCaptions">
+        <strong v-t="'actions.auto_display_captions'" />
+        <input
+            id="chkAutoDisplayCaptions"
+            v-model="autoDisplayCaptions"
+            class="checkbox"
+            type="checkbox"
+            @change="onChange($event)"
+        />
+    </label>
     <label class="pref" for="chkAutoPlayNextCountdown">
         <strong v-t="'actions.autoplay_next_countdown'" />
         <input
@@ -356,6 +366,7 @@ export default {
             minSegmentLength: 0,
             selectedTheme: "dark",
             autoPlayVideo: true,
+            autoDisplayCaptions: false,
             autoPlayNextCountdown: 5,
             listen: false,
             resolutions: [144, 240, 360, 480, 720, 1080, 1440, 2160, 4320],
@@ -473,6 +484,7 @@ export default {
             this.minSegmentLength = Math.max(this.getPreferenceNumber("minSegmentLength", 0), 0);
             this.selectedTheme = this.getPreferenceString("theme", "dark");
             this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true);
+            this.autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
             this.autoPlayNextCountdown = this.getPreferenceNumber("autoPlayNextCountdown", 5);
             this.listen = this.getPreferenceBoolean("listen", false);
             this.defaultQuality = Number(localStorage.getItem("quality"));
@@ -528,6 +540,7 @@ export default {
                 localStorage.setItem("minSegmentLength", this.minSegmentLength);
                 localStorage.setItem("theme", this.selectedTheme);
                 localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
+                localStorage.setItem("autoDisplayCaptions", this.autoDisplayCaptions);
                 localStorage.setItem("autoPlayNextCountdown", this.autoPlayNextCountdown);
                 localStorage.setItem("listen", this.listen);
                 localStorage.setItem("quality", this.defaultQuality);
diff --git a/src/locales/en.json b/src/locales/en.json
index bae2c35b..e4dba42c 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -70,6 +70,7 @@
         "import_from_json": "Import from JSON/CSV",
         "loop_this_video": "Loop this Video",
         "auto_play_next_video": "Auto Play next Video",
+        "auto_display_captions": "Auto Display Captions",
         "donations": "Development donations",
         "minimize_comments": "Minimize Comments",
         "show_comments": "Show Comments",