fix: data-action delegation + convert onclick to event listeners, sidebar+logout+modals
This commit is contained in:
@@ -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();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user