menubutton on small screen and syslog refresh button

This commit is contained in:
wt committed 2024-07-03 09:07:58 +07:00
1 parent 69f4c2e1ea
commit 829a98d76b
6 files changed
+81 -2

No files matched your search

+24
View File
@@ -3,6 +3,10 @@ const settingsbutton = document.querySelector('#settingsbutton')
const syslogsection = document.querySelector('.syslogsection')
const syslogbutton = document.querySelector('#syslogbutton')
const headermenubutton = document.querySelector('#headermenubutton')
const headerlinks = document.querySelector('.links')
// const header = document.querySelector('.header')
settingsbutton.addEventListener('click', () => {
settingssection.classList.add('active')
syslogsection.classList.remove('active')
@@ -13,3 +17,23 @@ syslogbutton.addEventListener('click', () => {
settingssection.classList.remove('active')
get_syslog_data()
})
headermenubutton.addEventListener('click', () => {
if (headerlinks.classList.contains('active')){
headerlinks.classList.remove('active')
return
}
headerlinks.classList.add('active')
})
window.addEventListener('click', (e) => {
if (e.target.id !== "headermenubutton" && !e.target.classList.contains('links')) {
headerlinks.classList.remove('active')
}
})
// if (window.screenX > 600) {
// header.removeChild(headermenubutton)
// } else {
// header.prepend(headermenubutton)
// }