Cognitive Behavioral Therapy (CBT) Journal

CBT Thought Record

Identify, challenge, and reframe your automatic negative thoughts.

Step 1: Describe the Situation

What event triggered the negative thought? Who were you with? Where were you? When did it happen?

Thought: ${entry.thought}

`; journalEntriesEl.appendChild(entryDiv); }); } }; const deleteEntry = (id) => { if (confirm('Are you sure you want to delete this entry?')) { state.journal = state.journal.filter(entry => entry.id !== id); saveStateToLocalStorage(); renderJournalEntries(); } }; const generatePdf = () => { const { jsPDF } = window.jspdf; const pdf = new jsPDF('p', 'mm', 'a4'); const pageW = pdf.internal.pageSize.getWidth(); const margin = 15; let y = 0; pdf.setFillColor('#1d4ed8').rect(0, 0, pageW, 30, 'F'); pdf.setFontSize(22).setFont('helvetica', 'bold').setTextColor('#FFFFFF').text('CBT Thought Record Journal', pageW / 2, 18, { align: 'center' }); y = 40; state.journal.forEach((entry, index) => { if (index > 0) { pdf.setDrawColor('#e5e7eb').line(margin, y, pageW - margin, y); y += 10; } if (y > 250) { pdf.addPage(); y = 20; } pdf.setFontSize(12).setFont('helvetica', 'bold').setTextColor('#1f2937').text(`Entry: ${entry.date}`, margin, y); y += 8; const addSection = (title, content) => { if (!content || content.length === 0) return; if (y > 260) { pdf.addPage(); y = 20; } pdf.setFontSize(10).setFont('helvetica', 'bold').setTextColor('#1d4ed8').text(title, margin, y); y += 5; pdf.setFontSize(9).setFont('helvetica', 'normal').setTextColor('#374151'); const lines = pdf.splitTextToSize(content, pageW - margin * 2); pdf.text(lines, margin, y); y += lines.length * 4 + 4; }; addSection('Situation:', entry.situation); addSection('Automatic Thought(s):', entry.thought); addSection('Cognitive Distortions:', entry.distortions.join(', ')); addSection('Evidence For:', entry.evidence_for); addSection('Evidence Against:', entry.evidence_against); addSection('Alternative/Balanced Thought:', entry.reframe); }); pdf.save('CBT-Journal.pdf'); }; // --- EVENT LISTENERS --- prevBtn.addEventListener('click', () => handleNavigation(-1)); nextBtn.addEventListener('click', () => handleNavigation(1)); saveEntryBtn.addEventListener('click', saveEntry); journalEntriesEl.addEventListener('click', (e) => { if (e.target.classList.contains('delete-btn')) { deleteEntry(parseInt(e.target.dataset.id)); } }); document.getElementById('download-pdf-btn').addEventListener('click', generatePdf); // --- INITIALIZATION --- emotions.forEach(e => createEmotionSlider(e, 'emotions-list')); emotions.forEach(e => createEmotionSlider(e, 'emotions-rerate-list')); distortions.forEach(d => createDistortionCheckbox(d)); loadStateFromLocalStorage(); updateView(); });
Scroll to Top