Alternate History Generator

Explore fictional timelines based on different historical events and changes.

Your alternate history summary will appear here.

The Alternate Reality: ${alternateHistory.alternateReality}

`; downloadBtn.style.display = 'block'; // Show download button }); document.getElementById('clearBtn').addEventListener('click', () => { document.getElementById('historicalEra').value = 'any'; document.getElementById('changeType').value = 'any'; document.getElementById('impactScale').value = 'local'; document.getElementById('eventKeyword').value = ''; document.getElementById('historyResults').innerHTML = '

Your alternate history summary will appear here.

'; document.getElementById('downloadPdfBtn').style.display = 'none'; // Hide download button }); document.getElementById('downloadPdfBtn').addEventListener('click', () => { const resultsDiv = document.getElementById('historyResults'); const podText = resultsDiv.querySelector('p:nth-child(1)') ? resultsDiv.querySelector('p:nth-child(1)').textContent.replace('Point of Divergence: ', '').trim() : ''; const alternateRealityText = resultsDiv.querySelector('p:nth-child(2)') ? resultsDiv.querySelector('p:nth-child(2)').textContent.replace('The Alternate Reality: ', '').trim() : ''; if (!podText || podText === 'Your alternate history summary will appear here.') { alert("No alternate history 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 #343a40 doc.text("Alternate History Summary", margin, y); y += 15; // Space after title doc.setFontSize(12); doc.setTextColor(52, 58, 64); // Match text-color variable #343a0 // Add Point of Divergence doc.setFontSize(14); doc.text("Point of Divergence:", margin, y); y += 8; doc.setFontSize(12); const podLines = doc.splitTextToSize(podText, maxLineWidth); doc.text(podLines, margin, y); y += (podLines.length * 7) + 10; // Estimate space // Add Alternate Reality doc.setFontSize(14); doc.text("The Alternate Reality:", margin, y); y += 8; doc.setFontSize(12); const realityLines = doc.splitTextToSize(alternateRealityText, maxLineWidth); // Check if reality description fits and add pages if necessary realityLines.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("Alternate History Summary (cont.)", margin, y); y += 15; doc.setFontSize(12); doc.setTextColor(52, 58, 64); } doc.text(line, margin, y); y += 7; // Estimate line height }); doc.save('alternate_history.pdf'); });

Key Features

  1. Creative Scenarios: Generates thought-provoking alternate history scenarios based on user input.

  2. Clean White Design: A light, modern theme with a centered layout for a professional and user-friendly experience.

  3. PDF Download: Users can download the generated alternate history as a PDF with the same color scheme as the tool.

  4. Responsive Layout: Works seamlessly on all devices, ensuring a great user experience.

    Benefits for End Users

    1. Creativity: Provides a fun and creative way to explore alternate history scenarios.

    2. Quick and Easy: Users can generate and download scenarios in just a few clicks.

    3. Portable Results: The PDF download feature allows users to save and share their scenarios offline.

    4. User-Friendly: The simple interface and intuitive design make the tool easy to use for everyone.

Scroll to Top