Comedy Story Idea Generator
Enter a few wacky details to cook up a hilarious story concept.
The Setup
The Stage is Empty...
Give us a prompt and we'll write the opening act!
Warming up the laugh track...
Heckler in the Audience!
The story couldn't be generated. Please check the console.
No content available.
'; } } 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 newIndex = currentTabIndex + direction; if (newIndex >= 0 && newIndex < tabConfig.length) showTab(newIndex); } function updateNavButtons() { prevTabBtn.disabled = currentTabIndex === 0; nextTabBtn.disabled = currentTabIndex === tabConfig.length - 1; } function generatePdf() { if (!window.jspdf || !latestGeneratedData) { alert("Please generate an idea before downloading."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pageHeight = doc.internal.pageSize.getHeight(); const pageWidth = doc.internal.pageSize.getWidth(); const margin = 50; const contentWidth = pageWidth - margin * 2; let cursorY = 0; // Draw "notebook paper" lines doc.setDrawColor(226, 232, 240); // Slate-200 for(let i = margin + 20; i < pageHeight - margin; i += 20) { doc.line(margin, i, pageWidth - margin, i); } // Header cursorY = margin + 10; doc.setFont("Bangers", "normal"); doc.setFontSize(32); doc.setTextColor(22, 163, 74); // Green-600 const title = latestGeneratedData.title || "My Awesome Comedy Idea"; const titleLines = doc.splitTextToSize(title, contentWidth); doc.text(titleLines, margin, cursorY); cursorY += (titleLines.length * 30) + 10; const drawSection = (title, content) => { if (!content) return; doc.setFont("Inter", "bold"); doc.setFontSize(12); doc.setTextColor(234, 88, 12); // Orange-600 const titleHeight = doc.getTextDimensions(title).h; if (cursorY + titleHeight + 20 > pageHeight - margin) { doc.addPage(); cursorY = margin; } doc.text(title, margin, cursorY); cursorY += titleHeight + 5; doc.setFont("Inter", "normal"); doc.setFontSize(10); doc.setTextColor(51, 65, 85); // Slate-700 let contentLines; if (Array.isArray(content)) { contentLines = doc.splitTextToSize(content.map(c => `- ${c}`).join('\n'), contentWidth); } else { contentLines = doc.splitTextToSize(content, contentWidth); } const contentHeight = contentLines.length * 12; if (cursorY + contentHeight > pageHeight - margin) { doc.addPage(); cursorY = margin; } doc.text(contentLines, margin + 5, cursorY); cursorY += contentHeight + 25; }; drawSection("Logline:", latestGeneratedData.logline); drawSection("Synopsis:", latestGeneratedData.synopsis); drawSection("The Hero (Unfortunately):", latestGeneratedData.main_character); drawSection("How It Gets Worse:", latestGeneratedData.comedic_escalation); drawSection("Opening Scene:", latestGeneratedData.opening_scene); const safeFileName = (latestGeneratedData.title || 'comedy_idea').replace(/[^a-z0-9]/gi, '_').toLowerCase(); doc.save(`${safeFileName}_idea.pdf`); } setUIState('placeholder'); });