refactor i czytanie
Deploy to FTP / deploy (push) Successful in 5s

This commit is contained in:
Sebastian Molenda
2026-05-21 22:09:30 +02:00
parent 1dbad2a9f7
commit 07f6a614f2
9 changed files with 449 additions and 182 deletions
+12 -13
View File
@@ -1,18 +1,17 @@
// Shared hamburger menu toggle
// Back-to-hub button with active-task confirmation
(function () {
document.addEventListener('DOMContentLoaded', () => {
const btn = document.getElementById('hamburger-btn')
const menu = document.getElementById('hamburger-menu')
if (!btn || !menu) return
btn.addEventListener('click', (e) => {
e.stopPropagation()
menu.classList.toggle('open')
})
document.addEventListener('click', () => menu.classList.remove('open'))
// mark active link
const current = location.pathname.split('/').pop() || 'index.html'
menu.querySelectorAll('a').forEach(a => {
if (a.getAttribute('href') === current) a.classList.add('active')
const backBtn = document.getElementById('back-to-hub')
if (!backBtn) return
backBtn.addEventListener('click', (e) => {
const playScreen = document.getElementById('play-screen')
const taskActive = playScreen && !playScreen.classList.contains('hidden')
if (taskActive) {
e.preventDefault()
const ok = confirm('Masz aktywne zadanie. Czy na pewno chcesz wyjść do menu?')
if (ok) window.location.href = backBtn.getAttribute('href')
}
})
})
})()