mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
feat(engage): fix loading screen hang and handle login/logout flow
Made-with: Cursor
This commit is contained in:
+26
-15
@@ -480,24 +480,35 @@ function CheckNoticeTextColour(notice: any) {
|
||||
);
|
||||
}
|
||||
|
||||
function watchForEngageLogin() {
|
||||
const observer = new MutationObserver(() => {
|
||||
if (!document.querySelector(".login")) {
|
||||
observer.disconnect();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
}
|
||||
|
||||
export function tryLoad() {
|
||||
if (isSeqtaEngageExperience()) {
|
||||
updateIframesWithDarkMode();
|
||||
window.addEventListener(
|
||||
"load",
|
||||
() => removeThemeTagsFromNotices(),
|
||||
{ once: true },
|
||||
);
|
||||
window.addEventListener(
|
||||
"load",
|
||||
() => void finishLoad(),
|
||||
{ once: true },
|
||||
);
|
||||
waitForElm(".login").then(() => void finishLoad());
|
||||
waitForElm(".day-container").then(() => void finishLoad());
|
||||
waitForElm(".code", true, 50).then((elm: any) => {
|
||||
if (!elm.innerText.includes("BetterSEQTA")) void LoadPageElements();
|
||||
});
|
||||
window.addEventListener("load", () => removeThemeTagsFromNotices(), { once: true });
|
||||
|
||||
const runEngageLoad = () => {
|
||||
if (document.querySelector(".login")) {
|
||||
finishLoad();
|
||||
watchForEngageLogin();
|
||||
return;
|
||||
}
|
||||
void LoadPageElements();
|
||||
};
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
runEngageLoad();
|
||||
} else {
|
||||
window.addEventListener("load", () => runEngageLoad(), { once: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user