ui: declutter anime pages and controls
This commit is contained in:
28
static/js/anime.js
Normal file
28
static/js/anime.js
Normal file
@@ -0,0 +1,28 @@
|
||||
;(function () {
|
||||
const toggleDropdown = () => {
|
||||
const dropdown = document.getElementById('watchlist-dropdown')
|
||||
if (!dropdown) {
|
||||
return
|
||||
}
|
||||
|
||||
dropdown.classList.toggle('open')
|
||||
}
|
||||
|
||||
window.toggleDropdown = toggleDropdown
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
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')
|
||||
}
|
||||
})
|
||||
})()
|
||||
Reference in New Issue
Block a user