Monologue Generator
Give your character a voice and a powerful moment.
Character & Scene
The Stage is Set
Define your character's moment to begin.
In the spotlight...
Forgotten Line!
The monologue couldn't be written. Please check the console.
${p}
`).join(''); contentPanel.innerHTML = content; tabContentsContainer.appendChild(contentPanel); }); showTab(0); } function showTab(index) { const tabs = tabsContainer.querySelectorAll('.tab'); const contents = tabContentsContainer.querySelectorAll('.tab-content'); tabs.forEach(tab => tab.classList.remove('active')); contents.forEach(content => content.classList.remove('active')); if(tabs[index]) tabs[index].classList.add('active'); if(contents[index]) contents[index].classList.add('active'); currentTabIndex = index; updateNavButtons(); } function navigateTabs(direction) { const tabs = tabsContainer.querySelectorAll('.tab'); const newIndex = currentTabIndex + direction; if (newIndex >= 0 && newIndex < tabs.length) showTab(newIndex); } function updateNavButtons() { const tabs = tabsContainer.querySelectorAll('.tab'); prevTabBtn.disabled = currentTabIndex === 0; nextTabBtn.disabled = tabs.length - 1; } function generatePdf() { if (!window.jspdf || !latestGeneratedData) { alert("Please generate a monologue before downloading."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'letter' }); const pageHeight = doc.internal.pageSize.getHeight(); const pageWidth = doc.internal.pageSize.getWidth(); const margin = 72; let cursorY = margin; // Header doc.setFont("Tinos", "bold"); doc.setFontSize(24); doc.setTextColor(31, 41, 55); // Slate-800 const title = latestGeneratedData.title || "Untitled Monologue"; doc.text(title, pageWidth / 2, cursorY, { align: 'center' }); cursorY += 20; doc.setFont("Inter", "normal"); doc.setFontSize(10); doc.setTextColor(100, 116, 139); // Slate-500 doc.text(`A Monologue`, pageWidth / 2, cursorY, { align: 'center' }); cursorY += 40; // Body doc.setFont("Tinos", "normal"); doc.setFontSize(12); doc.setTextColor(31, 41, 55); // Slate-800 const monologueText = latestGeneratedData.full_monologue.replace(/\n/g, '\n\n'); const textLines = doc.splitTextToSize(monologueText, pageWidth - margin * 2); doc.text(textLines, margin, cursorY, { lineHeightFactor: 1.6 }); // Footer const pageNumber = '1'; doc.setFontSize(10); doc.text(pageNumber, pageWidth - margin, pageHeight - margin + 20); const safeFileName = (latestGeneratedData.title || 'monologue').replace(/[^a-z0-9]/gi, '_').toLowerCase(); doc.save(`${safeFileName}.pdf`); } setUIState('placeholder'); });