⚠️ Disclaimer: This meal planner is for educational purposes only and should not replace professional medical or nutritional advice. Consult with a healthcare provider before making significant dietary changes. This tool is not affiliated with Eat This Much or any other meal planning service.
`;
printWindow.document.write(printHTML);
printWindow.document.close();
// Wait for content to load then print
printWindow.onload = function() {
setTimeout(() => {
printWindow.print();
printWindow.close();
// Reset button state
button.innerHTML = originalText;
button.disabled = false;
}, 500);
};
}
// Check for auto-generate parameter on page load
window.addEventListener('load', function() {
loadSavedData();
// Check URL parameters for shared plan
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('autoGenerate') === 'true') {
// Load parameters into form
urlParams.forEach((value, key) => {
if (key === 'allergens' && value) {
const allergens = value.split(',');
allergens.forEach(allergen => {
const checkbox = document.getElementById(allergen);
if (checkbox) checkbox.checked = true;
});
} else if (key !== 'autoGenerate') {
const element = document.getElementById(key);
if (element) element.value = value;
}
});
// Auto-generate the plan
setTimeout(() => {
generatePlan();
}, 500);
}
});function resetForm() {
// Clear localStorage
localStorage.removeItem('mediterraneanPlannerData');
// Reset form to defaults
document.getElementById('age').value = '30';
document.getElementById('sex').value = 'female';
document.getElementById('height').value = '170';
document.getElementById('weight').value = '70';
document.getElementById('activity').value = '1.55';
document.getElementById('goal').value = '0';
document.getElementById('planLength').value = '7';
document.getElementById('mealsPerDay').value = '4';
document.getElementById('macroStyle').value = 'balanced';
document.getElementById('dietaryStyle').value = 'omnivore';
// Uncheck all allergen checkboxes
document.querySelectorAll('input[type="checkbox"]').forEach(cb => {
cb.checked = false;
});
// Hide plan
document.getElementById('plan-content').classList.add('hidden');
document.getElementById('no-plan').classList.remove('hidden');
document.getElementById('plan-actions').style.display = 'none';
}