File size: 1,392 Bytes
c755ee4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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();
        }
    };
});