0:00

70 Reasons to Appreciate Life

70 Reasons to Appreciate Life

`); win.document.close(); win.print(); } // Function to save selected reasons as CSV function saveAsCSV() { const selectedReasons = getSelectedReasons(); if (selectedReasons.length === 0) { alert("Please select at least one reason."); return; } const csvContent = "data:text/csv;charset=utf-8," + selectedReasons.map(reason => `${reason.title},${reason.details.statistic},${reason.details.how},${reason.details.when},${reason.details.insight}`).join("\n"); const encodedUri = encodeURI(csvContent); const link = document.createElement("a"); link.setAttribute("href", encodedUri); link.setAttribute("download", "selected_reasons.csv"); document.body.appendChild(link); link.click(); } // Function to print selected reasons function printSelections() { const selectedReasons = getSelectedReasons(); if (selectedReasons.length === 0) { alert("Please select at least one reason."); return; } const content = selectedReasons.map(reason => `

${reason.title}

Statistic: ${reason.details.statistic}

How to Appreciate: ${reason.details.how}

When to Practice: ${reason.details.when}

Expert Insight: ${reason.details.insight}


`).join(""); const win = window.open("", "_blank"); win.document.write(` Selected Reasons to Appreciate Life

Selected Reasons to Appreciate Life

${content} `); win.document.close(); win.print(); } // Function to get selected reasons function getSelectedReasons() { const checkboxes = document.querySelectorAll(".reason-checkbox:checked"); return Array.from(checkboxes).map(checkbox => { const index = checkbox.id.split("-")[1]; return reasons[index]; }); } // Render reasons on page load renderReasons();

Leave a Reply

Your email address will not be published. Required fields are marked *

`); win.document.close(); win.print(); } // Function to save selected reasons as CSV function saveAsCSV() { const selectedReasons = getSelectedReasons(); if (selectedReasons.length === 0) { alert("Please select at least one reason."); return; } const csvContent = "data:text/csv;charset=utf-8," + selectedReasons.map(reason => `${reason.title},${reason.details.statistic},${reason.details.how},${reason.details.when},${reason.details.insight}`).join("\n"); const encodedUri = encodeURI(csvContent); const link = document.createElement("a"); link.setAttribute("href", encodedUri); link.setAttribute("download", "selected_reasons.csv"); document.body.appendChild(link); link.click(); } // Function to print selected reasons function printSelections() { const selectedReasons = getSelectedReasons(); if (selectedReasons.length === 0) { alert("Please select at least one reason."); return; } const content = selectedReasons.map(reason => `

${reason.title}

Statistic: ${reason.details.statistic}

How to Appreciate: ${reason.details.how}

When to Practice: ${reason.details.when}

Expert Insight: ${reason.details.insight}


`).join(""); const win = window.open("", "_blank"); win.document.write(` Selected Reasons to Appreciate Life

Selected Reasons to Appreciate Life

${content} `); win.document.close(); win.print(); } // Function to get selected reasons function getSelectedReasons() { const checkboxes = document.querySelectorAll(".reason-checkbox:checked"); return Array.from(checkboxes).map(checkbox => { const index = checkbox.id.split("-")[1]; return reasons[index]; }); } // Render reasons on page load renderReasons();