feat(engage): fix loading screen hang and handle login/logout flow

Made-with: Cursor
This commit is contained in:
2026-04-07 15:10:58 +09:30
parent b63a3d95f3
commit 8801d5a435
+26 -15
View File
@@ -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() { export function tryLoad() {
if (isSeqtaEngageExperience()) { if (isSeqtaEngageExperience()) {
updateIframesWithDarkMode(); updateIframesWithDarkMode();
window.addEventListener( window.addEventListener("load", () => removeThemeTagsFromNotices(), { once: true });
"load",
() => removeThemeTagsFromNotices(), const runEngageLoad = () => {
{ once: true }, if (document.querySelector(".login")) {
); finishLoad();
window.addEventListener( watchForEngageLogin();
"load", return;
() => void finishLoad(), }
{ once: true }, void LoadPageElements();
); };
waitForElm(".login").then(() => void finishLoad());
waitForElm(".day-container").then(() => void finishLoad()); if (document.readyState === "complete") {
waitForElm(".code", true, 50).then((elm: any) => { runEngageLoad();
if (!elm.innerText.includes("BetterSEQTA")) void LoadPageElements(); } else {
}); window.addEventListener("load", () => runEngageLoad(), { once: true });
}
return; return;
} }