From 417c6d09bf2a73922e7ce426f7a741c600f4ad46 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Fri, 11 Apr 2025 08:41:04 +0200 Subject: [PATCH] Update compact mode preference handling and set attribute on initialization --- .../base/zen-components/ZenCompactMode.mjs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/browser/base/zen-components/ZenCompactMode.mjs b/src/browser/base/zen-components/ZenCompactMode.mjs index cff31df2f..b1f1280e3 100644 --- a/src/browser/base/zen-components/ZenCompactMode.mjs +++ b/src/browser/base/zen-components/ZenCompactMode.mjs @@ -55,27 +55,18 @@ var gZenCompactModeManager = { buttons.removeAttribute('zen-has-hover'); }); } - this.preference = this._wasInCompactMode; + if (this._wasInCompactMode) { + document.documentElement.setAttribute('zen-compact-mode', true); + } }, get preference() { - if (!document.documentElement.hasAttribute('zen-compact-mode')) { - window.addEventListener( - 'MozAfterPaint', - () => { - document.documentElement.setAttribute( - 'zen-compact-mode', - lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') - ); - }, - { once: true } - ); - } return lazyCompactMode.mainAppWrapper.getAttribute('zen-compact-mode') === 'true'; }, set preference(value) { + console.log((new Error()).stack); if (this.preference === value || document.documentElement.hasAttribute('zen-compact-animating')) { // We dont want the user to be able to spam the button return value;