mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-17 17:07:07 +00:00
perf: reduce startup work and fix grade analytics bar chart animation
Batch settings storage writes, tier plugin startup, lazy-load heavy UI chunks, and optimize global search indexing. Stop tweening bar height in grade analytics to prevent invalid negative SVG rect values. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+34
-19
@@ -26,7 +26,6 @@ import {
|
||||
updateEngageHomeMenuActive,
|
||||
} from "@/seqta/utils/Loaders/LoadEngageHomePage";
|
||||
import { loadHomePage } from "@/seqta/utils/Loaders/LoadHomePage";
|
||||
import { loadAnalyticsPage } from "@/plugins/built-in/gradeAnalytics/loadAnalyticsPage";
|
||||
import { runStartupPopupQueue } from "@/seqta/utils/Openers/StartupPopupQueue";
|
||||
|
||||
import { updateTimetableTimes } from "@/seqta/utils/updateTimetableTimes";
|
||||
@@ -337,7 +336,11 @@ async function handleSublink(sublink: string | undefined): Promise<void> {
|
||||
break;
|
||||
case "analytics":
|
||||
console.info("[BetterSEQTA+] Started Init (Analytics)");
|
||||
if (settingsState.onoff) void loadAnalyticsPage();
|
||||
if (settingsState.onoff) {
|
||||
void import("@/plugins/built-in/gradeAnalytics/loadAnalyticsPage").then(
|
||||
(m) => m.loadAnalyticsPage(),
|
||||
);
|
||||
}
|
||||
finishLoad();
|
||||
break;
|
||||
case undefined:
|
||||
@@ -488,25 +491,37 @@ async function handleReports(node: Element): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function CheckNoticeTextColour(notice: any) {
|
||||
eventManager.register(
|
||||
"noticeAdded",
|
||||
{
|
||||
elementType: "div",
|
||||
className: "notice",
|
||||
parentElement: notice,
|
||||
},
|
||||
(node) => {
|
||||
var hex = (node as HTMLElement).style.cssText.split(" ")[1];
|
||||
if (hex) {
|
||||
const hex1 = hex.slice(0, -1);
|
||||
var threshold = GetThresholdOfColor(hex1);
|
||||
if (settingsState.DarkMode && threshold < 100) {
|
||||
(node as HTMLElement).style.cssText = "--color: undefined;";
|
||||
function CheckNoticeTextColour(notice: Element) {
|
||||
const adjustNoticeColor = (node: Element) => {
|
||||
const hex = (node as HTMLElement).style.cssText.split(" ")[1];
|
||||
if (hex) {
|
||||
const hex1 = hex.slice(0, -1);
|
||||
const threshold = GetThresholdOfColor(hex1);
|
||||
if (settingsState.DarkMode && threshold < 100) {
|
||||
(node as HTMLElement).style.cssText = "--color: undefined;";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (const node of notice.querySelectorAll("div.notice")) {
|
||||
adjustNoticeColor(node);
|
||||
}
|
||||
|
||||
const observer = new MutationObserver((mutations) => {
|
||||
for (const mutation of mutations) {
|
||||
for (const added of mutation.addedNodes) {
|
||||
if (!(added instanceof Element)) continue;
|
||||
if (added.matches("div.notice")) {
|
||||
adjustNoticeColor(added);
|
||||
}
|
||||
for (const node of added.querySelectorAll("div.notice")) {
|
||||
adjustNoticeColor(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
observer.observe(notice, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
function watchForEngageLogin() {
|
||||
|
||||
Reference in New Issue
Block a user