Mi megy most a tavon?
Az alábbi listában mindig a következő 24 óra programjait láthatod.
document.addEventListener(‘DOMContentLoaded', () => { const buttons = document.querySelectorAll(‘.filter-btn'); const programs = document.querySelectorAll(‘.cue'); const programPlaces = document.querySelectorAll(‘.program-place'); function updateProgramPlaces() { programPlaces.forEach(place => { let nextElement = place.nextElementSibling; let allHidden = true; while (nextElement && nextElement.classList.contains(‘cue')) { if (nextElement.style.display !== ‘none') { allHidden = false; break; } nextElement = nextElement.nextElementSibling; } place.style.display = allHidden ? ‘none' : ‘block'; }); } buttons.forEach(button => { button.addEventListener(‘click', () => { const filter = button.getAttribute(‘data-filter').toLowerCase(); const isActive = button.classList.contains(‘active'); // Reset all buttons and show all programs buttons.forEach(btn => btn.classList.remove(‘active')); programs.forEach(program => program.style.display = ‘block'); programPlaces.forEach(place => place.style.display = ‘block'); if (!isActive) { button.classList.add(‘active'); programs.forEach(program => { const sty = program.getAttribute(‘data-sty').toLowerCase(); if (!sty.includes(filter)) { program.style.display = ‘none'; } }); // Update visibility of program-place elements updateProgramPlaces(); } else { // Reset visibility of program-place elements programPlaces.forEach(place => place.style.display = ‘block'); } }); }); // Initial call to update program places visibility updateProgramPlaces(); });