Virtual Superhero Sidekick Generator

Create a profile for a virtual sidekick based on different characteristics!

Your virtual superhero sidekick profile will appear here!

Origin Story: ${sidekickProfile.origin}

Personality: ${sidekickProfile.personality}

Appearance: ${sidekickProfile.appearance}

Dynamic with Hero: ${sidekickProfile.dynamic}

`; downloadPdfBtn.style.display = 'block'; // Show download button only on success } }); document.getElementById('clearBtn').addEventListener('click', () => { document.getElementById('heroType').value = 'any'; document.getElementById('sidekickRole').value = 'any'; document.getElementById('powerSource').value = 'any'; document.getElementById('personalityFocus').value = 'any'; document.getElementById('sidekickKeyword').value = ''; document.getElementById('sidekickResults').innerHTML = '

Your virtual superhero sidekick profile will appear here!

'; document.getElementById('downloadPdfBtn').style.display = 'none'; // Hide PDF button }); // Download PDF Button document.getElementById('downloadPdfBtn').addEventListener('click', () => { const resultsDiv = document.getElementById('sidekickResults'); // Check if results are error message before attempting to get profile text if (resultsDiv.textContent.includes("Error:") || resultsDiv.textContent.includes("Your virtual superhero sidekick profile will appear here!")) { alert("No sidekick profile to download."); return; } const nameText = resultsDiv.querySelector('p:nth-child(1)') ? resultsDiv.querySelector('p:nth-child(1)').textContent.replace('Sidekick Name: ', '').trim() : ''; const powersText = resultsDiv.querySelector('p:nth-child(2)') ? resultsDiv.querySelector('p:nth-child(2)').textContent.replace('Powers/Abilities: ', '').trim() : ''; const originText = resultsDiv.querySelector('p:nth-child(3)') ? resultsDiv.querySelector('p:nth-child(3)').textContent.replace('Origin Story: ', '').trim() : ''; const personalityText = resultsDiv.querySelector('p:nth-child(4)') ? resultsDiv.querySelector('p:nth-child(4)').textContent.replace('Personality: ', '').trim() : ''; const appearanceText = resultsDiv.querySelector('p:nth-child(5)') ? resultsDiv.querySelector('p:nth-child(5)').textContent.replace('Appearance: ', '').trim() : ''; const dynamicText = resultsDiv.querySelector('p:nth-child(6)') ? resultsDiv.querySelector('p:nth-child(6)').textContent.replace('Dynamic with Hero: ', '').trim() : ''; if (!nameText) { // Should not happen if check passed, but for safety alert("No sidekick profile 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("Superhero Sidekick Profile", margin, y); y += 15; // Space after title doc.setFontSize(12); doc.setTextColor(52, 58, 64); // Match text-color variable #343a0 // Add Name doc.setFontSize(14); doc.text("Sidekick Name:", margin, y); y += 8; doc.setFontSize(12); doc.text(nameText, margin, y); y += 10; // Add Powers doc.setFontSize(14); doc.text("Powers/Abilities:", margin, y); y += 8; doc.setFontSize(12); const powersLines = doc.splitTextToSize(powersText, maxLineWidth); doc.text(powersLines, margin, y); y += (powersLines.length * 7) + 10; // Add Origin doc.setFontSize(14); doc.text("Origin Story:", margin, y); y += 8; doc.setFontSize(12); const originLines = doc.splitTextToSize(originText, maxLineWidth); doc.text(originLines, margin, y); y += (originLines.length * 7) + 10; // Add Personality doc.setFontSize(14); doc.text("Personality:", margin, y); y += 8; doc.setFontSize(12); const personalityLines = doc.splitTextToSize(personalityText, maxLineWidth); doc.text(personalityLines, margin, y); y += (personalityLines.length * 7) + 10; // Add Appearance doc.setFontSize(14); doc.text("Appearance:", margin, y); y += 8; doc.setFontSize(12); const appearanceLines = doc.splitTextToSize(appearanceText, maxLineWidth); doc.text(appearanceLines, margin, y); y += (appearanceLines.length * 7) + 10; // Add Dynamic doc.setFontSize(14); doc.text("Dynamic with Hero:", margin, y); y += 8; doc.setFontSize(12); const dynamicLines = doc.splitTextToSize(dynamicText, maxLineWidth); // Check if dynamic fits and add pages if necessary dynamicLines.forEach(line => { if (y + 7 > pageHeight - margin) { // Estimate line height + padding doc.addPage(); y = margin; doc.setFontSize(18); doc.setTextColor(52, 58, 64); doc.text("Superhero Sidekick Profile (cont.)", margin, y); y += 15; doc.setFontSize(14); doc.text("Dynamic with Hero (cont.):", margin, y); y += 8; doc.setFontSize(12); } doc.text(line, margin, y); y += 7; // Estimate line height }); doc.save('sidekick_profile.pdf'); });

Key Features:

  1. Customizable Inputs: Users can input sidekick name, superpower, and personality to generate unique sidekick profiles.

  2. AI-Generated Profiles: The tool creates vivid and imaginative sidekick profiles based on user inputs.

  3. Centered Design: The tool is perfectly centered on the page, ensuring a clean and professional look.

  4. PDF Download: Users can download the generated sidekick profile as a PDF, complete with the same color scheme for consistency.

  5. Responsive Design: The tool is fully responsive and works seamlessly on all devices.

    Benefits for End Users:

    1. Creative Fun: Users can generate unique and imaginative superhero sidekicks for entertainment or personal projects.

    2. Customizable Outputs: The tool allows users to tailor the generated sidekick profiles based on specific traits.

    3. Educational Tool: Great for students and educators to explore creativity and storytelling concepts.

    4. Portable Results: The PDF download feature allows users to save and share their generated sidekick profiles easily.

    5. User-Friendly Interface: The simple and intuitive design ensures that users of all ages and technical skill levels can use the tool effortlessly.

Scroll to Top