Holistic Weight Gain & Muscle Building Guide

Holistic Weight Gain & Muscle Building Guide

Set Your Foundation

Define your starting point and your target to create a personalized plan.

Fats

${calculatedMacros.fat}g

`; }; const renderActionPlan = () => { const mealContainer = document.getElementById('sample-meal-plan'); const workoutContainer = document.getElementById('sample-workout-plan'); mealContainer.innerHTML = `

Sample Meal Structure

Breakfast: ${sampleData.meals.breakfast}
Lunch: ${sampleData.meals.lunch}
Dinner: ${sampleData.meals.dinner}
Snacks: ${sampleData.meals.snacks}
`; let workoutHtml = `

Sample 3-Day Workout Split

`; workoutHtml += Object.entries(sampleData.workouts).map(([day, exercises]) => `

${day}

    ${exercises.map(ex => `
  • ${ex}
  • `).join('')}
`).join(''); workoutContainer.innerHTML = workoutHtml; }; const generateGuide = () => { userSelections = { name: document.getElementById('name-input').value || 'Your', currentWeight: document.getElementById('current-weight').value, goalWeight: document.getElementById('goal-weight').value, weeklyGainText: document.getElementById('weekly-gain').options[document.getElementById('weekly-gain').selectedIndex].text }; renderGuide(); switchTab('guide'); }; const renderGuide = () => { const guideOutput = document.getElementById('guide-output'); const guideButtons = document.getElementById('guide-buttons'); guideOutput.innerHTML = `

${userSelections.name} Personalized Guide

Your roadmap to gaining weight and building muscle.

Current Weight

${userSelections.currentWeight} lbs

Goal Weight

${userSelections.goalWeight} lbs

Target Gain

${userSelections.weeklyGainText.split(' ')[1]}

${document.getElementById('macro-results').innerHTML}
${document.getElementById('sample-meal-plan').innerHTML}
${document.getElementById('sample-workout-plan').innerHTML}
`; guideButtons.classList.remove('hidden'); }; const downloadPDF = () => { const pdfContent = document.getElementById('pdf-content'); window.html2canvas(pdfContent, { scale: 2, backgroundColor: '#ffffff' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfMargin = 40; const contentWidth = pdfWidth - (pdfMargin * 2); const imgHeight = canvas.height * contentWidth / canvas.width; pdf.addImage(imgData, 'PNG', pdfMargin, pdfMargin, contentWidth, imgHeight); pdf.save(`${userSelections.name.replace(/\s/g, '_')}_Muscle_Building_Guide.pdf`); }); }; window.navigateTabs = (direction) => { const currentActive = document.querySelector('.tab-btn.active'); const tabs = ['goals', 'macros', 'plan', 'guide']; let currentIndex = tabs.findIndex(t => `tab-${t}-btn` === currentActive.id); if (direction === 'next') { if (currentIndex === 0) { // Moving from Goals to Macros if (!calculateMacros()) return; // Stop if validation fails renderMacros(); } if (currentIndex === 1) { // Moving from Macros to Plan renderActionPlan(); } if (currentIndex < tabs.length - 1) { switchTab(tabs[currentIndex + 1]); } } else if (direction === 'prev' && currentIndex > 0) { switchTab(tabs[currentIndex - 1]); } }; window.switchTab = (tabId) => { const tabs = ['goals', 'macros', 'plan', 'guide']; const buttons = { next: document.getElementById('next-btn'), prev: document.getElementById('prev-btn'), generate: document.getElementById('generate-guide-btn') }; tabs.forEach(id => { document.getElementById(`${id}-tab`).style.display = (id === tabId) ? 'block' : 'none'; document.getElementById(`tab-${id}-btn`).classList.toggle('active', id === tabId); }); buttons.prev.disabled = (tabId === 'goals'); buttons.next.style.display = (tabId === 'plan' || tabId === 'guide') ? 'none' : 'inline-block'; buttons.generate.style.display = (tabId === 'plan') ? 'inline-block' : 'none'; if (tabId === 'guide') { document.getElementById('tab-guide-btn').disabled = false; } }; initialize(); });
Scroll to Top