From 6d542ea79b23cad928995b7913eb8d895381261b Mon Sep 17 00:00:00 2001 From: "mr. M" Date: Sat, 2 Nov 2024 17:35:24 +0100 Subject: [PATCH] Refactor ZenGlanceManager.mjs to simplify closing of glance by removing unnecessary animation option --- src/ZenGlanceManager.mjs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ZenGlanceManager.mjs b/src/ZenGlanceManager.mjs index d1abc09..ba7262f 100644 --- a/src/ZenGlanceManager.mjs +++ b/src/ZenGlanceManager.mjs @@ -153,6 +153,7 @@ // do NOT touch here, I don't know what it does, but it works... window.requestAnimationFrame(() => { + this.#currentTab.style.display = "none"; this.browserWrapper.removeAttribute("animate"); this.browserWrapper.removeAttribute("animate-end"); this.overlay.setAttribute("fade-out", true); @@ -169,11 +170,7 @@ this.overlay.removeAttribute("fade-out"); this.browserWrapper.removeAttribute("animate"); - this.#currentTab.style.display = "none"; - - this.#currentBrowser = null; this.lastCurrentTab = this.#currentTab; - this.#currentTab = null; this.overlay.classList.remove("zen-glance-overlay"); @@ -188,12 +185,16 @@ this.overlay = null; this.contentWrapper = null; - setTimeout(() => { - this.lastCurrentTab.removeAttribute("zen-glance-tab"); - gBrowser.removeTab(this.lastCurrentTab); - this.lastCurrentTab = null; - this._duringOpening = false; - }, 100); + this.lastCurrentTab.removeAttribute("zen-glance-tab"); + + this.#currentTab.remove(); + this.#currentBrowser.destroy(); + this.#currentBrowser.closest(".browserSidebarContainer").remove(); + this.#currentTab = null; + this.#currentBrowser = null; + + this.lastCurrentTab = null; + this._duringOpening = false; }, 500); }); });