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
+20 -2
View File
@@ -1,8 +1,8 @@
window.XiaobaiPageModules.register("popularity", ["popularityView"], {
bind: bindPopularityEvents,
enter: ["loadPopularity"],
});
/* PRESERVATION-SOURCE-BEGIN app.js:2584-2659 */
async function loadPopularity(force = false) {
if (state.popularityLoading) return;
state.popularityLoading = true;
@@ -79,4 +79,22 @@ function renderPopularityTable() {
document.querySelector("#popularityEmpty").hidden = rows.length > 0;
}
/* PRESERVATION-SOURCE-END app.js:2584-2659 */
function bindPopularityEvents() {
document.querySelector("#popularityRefreshButton").addEventListener("click", () => loadPopularity(true));
document.querySelector("#popularitySearch").addEventListener("input", (event) => {
state.popularityQuery = event.target.value.trim().toLocaleLowerCase("zh-CN");
renderPopularityTable();
});
document.querySelectorAll("[data-popularity-source]").forEach((button) => {
button.addEventListener("click", () => {
state.popularitySource = button.dataset.popularitySource || "combined";
document.querySelectorAll("[data-popularity-source]").forEach((item) => {
const active = item === button;
item.classList.toggle("active", active);
item.setAttribute("aria-selected", String(active));
});
renderPopularityTable();
});
});
}