Healthy Home Cleaning Product Finder

Choose a cleaning task to find effective, non-toxic commercial products and simple DIY recipes.

What do you need to clean?

${step}

`; }); const resultsHTML = `

${data.title} Guide

DIY Recipe

${data.diy.name}

Ingredients:

    ${ingredientsHTML}

Instructions:

    ${instructionsHTML}

Non-Toxic Product Suggestions

    ${productsHTML}

Brand availability may vary. Look for products with transparent ingredient lists.

Safety Tip

${data.safety}

`; resultsContainer.innerHTML = resultsHTML; resultsContainer.classList.remove('hidden'); document.getElementById('download-pdf-btn').addEventListener('click', downloadPdf); resultsContainer.scrollIntoView({ behavior: 'smooth', block: 'start' }); } function downloadPdf() { if (!selectedTaskKey) return; const data = cleaningData[selectedTaskKey]; const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Header doc.setFontSize(22); doc.setFont('helvetica', 'bold'); doc.text(`Healthy Cleaning Guide`, 105, 20, { align: 'center' }); doc.setFontSize(18); doc.text(data.title, 105, 28, { align: 'center' }); // DIY Recipe Section doc.setFontSize(14); doc.setFont('helvetica', 'bold'); doc.text('DIY Recipe: ' + data.diy.name, 14, 45); doc.setFontSize(12); doc.text('Ingredients:', 14, 55); doc.setFont('helvetica', 'normal'); let yPos = 62; data.diy.ingredients.forEach(ing => { doc.text('• ' + ing, 14, yPos); yPos += 7; }); yPos += 5; doc.setFont('helvetica', 'bold'); doc.text('Instructions:', 14, yPos); yPos += 7; doc.setFont('helvetica', 'normal'); data.diy.instructions.forEach((step, index) => { const textLines = doc.splitTextToSize(step, 170); doc.text(`${index + 1}.`, 14, yPos); doc.text(textLines, 20, yPos); yPos += (textLines.length * 5) + 3; }); // Other sections if (yPos > 200) { doc.addPage(); yPos = 20; } doc.setFontSize(14); doc.setFont('helvetica', 'bold'); doc.text('Non-Toxic Product Suggestions', 14, yPos + 15); const productTable = data.products.map(p => [p]); doc.autoTable({ startY: yPos + 20, head: [['Product Name']], body: productTable, theme: 'striped' }); yPos = doc.autoTable.previous.finalY; doc.setFontSize(14); doc.setFont('helvetica', 'bold'); doc.text('Safety Tip', 14, yPos + 15); doc.setFontSize(11); doc.setFont('helvetica', 'normal'); const safetyLines = doc.splitTextToSize(data.safety, 180); doc.text(safetyLines, 14, yPos + 22); doc.save(`${data.title.replace(' ', '-')}-Cleaning-Guide.pdf`); } // --- EVENT LISTENERS --- taskSelectionContainer.addEventListener('click', (e) => { const taskBtn = e.target.closest('.task-btn'); if (taskBtn) { generateGuide(taskBtn.dataset.taskKey); } }); // --- INITIALIZATION --- populateTaskButtons(); });
Scroll to Top