Skip to content

Commit

Permalink
fix undefined player_size
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Rekk committed Nov 15, 2023
1 parent 32c8b39 commit 7c6e2e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ ImprovedTube.playerFitToWinButton = function () {
opacity: 0.85,
position: "right",
onclick: function () {
let previousSize = ImprovedTube.storage.player_size === "fit_to_window" ? "do_not_change" : ImprovedTube.storage.player_size;
let previousSize = ImprovedTube.storage.player_size === "fit_to_window" ? "do_not_change" : (ImprovedTube.storage.player_size ?? "do_not_change");
let isFTW = document.querySelector("html").getAttribute("it-player-size") === "fit_to_window"
if (isFTW) {
document.querySelector("html").setAttribute("it-player-size", previousSize);
Expand All @@ -693,9 +693,9 @@ ImprovedTube.playerFitToWinButton = function () {
},
title: 'Fit To Window'
});
} else if (this.elements.buttons['it-fit-to-win-player-button']) {
} else if (!this.storage.player_fit_to_win_button && this.elements.buttons['it-fit-to-win-player-button']) {
this.elements.buttons['it-fit-to-win-player-button'].remove();
document.querySelector("html").setAttribute("it-player-size", ImprovedTube.storage.player_size);
document.querySelector("html").setAttribute("it-player-size", ImprovedTube.storage.player_size ?? "do_not_change");
}
};
/*------------------------------------------------------------------------------
Expand Down

0 comments on commit 7c6e2e9

Please sign in to comment.