Impact of Colonization Analyzer

Understanding Colonization's Impacts

Explore Impacts by Domain & Focus

Overview of Long-Term Legacies

No specific impacts found for this combination. Broader categories may contain relevant information.

'; displayArea.style.display = 'block'; } // Update current selections for PDF const domainName = ica_colonizationImpactData.impactDomains.find(d => d.id === selectedDomainId)?.name || 'All Domains'; const typeName = ica_colonizationImpactData.colonialismTypes.find(t => t.id === selectedTypeId)?.name || 'All Focus Types'; ica_currentSelectionsForPdf = { domain: domainName, type: typeName, impacts: filteredImpacts }; document.getElementById('ica_downloadPdfButton').style.display = 'block'; // Ensure visible if on this tab } function ica_populateLegacyContent() { const legacyContainer = document.getElementById('ica_legacyContent'); if (!legacyContainer) return; let html = ''; ica_colonizationImpactData.legacyThemes.forEach(theme => { html += `

${theme.title}

    `; theme.points.forEach(point => { html += `
  • ${point}
  • `; }); html += `
`; }); legacyContainer.innerHTML = html; } // --- PDF Generation --- function ica_getExplorerPdfContent() { const { domain, type, impacts } = ica_currentSelectionsForPdf; let content = []; content.push({ type: 'heading', text: `Impacts of Colonization`, size: 18 }); content.push({ type: 'text', text: `Selected Domain: ${domain}`, size: 12 }); content.push({ type: 'text', text: `Selected Focus: ${type}`, size: 12 }); content.push({ type: 'spacer', height: 10 }); if (impacts.length === 0) { content.push({ type: 'text', text: "No specific impacts listed for this selection.", size: 11 }); } else { impacts.forEach(impact => { const domainObj = ica_colonizationImpactData.impactDomains.find(d => d.id === impact.domain_id); const domainNameForImpact = domainObj ? domainObj.name : impact.domain_id; content.push({ type: 'heading', text: `${impact.title} (Domain: ${domainNameForImpact})`, size: 14, style:'bold' }); content.push({ type: 'text', text: impact.description, size: 10 }); if (impact.examples && impact.examples.length > 0) { //content.push({ type: 'text', text: "Examples:", size: 10, style:'italic' }); impact.examples.forEach(ex => content.push({ type: 'listItem', text: ex, size: 9 })); } content.push({ type: 'spacer', height: 7 }); }); } return content; } function ica_getLegacyPdfContent() { let content = []; content.push({ type: 'heading', text: "Long-Term Legacies of Colonization", size: 18 }); content.push({ type: 'spacer', height: 5 }); ica_colonizationImpactData.legacyThemes.forEach(theme => { content.push({ type: 'heading', text: theme.title, size: 14, style:'bold' }); theme.points.forEach(point => { content.push({ type: 'listItem', text: point, size: 10 }); }); content.push({ type: 'spacer', height: 7 }); }); return content; } function ica_downloadPDF() { const currentTab = document.querySelector('.ica_tab_button.ica_active_tab_button').getAttribute('onclick').match(/'([^']+)'/)[1]; let pdfContentGenerator; let fileName = "Colonization_Impact_Analysis.pdf"; if (currentTab === 'ica_tab_explorer') { pdfContentGenerator = ica_getExplorerPdfContent; fileName = `Colonization_Impacts_${ica_currentSelectionsForPdf.domain.replace(/\s/g,'_')}_${ica_currentSelectionsForPdf.type.replace(/\s/g,'_')}.pdf`; } else if (currentTab === 'ica_tab_legacy') { pdfContentGenerator = ica_getLegacyPdfContent; fileName = "Colonization_LongTerm_Legacies.pdf"; } else if (currentTab === 'ica_tab_intro') { pdfContentGenerator = () => [ { type: 'heading', text: "Introduction to Colonization Impacts", size: 18}, { type: 'text', text: ica_colonizationImpactData.introduction, size: 11} ]; fileName = "Colonization_Impacts_Introduction.pdf"; } else { alert("No content selected for PDF for the current view."); return; } if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { alert('PDF library (jsPDF) is not loaded. Check internet connection.'); return; } const { jsPDF: JSPDF } = window.jspdf; const doc = new JSPDF(); let yPos = 15; const leftMargin = 15; const contentWidth = doc.internal.pageSize.getWidth() - (leftMargin * 2); const contentItems = pdfContentGenerator(); contentItems.forEach(item => { if (yPos > 270 && item.type !== 'spacer') { doc.addPage(); yPos = 15; } switch(item.type) { case 'heading': doc.setFontSize(item.size); doc.setFont(undefined, item.style || 'bold'); const headingLines = doc.splitTextToSize(item.text, contentWidth); doc.text(headingLines, leftMargin, yPos); yPos += (headingLines.length * (item.size * 0.35)) + (item.size * 0.2) + 2; break; case 'text': doc.setFontSize(item.size); doc.setFont(undefined, item.style || 'normal'); const textLines = doc.splitTextToSize(item.text, contentWidth); doc.text(textLines, leftMargin, yPos); yPos += (textLines.length * (item.size * 0.35)) + 3; break; case 'listItem': doc.setFontSize(item.size); doc.setFont(undefined, 'normal'); const itemLines = doc.splitTextToSize(`• ${item.text}`, contentWidth - 5); doc.text(itemLines, leftMargin + 5, yPos); yPos += (itemLines.length * (item.size * 0.35)) + 2; break; case 'spacer': yPos += item.height; break; } }); doc.save(fileName.replace(/[^a-zA-Z0-9_.-]/g, '_')); // Sanitize filename }
Scroll to Top