Funny Fake TV Commercial Generator
Generate a script for an absurd TV commercial!
Your funny fake TV commercial script will appear here!
Main Selling Point: ${commercial.sellingPoint || 'N/A'}
Scenario: ${commercial.scenario}
Script:
${scriptHtml}Slogan: ${commercial.slogan}
Call to Action: ${commercial.callToAction}
`; downloadPdfBtn.style.display = 'block'; // Show download button only on success } }); document.getElementById('clearBtn').addEventListener('click', () => { document.getElementById('productType').value = ''; document.getElementById('targetAudience').value = 'any'; document.getElementById('commercialTone').value = 'any'; document.getElementById('sellingPoint').value = ''; document.getElementById('commercialKeyword').value = ''; document.getElementById('commercialLength').value = 'short'; document.getElementById('commercialResults').innerHTML = 'Your funny fake TV commercial script will appear here!
'; document.getElementById('downloadPdfBtn').style.display = 'none'; // Hide PDF button }); // Download PDF Button document.getElementById('downloadPdfBtn').addEventListener('click', () => { const resultsDiv = document.getElementById('commercialResults'); // Check if results are error message before attempting to get text if (resultsDiv.textContent.includes("Error:") || resultsDiv.textContent.includes('Your funny fake TV commercial script will appear here!')) { alert("No commercial script to download."); return; } const productText = resultsDiv.querySelector('p:nth-child(1)') ? resultsDiv.querySelector('p:nth-child(1)').textContent.replace('Product/Service: ', '').trim() : ''; const audienceText = resultsDiv.querySelector('p:nth-child(2)') ? resultsDiv.querySelector('p:nth-child(2)').textContent.replace('Target Audience: ', '').trim() : ''; const toneText = resultsDiv.querySelector('p:nth-child(3)') ? resultsDiv.querySelector('p:nth-child(3)').textContent.replace('Tone/Style: ', '').trim() : ''; const sellingPointText = resultsDiv.querySelector('p:nth-child(4)') ? resultsDiv.querySelector('p:nth-child(4)').textContent.replace('Main Selling Point: ', '').trim() : ''; const scenarioText = resultsDiv.querySelector('p:nth-child(5)') ? resultsDiv.querySelector('p:nth-child(5)').textContent.replace('Scenario: ', '').trim() : ''; const scriptSegments = resultsDiv.querySelectorAll('.script-segment'); // Get script segments const sloganText = resultsDiv.querySelector('p:nth-child(7)') ? resultsDiv.querySelector('p:nth-child(7)').textContent.replace('Slogan: ', '').trim() : ''; const callToActionText = resultsDiv.querySelector('p:nth-child(8)') ? resultsDiv.querySelector('p:nth-child(8)').textContent.replace('Call to Action: ', '').trim() : ''; if (!productText) { // Should not happen if check passed, but for safety alert("No commercial script to download."); return; } // --- PDF Generation --- const doc = new jsPDF(); const margin = 15; let y = margin; const pageHeight = doc.internal.pageSize.height; const pageWidth = doc.internal.pageSize.width; const maxLineWidth = pageWidth - 2 * margin; // Max width for text line doc.setFontSize(18); doc.setTextColor(52, 58, 64); // Match text-color variable #343a0 doc.text("Fake TV Commercial Script", margin, y); y += 15; // Space after title doc.setFontSize(10); // Smaller font for script content doc.setTextColor(52, 58, 64); // Match text-color variable #343a0 // Add sections const addSection = (title, text) => { if (!text || text.trim() === "") return; doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text(title, margin, y); doc.setFont(undefined, 'normal'); y += 6; doc.setFontSize(10); const textLines = doc.splitTextToSize(text, maxLineWidth); textLines.forEach(line => { if (y + 6 > pageHeight - margin) { doc.addPage(); y = margin; } doc.text(line, margin, y); y += 6; }); y += 8; // Space after section }; addSection("Product/Service:", productText); addSection("Target Audience:", audienceText); addSection("Tone/Style:", toneText); addSection("Main Selling Point:", sellingPointText); addSection("Scenario:", scenarioText); // Add Script Section if (scriptSegments.length > 0) { doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text("Script:", margin, y); doc.setFont(undefined, 'normal'); y += 8; doc.setFontSize(10); scriptSegments.forEach(segmentElement => { const segmentText = segmentElement.textContent.trim(); const segmentLines = doc.splitTextToSize(segmentText, maxLineWidth - 10); // Indent in PDF segmentLines.forEach(line => { if (y + 6 > pageHeight - margin) { // Check space for line doc.addPage(); y = margin; doc.setFontSize(18); doc.setTextColor(52, 58, 64); doc.text("Fake TV Commercial Script (cont.)", margin, y); y += 15; doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text("Script (cont.):", margin, y); doc.setFont(undefined, 'normal'); y += 8; doc.setFontSize(10); } doc.text(line, margin + 10, y); // Indent y += 6; // Estimate line height }); y += 3; // Space between segments }); y += 8; // Space after script block } addSection("Slogan:", sloganText); addSection("Call to Action:", callToActionText); doc.save('fake_tv_commercial.pdf'); });Key Features
Fictional TV Commercials: Generates humorous and absurd TV commercials for fictional products.
Header with Instructions: Includes a header with a title and brief instructions for ease of use.
PDF Download: Allows users to download the generated commercial as a PDF with a consistent color scheme.
Centered Layout: The tool is perfectly centered on the page for a clean and professional look.
Lightweight and Fast: Optimized for performance and works seamlessly in WordPress Elementor HTML blocks.
Benefits for End Users
Entertainment: Provides a fun and creative way to generate humorous TV commercials.
User-Friendly: Simple and intuitive interface ensures ease of use for all users.
Portable Results: The PDF download feature allows users to save and share their commercials effortlessly.
Engaging Design: The tool’s modern design and consistent color scheme enhance the user experience.
Privacy: No personal data is collected, ensuring complete privacy for users.
