Skip to content

Commit

Permalink
Closes #952
Browse files Browse the repository at this point in the history
  • Loading branch information
ParticleCore committed Mar 1, 2024
1 parent a67b488 commit 36cb103
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
25 changes: 16 additions & 9 deletions src/chrome/js/background-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,7 @@ function mainScript(extensionId, SettingData, defaultSettings) {
&& document.getElementById("chat")?.["isHiddenByUser"] !== true
) {

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

if (chat) {

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

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

}

if (masthead && masthead.style.right !== mastheadRight) {
masthead.style.right = mastheadRight;
masthead.style.left = "0px";
masthead.style.width = "auto";
const masthead = document.getElementById("masthead-container");
const moviePlayerParent = document.getElementById("movie_player")?.parentElement;

if (masthead && moviePlayerParent?.offsetWidth > 0) {

const width = `${moviePlayerParent.offsetWidth}px`;

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

}

} else {

document.getElementById("masthead-container")?.removeAttribute("style");
const moviePlayerParent = document.getElementById("movie_player")?.parentElement;

if (moviePlayerParent) {
moviePlayerParent.style.width = "";
}

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

Expand Down
25 changes: 16 additions & 9 deletions src/firefox/js/background-inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,7 @@ function mainScript(extensionId, SettingData, defaultSettings) {
&& document.getElementById("chat")?.["isHiddenByUser"] !== true
) {

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

if (chat) {

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

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

}

if (masthead && masthead.style.right !== mastheadRight) {
masthead.style.right = mastheadRight;
masthead.style.left = "0px";
masthead.style.width = "auto";
const masthead = document.getElementById("masthead-container");
const moviePlayerParent = document.getElementById("movie_player")?.parentElement;

if (masthead && moviePlayerParent?.offsetWidth > 0) {

const width = `${moviePlayerParent.offsetWidth}px`;

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

}

} else {

document.getElementById("masthead-container")?.removeAttribute("style");
const moviePlayerParent = document.getElementById("movie_player")?.parentElement;

if (moviePlayerParent) {
moviePlayerParent.style.width = "";
}

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

Expand Down

0 comments on commit 36cb103

Please sign in to comment.