document.addEventListener('DOMContentLoaded', () => { const startQuizBtn = document.getElementById('startQuizBtn'); const quizSection = document.getElementById('quizSection'); const quizResults = document.getElementById('quizResults'); const quizForm = document.getElementById('quizForm'); const resultText = document.getElementById('resultText'); const downloadGuideBtn = document.getElementById('downloadGuideBtn'); const goToTestLabBtn = document.getElementById('goToTestLabBtn'); const subscribeNewsletterBtn = document.getElementById('subscribeNewsletterBtn'); const qrCodeContainer = document.getElementById('qrCode'); // Placeholder URLs - user can update these later const testLabURL = 'https://www.shetestlab.com'; // #2 testlab website placeholder const newsletterURL = 'https://www.newsletterblog.com'; // #3 newsletter blog placeholder const qrCodeURL = window.location.href + '#quiz'; // QR code links to quiz section on this page // Generate QR code using a simple library or API (using Google Chart API here) function generateQRCode(url) { const qrImg = document.createElement('img'); qrImg.src = `https://chart.googleapis.com/chart?cht=qr&chs=150x150&chl=${encodeURIComponent(url)}`; qrImg.alt = 'QR Code'; qrImg.style.borderRadius = '8px'; return qrImg; } qrCodeContainer.appendChild(generateQRCode(qrCodeURL)); startQuizBtn.addEventListener('click', () => { quizSection.classList.remove('hidden'); window.location.hash = '#quiz'; }); quizForm.addEventListener('submit', (e) => { e.preventDefault(); const formData = new FormData(quizForm); let yesCount = 0; for (let i = 1; i <= 12; i++) { if (formData.get('q' + i) === 'yes') { yesCount++; } } let resultMessage = ''; if (yesCount <= 3) { resultMessage = 'Good news — your adrenals may be in decent shape, but watch for triggers that add emotional labor and stress.'; } else if (yesCount <= 7) { resultMessage = 'Your adrenals could be under strain. Emotional suppression and chronic stress can keep cortisol high. Time to make small changes!'; } else { resultMessage = 'You may have signs of adrenal fatigue or cortisol imbalance. This is your sign to dig deeper, reduce stress triggers, and prioritize your emotional well-being.'; } resultText.textContent = resultMessage; quizSection.classList.add('hidden'); quizResults.classList.remove('hidden'); }); downloadGuideBtn.addEventListener('click', () => { alert('Download link for TheGlowCode.JR Hormones Starter Guide will be provided here.'); }); goToTestLabBtn.addEventListener('click', () => { window.open(testLabURL, '_blank'); }); subscribeNewsletterBtn.addEventListener('click', () => { window.open(newsletterURL, '_blank'); }); });
top of page
bottom of page