Skip to content

Commit

Permalink
Closes #945
Browse files Browse the repository at this point in the history
  • Loading branch information
ParticleCore committed Mar 1, 2024
1 parent b10d362 commit f91901d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
23 changes: 11 additions & 12 deletions src/chrome/js/background-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function mainScript(extensionId, SettingData, defaultSettings) {

const FeatureSuperTheater = (() => {

const onResize = event => {
const onResize = () => {

const ytdApp = document.querySelector("ytd-app");

Expand All @@ -706,14 +706,9 @@ function mainScript(extensionId, SettingData, defaultSettings) {
&& document.getElementById("chat")?.["isHiddenByUser"] !== true
) {

const newWidth = `${event.width}px`;
const masthead = document.getElementById("masthead-container");

if (masthead && newWidth !== masthead.style.width) {
masthead.style.width = newWidth;
}

const chat = document.getElementById("chat-container");
let mastheadRight = "";

if (chat) {

Expand All @@ -723,15 +718,19 @@ function mainScript(extensionId, SettingData, defaultSettings) {
videoContainer.appendChild(chat);
}

mastheadRight = `${chat.offsetWidth}px`;

}

} else {
if (masthead && masthead.style.right !== mastheadRight) {
masthead.style.right = mastheadRight;
masthead.style.left = "0px";
masthead.style.width = "auto";
}

const masthead = document.getElementById("masthead-container");
} else {

if (masthead && masthead.style.width !== "") {
masthead.style.width = "";
}
document.getElementById("masthead-container")?.removeAttribute("style");

const chat = document.getElementById("chat-container");

Expand Down
23 changes: 11 additions & 12 deletions src/firefox/js/background-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function mainScript(extensionId, SettingData, defaultSettings) {

const FeatureSuperTheater = (() => {

const onResize = event => {
const onResize = () => {

const ytdApp = document.querySelector("ytd-app");

Expand All @@ -706,14 +706,9 @@ function mainScript(extensionId, SettingData, defaultSettings) {
&& document.getElementById("chat")?.["isHiddenByUser"] !== true
) {

const newWidth = `${event.width}px`;
const masthead = document.getElementById("masthead-container");

if (masthead && newWidth !== masthead.style.width) {
masthead.style.width = newWidth;
}

const chat = document.getElementById("chat-container");
let mastheadRight = "";

if (chat) {

Expand All @@ -723,15 +718,19 @@ function mainScript(extensionId, SettingData, defaultSettings) {
videoContainer.appendChild(chat);
}

mastheadRight = `${chat.offsetWidth}px`;

}

} else {
if (masthead && masthead.style.right !== mastheadRight) {
masthead.style.right = mastheadRight;
masthead.style.left = "0px";
masthead.style.width = "auto";
}

const masthead = document.getElementById("masthead-container");
} else {

if (masthead && masthead.style.width !== "") {
masthead.style.width = "";
}
document.getElementById("masthead-container")?.removeAttribute("style");

const chat = document.getElementById("chat-container");

Expand Down

0 comments on commit f91901d

Please sign in to comment.