Skip to content

Commit

Permalink
use document.documentElement
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon committed Nov 7, 2024
1 parent 054d984 commit 4a53d3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/features/panorama.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ export const main = async () => {
} = await getPreferences('panorama');

const maxPostWidth = Number(maxPostWidthString.trim().replace('px', '')) || 0;
document.body.style.setProperty(maxPostWidthVar, `${Math.max(maxPostWidth, 540)}px`);
document.body.classList[expandPostMedia ? 'add' : 'remove'](expandMediaClass);
document.documentElement.style.setProperty(maxPostWidthVar, `${Math.max(maxPostWidth, 540)}px`);
document.documentElement.classList[expandPostMedia ? 'add' : 'remove'](expandMediaClass);

document.documentElement.append(styleElement);
if (mainEnable) {
Expand All @@ -161,8 +161,8 @@ export const clean = async () => {
el.style.removeProperty(aspectRatioVar)
);

document.body.style.removeProperty(maxPostWidthVar);
document.body.classList.remove(expandMediaClass);
document.documentElement.style.removeProperty(maxPostWidthVar);
document.documentElement.classList.remove(expandMediaClass);

styleElement.remove();
mainStyleElement.remove();
Expand Down

0 comments on commit 4a53d3b

Please sign in to comment.