`;
// Highlight current month in timeline
const currentMonth = today.getMonth() + 1;
const timelineNodes = document.querySelectorAll('[data-month]');
timelineNodes.forEach(node => {
const nodeMonth = parseInt(node.dataset.month);
if (currentMonth >= nodeMonth && currentMonth <= nodeMonth + 1) {
const marker = node.querySelector('[id^="node-"]');
if (marker) {
marker.innerHTML = `
${marker.querySelector('span').textContent}
`;
}
}
});
// Tab functionality
const tabButtons = document.querySelectorAll('.tab-btn');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', () => {
const targetTab = button.dataset.tab;
// Update buttons
tabButtons.forEach(btn => {
btn.classList.remove('active', 'border-purple-600', 'text-purple-600');
btn.classList.add('border-transparent', 'text-gray-500');
});
button.classList.add('active', 'border-purple-600', 'text-purple-600');
button.classList.remove('border-transparent', 'text-gray-500');
// Update content
tabContents.forEach(content => {
content.classList.add('hidden');
});
document.getElementById(targetTab).classList.remove('hidden');
});
});
// Checklist functionality with localStorage
const checkboxes = document.querySelectorAll('.hurricane-check');
// Load saved state
const savedChecklist = JSON.parse(localStorage.getItem('hurricaneChecklist') || '{}');
checkboxes.forEach((checkbox, index) => {
checkbox.checked = savedChecklist[`item-${index}`] || false;
});
// Save state on change
checkboxes.forEach((checkbox, index) => {
checkbox.addEventListener('change', () => {
const checklist = JSON.parse(localStorage.getItem('hurricaneChecklist') || '{}');
checklist[`item-${index}`] = checkbox.checked;
localStorage.setItem('hurricaneChecklist', JSON.stringify(checklist));
});
});