vault backup: 2025-04-10 14:07:13

This commit is contained in:
SeedList
2025-04-10 14:07:13 +08:00
parent 6a125902cd
commit 3b34a53929
89 changed files with 24824 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import { MarkdownWebpageRendererAPIOptions } from "scripts/api-options";
import { Asset, AssetType, InlinePolicy, Mutability } from "./asset";
export class MathjaxStyles extends Asset
{
private mathjaxStylesheet: CSSStyleSheet | undefined = undefined;
private lastMathjaxChanged: number = -1;
public content: string = "";
constructor()
{
super("mathjax.css", "", AssetType.Style, InlinePolicy.Inline, true, Mutability.Dynamic);
}
override async load(options: MarkdownWebpageRendererAPIOptions)
{
// @ts-ignore
if (this.mathjaxStylesheet == undefined) this.mathjaxStylesheet = Array.from(document.styleSheets).find((sheet) => sheet.ownerNode.id == ("MJX-CHTML-styles"));
if (this.mathjaxStylesheet == undefined)
{
return;
}
this.modifiedTime = Date.now();
// @ts-ignore
let changed = this.mathjaxStylesheet?.ownerNode.getAttribute("data-change");
if (changed != this.lastMathjaxChanged)
{
this.content = "";
for (let i = 0; i < this.mathjaxStylesheet.cssRules.length; i++)
{
this.content += this.mathjaxStylesheet.cssRules[i].cssText + "\n";
}
}
else
{
return;
}
this.lastMathjaxChanged = changed;
await super.load(options);
}
}