diff --git a/src/content/inject.js b/src/content/inject.js
index f28c2f2b..71ecb75d 100644
--- a/src/content/inject.js
+++ b/src/content/inject.js
@@ -185,6 +185,7 @@ class VideoSpeedExtension {
this.injectControllerCSS();
this.setupCSSLiveUpdates();
+ this.setupControllerExpansionLiveUpdates();
this.siteHandlerManager.initialize(document);
this.eventManager = new this.EventManager(this.config, null);
@@ -291,6 +292,27 @@ class VideoSpeedExtension {
});
}
+ /** Live-update expanded controls on every attached controller. */
+ setupControllerExpansionLiveUpdates() {
+ document.documentElement.addEventListener('VSC_STORAGE_CHANGED', (event) => {
+ const changes = event.detail;
+ if (!Object.prototype.hasOwnProperty.call(changes || {}, 'keepControlsExpanded')) {
+ return;
+ }
+
+ const expanded = changes.keepControlsExpanded?.newValue === true;
+ this.config.settings.keepControlsExpanded = expanded;
+
+ const mediaElements = window.VSC.stateManager?.getAllMediaElements() || [];
+ for (const media of mediaElements) {
+ const shadow = media.vsc?.div?.shadowRoot;
+ if (shadow) {
+ window.VSC.ShadowDOMManager.setControlsExpanded(shadow, expanded);
+ }
+ }
+ });
+ }
+
/**
* Set up observers for DOM changes and video detection
*/
diff --git a/src/core/settings.js b/src/core/settings.js
index 4312afc7..b555e450 100644
--- a/src/core/settings.js
+++ b/src/core/settings.js
@@ -161,6 +161,7 @@ if (!window.VSC.VideoSpeedConfig) {
this.settings.exclusiveKeys = Boolean(storage.exclusiveKeys);
this.settings.audioBoolean = Boolean(storage.audioBoolean);
this.settings.startHidden = Boolean(storage.startHidden);
+ this.settings.keepControlsExpanded = Boolean(storage.keepControlsExpanded);
this.settings.controllerOpacity = Number(storage.controllerOpacity);
this.settings.controllerButtonSize = Number(storage.controllerButtonSize);
// One-time migration: drop legacy controllerCSS key, reset to new model.
diff --git a/src/core/video-controller.js b/src/core/video-controller.js
index d48fcec8..4b4fefb0 100644
--- a/src/core/video-controller.js
+++ b/src/core/video-controller.js
@@ -157,6 +157,7 @@ class VideoController {
speed: speed,
opacity: this.config.settings.controllerOpacity,
buttonSize: this.config.settings.controllerButtonSize,
+ keepControlsExpanded: this.config.settings.keepControlsExpanded,
});
// Set up control events
diff --git a/src/ui/options/options.html b/src/ui/options/options.html
index c463ad2f..cc7efc4f 100644
--- a/src/ui/options/options.html
+++ b/src/ui/options/options.html
@@ -57,6 +57,16 @@
Preferences
>
+
+
+
+