refactor: migrate browser scripts to ts

This commit is contained in:
2026-04-14 23:43:50 +02:00
parent 93cb99fd94
commit b5bc9c23cc
10 changed files with 819 additions and 414 deletions

28
static/ts/anime.ts Normal file
View File

@@ -0,0 +1,28 @@
((): void => {
const toggleDropdown = (): void => {
const dropdown = document.getElementById('watchlist-dropdown')
if (!dropdown) {
return
}
dropdown.classList.toggle('open')
}
;(window as Window & { toggleDropdown?: () => void }).toggleDropdown = toggleDropdown
document.addEventListener('click', (event: MouseEvent): void => {
const dropdown = document.getElementById('watchlist-dropdown')
if (!dropdown) {
return
}
const target = event.target
if (!(target instanceof Node)) {
return
}
if (!dropdown.contains(target)) {
dropdown.classList.remove('open')
}
})
})()