ui: declutter anime pages and controls

This commit is contained in:
2026-04-10 01:15:19 +02:00
parent 8965dc5441
commit e2fc44bf1a
12 changed files with 425 additions and 168 deletions

29
static/js/schedule.js Normal file
View File

@@ -0,0 +1,29 @@
;(function () {
const contentSelector = '#schedule-content'
const loadDay = (tab) => {
const day = tab.getAttribute('data-day')
if (!day || typeof htmx === 'undefined') {
return
}
const tabs = document.querySelectorAll('[data-schedule-tab]')
tabs.forEach((item) => item.classList.remove('active'))
tab.classList.add('active')
htmx.ajax('GET', `/api/schedule?day=${day}`, contentSelector)
}
document.addEventListener('click', (event) => {
const target = event.target
if (!(target instanceof Element)) {
return
}
const tab = target.closest('[data-schedule-tab]')
if (!tab) {
return
}
loadDay(tab)
})
})()