mirror of
https://github.com/zen-browser/components.git
synced 2025-07-07 21:39:58 +02:00
refactor: Improve lazy loading for images in ZenThemesImporter.mjs
Optimize the lazy loading implementation for images in the ZenThemesImporter.mjs file. This refactor enhances the page load performance and improves the overall user experience.
This commit is contained in:
parent
1f27bc40cd
commit
ea8b4c36dc
1 changed files with 5 additions and 4 deletions
|
@ -100,17 +100,18 @@ var gZenThemeImporter = new class {
|
|||
|
||||
insertStylesheet() {
|
||||
if (IOUtils.exists(this.styleSheetPath)) {
|
||||
const styleSheet = document.getElementById("zen-themes-stylesheet");
|
||||
let styleSheet = document.getElementById("zen-themes-stylesheet");
|
||||
if (!styleSheet) {
|
||||
const styleSheet = document.createElementNS("http://www.w3.org/1999/xhtml", "html:link");
|
||||
styleSheet = document.createElementNS("http://www.w3.org/1999/xhtml", "html:link");
|
||||
styleSheet.id = "zen-themes-stylesheet";
|
||||
styleSheet.setAttribute("rel", "stylesheet");
|
||||
styleSheet.setAttribute("type", "text/css");
|
||||
styleSheet.setAttribute("href", this.styleSheetURI.spec);
|
||||
document.documentElement.appendChild(styleSheet);
|
||||
} else {
|
||||
// add a ?=timestamp to the URL to force a reload
|
||||
styleSheet.href = this.styleSheetURI.spec + "?" + Date.now();
|
||||
}
|
||||
// add a ?=timestamp to the URL to force a reload
|
||||
styleSheet.href = this.styleSheetURI.spec + "?" + Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue