Pollen Count & Allergy Forecast Tool Pollen Count & Allergy Forecast Tool 1. Set Location 2. Allergy Forecast Enter Your Location Enter a city and state to generate a simulated allergy forecast. Get Forecast Please enter a location. Enter a location on the previous tab to see your forecast. This report was generated for informational purposes only and is not a medical diagnosis. `; pdfContentContainer.innerHTML = pdfHTML; pdfContentContainer.classList.remove('hidden'); pdfContentContainer.style.position = 'absolute'; pdfContentContainer.style.left = '-9999px'; try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfContentContainer, { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save(`Allergy-Forecast-${data.location.replace(/, /g, '-')}.pdf`); } catch (error) { console.error("Failed to generate PDF:", error); } finally { pdfContentContainer.classList.add('hidden'); pdfContentContainer.style.position = ''; pdfContentContainer.style.left = ''; } }; // --- EVENT LISTENERS --- getForecastBtn.addEventListener('click', () => { if (locationInput.value.trim() === '') { locationError.classList.remove('hidden'); } else { locationError.classList.add('hidden'); const forecastData = generateSimulatedForecast(); displayForecast(forecastData); tabBtn2.disabled = false; changeTab(2); } }); tabBtn1.addEventListener('click', () => changeTab(1)); // Allow clicking tab 2 only if it's not disabled tabBtn2.addEventListener('click', () => { if (!tabBtn2.disabled) { changeTab(2); } }); });