refactor: establish standalone application boundary
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
window.XiaobaiPageModules.register("themes", ["themeLibraryView"], {
|
||||
bind: bindThemeLibraryEvents,
|
||||
enter: ["loadThemes"],
|
||||
});
|
||||
|
||||
/* PRESERVATION-SOURCE-BEGIN app.js:2482-2583 */
|
||||
async function loadThemeLibrary(force = false) {
|
||||
if (state.themeLoading) return;
|
||||
state.themeLoading = true;
|
||||
@@ -105,4 +105,15 @@ function renderThemeDetail() {
|
||||
renderThemeDirectory();
|
||||
}
|
||||
|
||||
/* PRESERVATION-SOURCE-END app.js:2482-2583 */
|
||||
|
||||
function bindThemeLibraryEvents() {
|
||||
document.querySelector("#themeRefreshButton").addEventListener("click", () => loadThemeLibrary(true));
|
||||
document.querySelector("#themeSearch").addEventListener("input", (event) => {
|
||||
state.themeQuery = event.target.value.trim().toLocaleLowerCase("zh-CN");
|
||||
renderThemeDirectory();
|
||||
});
|
||||
document.querySelector("#themeDirectory").addEventListener("click", (event) => {
|
||||
const button = event.target.closest("[data-theme-code]");
|
||||
if (button) selectTheme(button.dataset.themeCode);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user