Skip to content

Commit

Permalink
Merge pull request #2405 from raszpl/patch-8
Browse files Browse the repository at this point in the history
Update shortcuts.js fix shortcutToggleControls #1129
  • Loading branch information
ImprovedTube authored Jun 23, 2024
2 parents 0b1e945 + a667cff commit 3ba1b6e
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions js&css/web-accessible/www.youtube.com/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,20 +250,27 @@ ImprovedTube.shortcutPictureInPicture = function () {
/*------------------------------------------------------------------------------
4.7.3 TOGGLE CONTROLS
------------------------------------------------------------------------------*/

ImprovedTube.shortcutToggleControls = function () {
if (this.elements.player) {
this.storage.player_hide_controls = !this.storage.player_hide_controls;
const player = this.elements.player;
let option = this.storage.player_hide_controls;

if (this.storage.player_hide_controls) {
this.elements.player.hideControls();
if (player && player.hideControls && player.showControls) {
if (option === 'when_paused') {
if (this.elements.video.paused) {
option = 'off';
} else {
option = 'always';
}
} else if (option === 'always') {
option = 'off';
} else {
this.elements.player.showControls();
option = 'always';
}

this.storage.player_hide_controls = option;
ImprovedTube.playerControls()
}
};


/*------------------------------------------------------------------------------
4.7.4 PLAY / PAUSE
------------------------------------------------------------------------------*/
Expand Down

0 comments on commit 3ba1b6e

Please sign in to comment.