Creative Writing Style Checker

Creative Writing Style Checker

Elevate your narrative by analyzing its creative elements.

1. Input Text
2. Creative Analysis
3. Revise & Export

${description}

${content}
`; const createHighlightList = (items) => { if (!items || items.length === 0) return ''; const uniqueItems = [...new Set(items.map(item => item.toLowerCase()))].slice(0, 5); return `
Instances like: ${uniqueItems.map(item => `${item}`).join('')}
`; } // --- PDF UTILITY --- const downloadPDF = () => { const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const title = "Creative Writing Analysis"; const originalText = elements.inputText.value; const revisedText = elements.revisedText.value; const PAGE_WIDTH = pdf.internal.pageSize.getWidth(); const MARGIN = 50; let y = 0; // Header pdf.setFillColor(91, 33, 182); // violet-800 pdf.rect(0, 0, PAGE_WIDTH, 70, 'F'); pdf.setFont('helvetica', 'bold'); pdf.setFontSize(22); pdf.setTextColor(255, 255, 255); pdf.text(title, MARGIN, 45); y = 110; const addSection = (secTitle, secContent) => { if (!secContent || secContent.length === 0) return; if (y > pdf.internal.pageSize.getHeight() - 80) { pdf.addPage(); y = MARGIN; } pdf.setFont('helvetica', 'bold'); pdf.setFontSize(14); pdf.setTextColor(109, 40, 217); // violet-700 pdf.text(secTitle, MARGIN, y); y += 20; pdf.setFont('helvetica', 'normal'); pdf.setFontSize(10); pdf.setTextColor(51, 65, 85); // slate-700 const lines = pdf.splitTextToSize(Array.isArray(secContent) ? secContent.join(', ') : secContent, PAGE_WIDTH - MARGIN * 2); pdf.text(lines, MARGIN, y); y += lines.length * 12 + 25; }; // Add analysis sections const sensoryTotals = Object.values(analysisData.sensory).reduce((acc, arr) => acc + arr.length, 0); addSection("Sensory Details", `Found ${sensoryTotals} sensory words. Sight: ${analysisData.sensory.sight.length}, Sound: ${analysisData.sensory.sound.length}, Smell: ${analysisData.sensory.smell.length}, Touch: ${analysisData.sensory.touch.length}, Taste: ${analysisData.sensory.taste.length}.`); addSection("Figurative Language", `Found ${analysisData.figurative.similes.length} similes and ${analysisData.figurative.metaphors.length} potential metaphors. Examples: ${[...new Set(analysisData.figurative.similes)].slice(0, 2).join(', ')}`); addSection("'Telling' Words", `Found ${analysisData.showDontTell.length} instances to review for 'showing' opportunities. Examples: ${[...new Set(analysisData.showDontTell.map(w=>w.toLowerCase()))].slice(0, 4).join(', ')}`); pdf.addPage(); y = MARGIN; addSection('Original Text', originalText); if (revisedText && revisedText.trim() !== originalText.trim()) { addSection('Revised Text', revisedText); } pdf.save(`Creative_Writing_Analysis.pdf`); }; // --- EVENT LISTENERS --- elements.prevBtn.addEventListener('click', () => nextPrev(-1)); elements.nextBtn.addEventListener('click', () => nextPrev(1)); elements.tabs.forEach((tab, i) => { tab.addEventListener('click', () => console.warn("Direct tab navigation is disabled. Please use Next/Previous buttons.")); }); elements.downloadPdfBtn.addEventListener('click', downloadPDF); // Initialize showTab(currentTab); });
Scroll to Top