From 4a53d3b6862e682460e6459c73980d357fc58ba8 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 7 Nov 2024 11:05:15 -0800 Subject: [PATCH] use document.documentElement --- src/features/panorama.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/features/panorama.js b/src/features/panorama.js index ac1ff6334..2ef5e4260 100644 --- a/src/features/panorama.js +++ b/src/features/panorama.js @@ -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) { @@ -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();