refactor: split large modules and harden live-room fudai flow

This commit is contained in:
Your Name committed 2026-06-01 18:39:44 +08:00
1 parent 1845561405
commit 36e374ef67
86 files changed
+7422 -8404

No files matched your search

+24 -17
View File
@@ -463,8 +463,12 @@ function updateTabBadge(target, count) {
}
function startReservationsCountdownTick() {
if (window.__reservationTickTimer) {
clearInterval(window.__reservationTickTimer);
window.__reservationTickTimer = null;
}
// 每秒 tick 更新预约卡倒计时与高亮类,无需等待 stats 轮询
setInterval(() => {
window.__reservationTickTimer = setInterval(() => {
const items = document.querySelectorAll(".reservationItem[data-future-ts]");
if (!items.length) return;
const now = Date.now() / 1000;
@@ -643,22 +647,25 @@ function startShotPolling() {
preview.classList.toggle(UI_CLASS.shotEmpty, img.complete && img.naturalWidth === 0);
};
syncShotEmpty();
img.addEventListener("load", () => {
img.dataset.loading = "false";
if (preview) preview.classList.remove(UI_CLASS.shotEmpty);
const ts = new Date().toLocaleTimeString();
if (status) status.textContent = `已更新:${ts}`;
const tsBadge = document.getElementById("liveShotTs");
if (tsBadge) {
tsBadge.textContent = ts;
tsBadge.hidden = false;
}
});
img.addEventListener("error", () => {
img.dataset.loading = "false";
if (preview) preview.classList.add(UI_CLASS.shotEmpty);
if (status) status.textContent = "暂无截图(等待脚本生成 pic/screenshot.png)";
});
if (!img.dataset.boundLoadHandler) {
img.dataset.boundLoadHandler = "1";
img.addEventListener("load", () => {
img.dataset.loading = "false";
if (preview) preview.classList.remove(UI_CLASS.shotEmpty);
const ts = new Date().toLocaleTimeString();
if (status) status.textContent = `已更新:${ts}`;
const tsBadge = document.getElementById("liveShotTs");
if (tsBadge) {
tsBadge.textContent = ts;
tsBadge.hidden = false;
}
});
img.addEventListener("error", () => {
img.dataset.loading = "false";
if (preview) preview.classList.add(UI_CLASS.shotEmpty);
if (status) status.textContent = "暂无截图(等待脚本生成 pic/screenshot.png)";
});
}
setTimeout(syncShotEmpty, 0);
}