@iasiv5/dsh-skins 1.5.23 → 1.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +15 -15
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -653,22 +653,22 @@ ${darkSelector}{${dark.join(";")}}`;
|
|
|
653
653
|
return () => {
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
|
+
const SWEEP_SELECTOR = 'style[data-plugin-css^="dsh-skins/"]:not([data-plugin-css="dsh-skins/sidebar.css"])';
|
|
657
|
+
function flushStylesForSweep() {
|
|
658
|
+
try {
|
|
659
|
+
void document.body?.offsetHeight;
|
|
660
|
+
} catch {
|
|
661
|
+
}
|
|
662
|
+
}
|
|
656
663
|
function refreshSkinStyleTags() {
|
|
657
|
-
if (typeof
|
|
658
|
-
const tags = [...document.head.querySelectorAll(
|
|
664
|
+
if (typeof document === "undefined" || document.head?.querySelectorAll === void 0) return;
|
|
665
|
+
const tags = [...document.head.querySelectorAll(SWEEP_SELECTOR)];
|
|
659
666
|
if (tags.length === 0) return;
|
|
660
|
-
const saved = tags.map((tag) => ({
|
|
661
|
-
for (const tag of
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const fresh = document.createElement("style");
|
|
666
|
-
fresh.dataset.plugin = "dsh-skins";
|
|
667
|
-
fresh.dataset.pluginCss = id;
|
|
668
|
-
fresh.textContent = content;
|
|
669
|
-
document.head.append(fresh);
|
|
670
|
-
}
|
|
671
|
-
}));
|
|
667
|
+
const saved = tags.map((tag) => ({ tag, content: tag.textContent }));
|
|
668
|
+
for (const { tag } of saved) tag.textContent = "";
|
|
669
|
+
flushStylesForSweep();
|
|
670
|
+
for (const { tag, content } of saved) tag.textContent = content;
|
|
671
|
+
flushStylesForSweep();
|
|
672
672
|
}
|
|
673
673
|
let rightPanelRepaintHookInstalled = false;
|
|
674
674
|
function installRightPanelRepaintHook() {
|
|
@@ -877,7 +877,7 @@ ${darkSelector}{${dark.join(";")}}`;
|
|
|
877
877
|
selectedId = skin.id;
|
|
878
878
|
announce(skin.id);
|
|
879
879
|
installRightPanelRepaintHook();
|
|
880
|
-
if (previous !== null) refreshSkinStyleTags();
|
|
880
|
+
if (previous !== null && previous.skin.id !== skin.id) refreshSkinStyleTags();
|
|
881
881
|
return true;
|
|
882
882
|
}
|
|
883
883
|
function restorePrevious(previous, cause) {
|
package/package.json
CHANGED