Spaces:
Running
Running
| document.addEventListener('DOMContentLoaded', () => { | |
| // Current item tracking | |
| let currentItemIndex = 0; | |
| const agendaItems = document.querySelectorAll('.agenda-item'); | |
| function updateCurrentItem() { | |
| agendaItems.forEach((item, index) => { | |
| item.classList.remove('current-item'); | |
| if (index === currentItemIndex) { | |
| item.classList.add('current-item'); | |
| item.scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| } | |
| }); | |
| } | |
| // Initialize | |
| updateCurrentItem(); | |
| // Expose functions to components | |
| window.agendaControls = { | |
| nextItem: () => { | |
| if (currentItemIndex < agendaItems.length - 1) { | |
| currentItemIndex++; | |
| updateCurrentItem(); | |
| } | |
| }, | |
| prevItem: () => { | |
| if (currentItemIndex > 0) { | |
| currentItemIndex--; | |
| updateCurrentItem(); | |
| } | |
| }, | |
| resetAgenda: () => { | |
| currentItemIndex = 0; | |
| document.querySelectorAll('.agenda-item').forEach(item => { | |
| item.classList.remove('item-completed'); | |
| const checkbox = item.querySelector('input[type="checkbox"]'); | |
| if (checkbox) checkbox.checked = false; | |
| }); | |
| updateCurrentItem(); | |
| } | |
| }; | |
| }); |