Cursed Object Generator
Details of a cursed object will appear here.
History & Origin: ${cursedObject.history}
`; downloadBtn.style.display = 'block'; // Show download button }); document.getElementById('clearBtn').addEventListener('click', () => { document.getElementById('objectType').value = 'any'; document.getElementById('curseSeverity').value = 'any'; document.getElementById('objectTheme').value = 'any'; document.getElementById('cursedObjectResults').innerHTML = 'Details of a cursed object will appear here.
'; document.getElementById('downloadPdfBtn').style.display = 'none'; // Hide download button }); document.getElementById('downloadPdfBtn').addEventListener('click', () => { const resultsDiv = document.getElementById('cursedObjectResults'); const objectType = resultsDiv.querySelector('p:nth-child(1)').textContent.replace('Object: ', '').trim(); const appearance = resultsDiv.querySelector('p:nth-child(2)').textContent.replace('Appearance & Material: ', '').trim(); const curse = resultsDiv.querySelector('p:nth-child(3)').textContent.replace('Curse: ', '').trim(); const history = resultsDiv.querySelector('p:nth-child(4)').textContent.replace('History & Origin: ', '').trim(); if (!objectType || objectType === 'Details of a cursed object will appear here.') { alert("No cursed object details 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("Cursed Object Details", margin, y); y += 15; // Space after title doc.setFontSize(12); doc.setTextColor(52, 58, 64); // Match text-color variable #343a0 // Add Object Type doc.setFontSize(14); doc.text("Object:", margin, y); y += 8; doc.setFontSize(12); doc.text(objectType, margin, y); y += 10; // Add Appearance doc.setFontSize(14); doc.text("Appearance & Material:", margin, y); y += 8; doc.setFontSize(12); const appearanceLines = doc.splitTextToSize(appearance, maxLineWidth); doc.text(appearanceLines, margin, y); y += (appearanceLines.length * 7) + 10; // Estimate space // Add Curse doc.setFontSize(14); doc.text("Curse:", margin, y); y += 8; doc.setFontSize(12); const curseLines = doc.splitTextToSize(curse, maxLineWidth); doc.text(curseLines, margin, y); y += (curseLines.length * 7) + 10; // Estimate space // Add History doc.setFontSize(14); doc.text("History & Origin:", margin, y); y += 8; doc.setFontSize(12); const historyLines = doc.splitTextToSize(history, maxLineWidth); // Check if history fits and add pages if necessary historyLines.forEach(line => { if (y + 7 > pageHeight - margin) { // Estimate line height + some padding doc.addPage(); y = margin; doc.setFontSize(14); doc.text("History & Origin (cont.):", margin, y); y += 8; doc.setFontSize(12); } doc.text(line, margin, y); y += 7; // Estimate line height }); doc.save('cursed_object_details.pdf'); });Key Features
Eerie Descriptions: Generates creepy and creative descriptions of cursed objects using randomized elements.
Clean White Design: A light, modern theme with a centered layout for a professional and user-friendly experience.
PDF Download: Users can download the generated cursed object details as a PDF with the same color scheme as the tool.
Responsive Layout: Work
Benefits for End Users
Creativity: Provides a fun and creative way to generate eerie cursed object descriptions.
Quick and Easy: Users can generate and download cursed object details in just a few clicks.
Portable Results: The PDF download feature allows users to save and share their cursed object details offline.
User-Friendly: The simple interface and intuitive design make the tool easy to use for everyone.
s seamlessly on all devices, ensuring a great user experience.
