Visual Analysis Template Generator

Visual Analysis Template Generator

ArticulateEye

Visual Analysis Template Generator
Artwork & Context
Select Analysis Sections

Artwork: ${data.title}
Artist: ${data.artist}
Year/Period: ${data.year}
Medium: ${data.medium}
Date Prepared: ${new Date().toLocaleDateString('en-US')}

`; // 2. Specific Focus html += `
Specific Focus / Key Questions
`; html += `
${data.focus}
`; // 3. Analysis Sections data.selectedSections.forEach(section => { html += `
${section.title}
`; if (section.questions && section.questions.length > 0) { html += `
Guiding Questions:
`; html += `
    `; section.questions.forEach(q => { html += `
  • ${q}
  • `; }); html += `
`; } html += `
Your Analysis:
`; html += `
`; // Placeholder for user input }); // 4. Custom Sections data.customSections.forEach((customTitle, index) => { const sectionNum = data.selectedSections.length + index + 1; html += `
${romanize(sectionNum)}. ${customTitle}
`; html += `
Your Analysis:
`; html += `
`; }); container.innerHTML = html; } function vatgSwitchTab(tabId) { document.querySelectorAll('.vatg-tab-btn').forEach(b => b.classList.remove('active')); document.querySelectorAll('.vatg-content').forEach(c => c.classList.remove('active')); const idx = tabId === 'builder' ? 0 : 1; document.querySelectorAll('.vatg-tab-btn')[idx].classList.add('active'); document.getElementById('vatg-' + tabId).classList.add('active'); if (tabId === 'preview') { vatgRenderTemplate(); } } function vatgLoadExample() { if(!confirm("Overwrite current inputs with example data?")) return; document.getElementById('inp-title').value = "Guernica"; document.getElementById('inp-artist').value = "Pablo Picasso"; document.getElementById('inp-year').value = "1937 / Cubism"; document.getElementById('inp-medium').value = "Oil on canvas"; document.getElementById('inp-focus').value = "Analyze how Picasso uses cubist techniques and symbolism to convey the horrors of war and the suffering of civilians."; // Check all default checkboxes ANALYSIS_SECTIONS.forEach(section => { document.getElementById(`chk-${section.id}`).checked = true; }); document.getElementById('inp-custom-sections').value = "Emotional Impact\nArt Historical Significance"; vatgRenderTemplate(); vatgSwitchTab('preview'); } // Helper for Roman Numerals function romanize(num) { if (isNaN(num)) return num; var digits = String(+num).split(""), key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM", "","X","XX","XXX","XL","L","LX","LXX","LXXX","XC", "","I","II","III","IV","V","VI","VII","VIII","IX"], roman = "", i = 3; while (i--) roman = (key[+digits.pop() + (i * 10)] || "") + roman; return Array(+digits.join("") + 1).join("M") + roman; } /* --- PDF Generation --- */ async function vatgGeneratePDF() { vatgRenderTemplate(); // Ensure template is updated const data = vatgGetData(); const { jsPDF } = window.jspdf; const doc = new jsPDF('p', 'mm', 'a4'); const purple = [106, 5, 173]; // Deep Purple const gray = [51, 51, 51]; let y = 20; // 1. Header doc.setFillColor(...purple); doc.rect(0, 0, 210, 20, 'F'); doc.setTextColor(255, 255, 255); doc.setFontSize(16); doc.text(`Visual Analysis Template`, 14, 13); // 2. Artwork Metadata doc.setTextColor(0, 0, 0); doc.setFontSize(12); doc.setFont("helvetica", "bold"); doc.text(data.title.toUpperCase(), 14, y + 10); doc.setFontSize(10); doc.setFont("helvetica", "normal"); doc.text(`Artist: ${data.artist} | Year/Period: ${data.year} | Medium: ${data.medium}`, 14, y + 16); doc.text(`Date Prepared: ${new Date().toLocaleDateString('en-US')}`, 14, y + 21); y += 40; // 3. Specific Focus if (y > 270) { doc.addPage(); y = 20; } doc.setFont("helvetica", "bold"); doc.setTextColor(...purple); doc.setFontSize(12); doc.text("Specific Focus / Key Questions", 14, y); y += 6; doc.setFont("helvetica", "italic"); doc.setTextColor(50, 50, 50); const splitFocus = doc.splitTextToSize(data.focus, 180); doc.text(splitFocus, 14, y); y += (splitFocus.length * 5) + 10; // 4. Analysis Sections let sectionCounter = 0; const addSectionToPDF = (title, questions, currentY) => { if (currentY > 260) { doc.addPage(); currentY = 20; } doc.setFont("helvetica", "bold"); doc.setTextColor(...purple); doc.setFontSize(12); doc.text(title, 14, currentY); currentY += 6; if (questions && questions.length > 0) { doc.setFont("helvetica", "normal"); doc.setTextColor(70, 70, 70); doc.setFontSize(9); const qHeader = doc.splitTextToSize("Guiding Questions:", 180); doc.text(qHeader, 18, currentY); currentY += (qHeader.length * 4); questions.forEach(q => { const splitQ = doc.splitTextToSize(`- ${q}`, 175); doc.text(splitQ, 20, currentY); currentY += (splitQ.length * 4); }); currentY += 5; } doc.setFont("helvetica", "bold"); doc.setTextColor(gray); doc.setFontSize(10); doc.text("Your Analysis:", 14, currentY); currentY += 4; doc.setDrawColor(200); doc.rect(14, currentY, 182, 40, 'D'); // Analysis placeholder box currentY += 45; return currentY; }; data.selectedSections.forEach(section => { sectionCounter++; y = addSectionToPDF(`${romanize(sectionCounter)}. ${section.title}`, section.questions, y); }); data.customSections.forEach(customTitle => { sectionCounter++; y = addSectionToPDF(`${romanize(sectionCounter)}. ${customTitle}`, null, y); }); doc.save(`VisualAnalysis_${data.title.replace(/\s/g, '_')}.pdf`); }
Scroll to Top