mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix: custom Video/Audio switcher in Plugins menu (#3174)
Related to #3167 Update `setVideoState` function and `switchButtonDiv` event listener to handle transition back to audio mode. * **Update `setVideoState` function** - Correctly handle the transition back to audio mode. - Update the `hideVideo` property in the plugin configuration. - Use `this.config` instead of `config` to set options and update checkbox state. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/th-ch/youtube-music/issues/3167?shareId=XXXX-XXXX-XXXX-XXXX).
This commit is contained in:
@ -179,12 +179,12 @@ export default createPlugin({
|
|||||||
if (this.config) {
|
if (this.config) {
|
||||||
this.config.hideVideo = !showVideo;
|
this.config.hideVideo = !showVideo;
|
||||||
}
|
}
|
||||||
window.mainConfig.plugins.setOptions('video-toggle', config);
|
window.mainConfig.plugins.setOptions('video-toggle', this.config);
|
||||||
|
|
||||||
const checkbox = document.querySelector<HTMLInputElement>(
|
const checkbox = document.querySelector<HTMLInputElement>(
|
||||||
'.video-switch-button-checkbox',
|
'.video-switch-button-checkbox',
|
||||||
); // custom mode
|
); // custom mode
|
||||||
if (checkbox) checkbox.checked = !config.hideVideo;
|
if (checkbox) checkbox.checked = !this.config.hideVideo;
|
||||||
|
|
||||||
if (player) {
|
if (player) {
|
||||||
player.style.margin = showVideo ? '' : 'auto 0px';
|
player.style.margin = showVideo ? '' : 'auto 0px';
|
||||||
|
|||||||
Reference in New Issue
Block a user