mirror of
https://github.com/yexi-by/dsh-unrestricted.git
synced 2026-11-28 02:30:22 +08:00
chore: 同步 DSH 0.2.2-rc.3 原版提示词快照、补充样式清理并升级至 v0.2.9
This commit is contained in:
1 parent
1383c6c168
commit
c7afd4e03d
29 files changed
+518
-187
No files matched your search
+11
-4
@@ -520,14 +520,21 @@ window.__ModuleLoader__.load({
|
||||
}
|
||||
}
|
||||
`;
|
||||
/** Inject the stylesheet once; the tag id doubles as the re-evaluation guard. */
|
||||
/** Inject the stylesheet once and clean it up when this effect disposes. */
|
||||
function ensureStyles() {
|
||||
if (typeof document === "undefined") return;
|
||||
if (document.querySelector("style[data-plugin=\"dsh-unrestricted\"]") !== null) return;
|
||||
if (typeof document === "undefined") return () => {};
|
||||
const existing = document.querySelector("style[data-plugin=\"dsh-unrestricted\"]");
|
||||
if (existing !== null) {
|
||||
existing.textContent = CSS;
|
||||
return () => {};
|
||||
}
|
||||
const tag = document.createElement("style");
|
||||
tag.dataset.plugin = "dsh-unrestricted";
|
||||
tag.textContent = CSS;
|
||||
document.head.appendChild(tag);
|
||||
return () => {
|
||||
tag.remove();
|
||||
};
|
||||
}
|
||||
//#endregion
|
||||
//#region src/client/UnrestrictedCard.tsx
|
||||
@@ -856,7 +863,7 @@ window.__ModuleLoader__.load({
|
||||
];
|
||||
/** 注册本插件的配置卡片。 */
|
||||
function apply(ctx) {
|
||||
ensureStyles();
|
||||
ctx.effect(() => ensureStyles(), "dsh-unrestricted: stylesheet");
|
||||
ctx.effect(() => ctx.locale.register(NS, {
|
||||
zh,
|
||||
en
|
||||
|
||||
Reference in new issue
Block a user