mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-08-28 17:21:05 +00:00
refactor: trim PR debloat and fix transformers build
Extract shared helpers for home notices, timetable subtitles, and theme images; dedupe global search, Select, and build scripts while preserving behaviour. Add @huggingface/transformers as a direct dependency and resolve ORT WASM paths via require.resolve so pnpm postinstall and Vite can bundle vector search. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,32 +9,26 @@ const LAYER_CLASSES = [
|
||||
["bg", "bg3", ANIMATED_BG_MARKER],
|
||||
] as const;
|
||||
|
||||
const layerSelector = `:scope > div.bg.${ANIMATED_BG_MARKER}`;
|
||||
|
||||
export function updateAnimationSpeed(speed: number) {
|
||||
const bgElements = document.querySelectorAll(`.bg.${ANIMATED_BG_MARKER}`);
|
||||
Array.from(bgElements).forEach((element, index) => {
|
||||
document.querySelectorAll(`.bg.${ANIMATED_BG_MARKER}`).forEach((element, index) => {
|
||||
const baseSpeed = index === 0 ? 3 : index === 1 ? 4 : 5;
|
||||
(element as HTMLElement).style.animationDuration = `${baseSpeed / speed}s`;
|
||||
});
|
||||
}
|
||||
|
||||
function countAnimatedLayers(container: HTMLElement): number {
|
||||
return container.querySelectorAll(`:scope > div.bg.${ANIMATED_BG_MARKER}`).length;
|
||||
}
|
||||
|
||||
export function ensureAnimatedBackgroundLayers(
|
||||
container: HTMLElement,
|
||||
menu: HTMLElement,
|
||||
speed: number,
|
||||
): void {
|
||||
const count = countAnimatedLayers(container);
|
||||
if (count >= 3) {
|
||||
if (container.querySelectorAll(layerSelector).length >= 3) {
|
||||
updateAnimationSpeed(speed);
|
||||
return;
|
||||
}
|
||||
|
||||
container
|
||||
.querySelectorAll(`:scope > div.bg.${ANIMATED_BG_MARKER}`)
|
||||
.forEach((el) => el.remove());
|
||||
container.querySelectorAll(layerSelector).forEach((el) => el.remove());
|
||||
|
||||
for (const classes of LAYER_CLASSES) {
|
||||
const bk = document.createElement("div");
|
||||
@@ -46,9 +40,7 @@ export function ensureAnimatedBackgroundLayers(
|
||||
}
|
||||
|
||||
export function removeAnimatedBackgroundLayers(): void {
|
||||
document
|
||||
.querySelectorAll(`div.bg.${ANIMATED_BG_MARKER}`)
|
||||
.forEach((el) => el.remove());
|
||||
document.querySelectorAll(`div.bg.${ANIMATED_BG_MARKER}`).forEach((el) => el.remove());
|
||||
}
|
||||
|
||||
export async function syncAnimatedBackground(
|
||||
|
||||
Reference in New Issue
Block a user