fix: data-action delegation + convert onclick to event listeners, sidebar+logout+modals

This commit is contained in:
2026-07-15 02:44:18 +08:00
parent 9e15a319f5
commit f0e891b17c
20 changed files with 147 additions and 133 deletions

View File

@@ -17,6 +17,14 @@ const App = {
try { const s = await API.get('/install/status'); if (!s.installed) { location.hash = '#/install'; return; } } catch { location.hash = '#/install'; return; }
this._footerLoaded = false;
window.addEventListener('hashchange', () => this.route());
document.getElementById('modal-close').onclick = () => this.closeModal();
document.addEventListener('click', (e) => {
const action = e.target.closest('[data-action]');
if (!action) return;
const [obj, method, ...args] = action.dataset.action.split(':');
const target = window[obj];
if (target && target[method]) target[method](...args);
});
this.route();
},