📦 EqualifyEverything / equalify-v2-dashboard-mocks

📄 script.js · 33 lines
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
33function toggleAllTableCheckboxes(source) {
    const checkboxes = document.querySelectorAll('.row-checkbox');
    checkboxes.forEach(checkbox => checkbox.checked = source.checked);
    toggleEditOptions();
}

function toggleEditOptions() {
    const checkboxes = document.querySelectorAll('.row-checkbox');
    const editOptions = document.getElementById('edit-options');
    const anyChecked = Array.from(checkboxes).some(checkbox => checkbox.checked);
    editOptions.style.display = anyChecked ? 'block' : 'none';
}

document.addEventListener('DOMContentLoaded', () => {
    const toggleButton = document.getElementById('toggle-navigation');
    const mainNav = document.getElementById('main-navigation');

    if (!toggleButton || !mainNav) {
        console.error('Toggle button or main navigation not found!');
        return;
    }

    toggleButton.addEventListener('click', () => {
        const isExpanded = toggleButton.getAttribute('aria-expanded') === 'true';

        // Toggle visibility
        mainNav.hidden = !mainNav.hidden; // Switch between hidden and visible
        toggleButton.setAttribute('aria-expanded', !isExpanded);

        // Update button text
        toggleButton.textContent = isExpanded ? 'Show Navigation' : 'Hide Navigation';
    });
});