Refactor ZenGlanceManager.mjs to open new tabs in the background and skip loading, and append the new tab to the glance tabs container. Increase the delay for removing the current tab to 500ms.

This commit is contained in:
mr. M 2024-10-29 10:21:39 +01:00
parent 893eead718
commit ed7ce7c8d3
No known key found for this signature in database
GPG key ID: CBD57A2AEDBDA1FB

View file

@ -70,10 +70,12 @@
console.log(url); console.log(url);
const newTabOptions = { const newTabOptions = {
userContextId: currentTab.getAttribute("usercontextid") || "", userContextId: currentTab.getAttribute("usercontextid") || "",
inBackground: false, inBackground: true,
skipLoading: true,
insertTab: false, insertTab: false,
}; };
const newTab = gBrowser.addTrustedTab(url, newTabOptions); const newTab = gBrowser.addTrustedTab(url, newTabOptions);
document.getElementById("zen-glance-tabs").appendChild(newTab);
this.#currentBrowser = newTab.linkedBrowser; this.#currentBrowser = newTab.linkedBrowser;
this.#currentTab = newTab; this.#currentTab = newTab;
return this.#currentBrowser; return this.#currentBrowser;
@ -147,7 +149,7 @@
this.#currentTab?.remove(); this.#currentTab?.remove();
this.#currentBrowser = null; this.#currentBrowser = null;
this.#currentTab = null; this.#currentTab = null;
}, 300); }, 500);
}); });
}); });
} }