Story Continuity Checker

Story Continuity Checker

Keep your narrative consistent from start to finish.

${s.name}: ${s.details}

`; }); } if(data.plotPoints.length > 0) { html += `

Plot Points

`; data.plotPoints.forEach(p => { html += `

${p.title}: ${p.details}

`; }); } document.getElementById('generated-bible-content').innerHTML = html; }; const downloadPdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' }); const data = getBibleData(); const pageW = doc.internal.pageSize.getWidth(); const pageH = doc.internal.pageSize.getHeight(); const margin = 20; let y = 0, pageNum = 1; const primaryColor = '#78350f'; // amber-900 const textColor = '#44403c'; // stone-700 const addHeaderFooter = () => { if (pageNum > 1) { doc.setFontSize(9).setTextColor('#a8a29e'); // stone-400 doc.text(data.title, margin, 10); doc.text(`Page ${pageNum}`, pageW - margin, pageH - 10, { align: 'right' }); } }; // Title Page doc.setFont('times', 'bold').setFontSize(30).setTextColor(primaryColor).text(data.title, pageW / 2, pageH / 2 - 15, { align: 'center' }); doc.setFont('times', 'normal').setFontSize(20).setTextColor(textColor).text('Story Continuity Bible', pageW / 2, pageH / 2, { align: 'center' }); if(data.author) doc.setFontSize(14).text(`By ${data.author}`, pageW / 2, pageH / 2 + 15, { align: 'center' }); // Content Pages doc.addPage(); pageNum++; addHeaderFooter(); y = margin + 10; const addSection = (title, items) => { if (items.length === 0) return; if (y > pageH - margin * 3) { doc.addPage(); pageNum++; addHeaderFooter(); y = margin + 10; } doc.setFont('helvetica', 'bold').setFontSize(18).setTextColor(primaryColor).text(title, margin, y); y += 10; items.forEach(item => { const name = item.name || item.title; const details = item.details; const detailLines = doc.setFont('helvetica', 'normal').setFontSize(10).setTextColor(textColor).splitTextToSize(details, pageW - margin * 2); const requiredHeight = 8 + (detailLines.length * 5); if (y + requiredHeight > pageH - margin) { doc.addPage(); pageNum++; addHeaderFooter(); y = margin + 10; } doc.setFont('helvetica', 'bold').setFontSize(12).setTextColor(textColor).text(name, margin, y); y += 6; doc.setFont('helvetica', 'normal').setFontSize(10).text(detailLines, margin, y); y += (detailLines.length * 5) + 5; }); }; addSection('Characters', data.characters); addSection('Settings', data.settings); addSection('Plot Points', data.plotPoints); doc.save(`${data.title.replace(/\s+/g, '-')}-Continuity-Bible.pdf`); }; downloadPdfBtn.addEventListener('click', downloadPdf); // Initialize addDynamicElement('character'); addDynamicElement('setting'); addDynamicElement('plot-point'); updateTabUI(0); lucide.createIcons(); });
Scroll to Top