refactor: establish standalone application boundary

This commit is contained in:
leefer
2026-08-03 21:42:25 +08:00
parent cc5fb8d73e
commit e1e76cd51e
324 changed files with 63090 additions and 44743 deletions
+43 -2
View File
@@ -1,9 +1,9 @@
window.XiaobaiPageModules.register("auction", ["auctionView"], {
bind: bindAuctionEvents,
enter: ["loadAuction"],
leave: ["clearAuction"],
});
/* PRESERVATION-SOURCE-BEGIN app.js:2217-2481 */
async function loadAuctionCenter(force = false) {
if (state.auctionLoading) return;
state.auctionLoading = true;
@@ -269,4 +269,45 @@ function exportAuctionRows() {
]);
}
/* PRESERVATION-SOURCE-END app.js:2217-2481 */
function bindAuctionEvents() {
document.querySelector("#auctionRefreshButton").addEventListener("click", () => loadAuctionCenter(true));
document.querySelector("#auctionExportButton").addEventListener("click", exportAuctionRows);
document.querySelector("#auctionSearch").addEventListener("input", (event) => {
state.auctionQuery = event.target.value.trim().toLocaleLowerCase("zh-CN");
renderAuctionTable();
});
document.querySelectorAll("[data-auction-dataset]").forEach((button) => {
button.addEventListener("click", () => {
state.auctionDataset = button.dataset.auctionDataset || "focus";
state.auctionFilter = "all";
state.auctionSortKey = state.auctionDataset === "onePrice" ? "amount_million" : "attention_score";
state.auctionSortDirection = "desc";
document.querySelectorAll("[data-auction-dataset]").forEach((item) => {
const active = item === button;
item.classList.toggle("active", active);
item.setAttribute("aria-selected", String(active));
});
document.querySelectorAll("[data-auction-filter]").forEach((item) => item.classList.toggle("active", item.dataset.auctionFilter === "all"));
renderAuctionTable();
});
});
document.querySelectorAll("[data-auction-filter]").forEach((button) => {
button.addEventListener("click", () => {
state.auctionFilter = button.dataset.auctionFilter || "all";
document.querySelectorAll("[data-auction-filter]").forEach((item) => item.classList.toggle("active", item === button));
renderAuctionTable();
});
});
document.querySelector("#auctionTable").addEventListener("click", (event) => {
const header = event.target.closest("th[data-auction-sort]");
if (!header) return;
const key = header.dataset.auctionSort;
if (state.auctionSortKey === key) state.auctionSortDirection = state.auctionSortDirection === "asc" ? "desc" : "asc";
else {
state.auctionSortKey = key;
state.auctionSortDirection = "desc";
}
renderAuctionTable();
});
}