Legal Framework Comparative Analysis Tool

Legal Framework Comparative Analysis Tool

Select a legal topic and two jurisdictions to generate a side-by-side comparison.

Analysis Configuration

Side-by-Side Comparison

Analysis Report

Key Differences Summary

Disclaimer: This tool provides a high-level comparison for informational purposes only and does not constitute legal advice. Laws are complex and subject to change. Consult a qualified attorney for advice on specific legal issues.

${jur1}: ${data.jurisdictions[jur1].Summary}

${jur2}: ${data.jurisdictions[jur2].Summary}

`; document.getElementById('summary-output').innerHTML = summaryHTML; } // --- Tab Navigation --- const tabButtons = document.querySelectorAll('.tab-button'); const tabContents = document.querySelectorAll('.tab-content'); const nextBtn = document.getElementById('next-btn'); const prevBtn = document.getElementById('prev-btn'); const errorMsg = document.getElementById('selection-error'); let currentTab = 1; const totalTabs = 3; function updateDisplay() { tabButtons.forEach(button => button.classList.toggle('active', parseInt(button.dataset.tab) === currentTab)); tabContents.forEach(content => content.classList.toggle('active', parseInt(content.id.split('-')[1]) === currentTab)); prevBtn.style.display = currentTab > 1 ? 'inline-block' : 'none'; nextBtn.style.display = currentTab < totalTabs ? 'inline-block' : 'none'; } nextBtn.addEventListener('click', () => { if (currentTab < totalTabs) { if (currentTab === 1) { if (jur1Select.value === jur2Select.value) { errorMsg.classList.remove('hidden'); return; } errorMsg.classList.add('hidden'); generateComparison(); } currentTab++; updateDisplay(); } }); prevBtn.addEventListener('click', () => { if (currentTab > 1) { currentTab--; updateDisplay(); } }); // --- PDF Download --- const downloadPdfBtn = document.getElementById('download-pdf-btn'); async function downloadPDF() { const { jsPDF } = window.jspdf; const pdfPreview = document.getElementById('pdf-preview'); const container = document.getElementById('pdf-container'); const topic = legalData[topicSelect.value].title; const comparisonContent = document.getElementById('comparison-output').innerHTML; const summaryContent = document.getElementById('summary-output').innerHTML; pdfPreview.innerHTML = `

${topic}

Side-by-Side Comparison

${comparisonContent}

Key Differences Summary

${summaryContent} `; downloadPdfBtn.textContent = 'Generating...'; downloadPdfBtn.disabled = true; container.classList.remove('hidden'); container.style.position = 'absolute'; container.style.left = '-9999px'; container.style.top = '0'; try { const canvas = await html2canvas(pdfPreview, { scale: 2, useCORS: true }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 40; const usableWidth = pdfWidth - margin * 2; const imgScaledHeight = (canvas.height * usableWidth) / canvas.width; let heightLeft = imgScaledHeight; let position = 0; pdf.addImage(imgData, 'PNG', margin, margin, usableWidth, imgScaledHeight); heightLeft -= (pdfHeight - margin * 2); while (heightLeft > 0) { position -= (pdfHeight - margin); pdf.addPage(); pdf.addImage(imgData, 'PNG', margin, position, usableWidth, imgScaledHeight); heightLeft -= pdfHeight; } pdf.save('Legal-Framework-Comparison.pdf'); } catch (error) { console.error("Error generating PDF:", error); } finally { container.classList.add('hidden'); container.style.position = ''; container.style.left = ''; container.style.top = ''; downloadPdfBtn.textContent = 'Download PDF Report'; downloadPdfBtn.disabled = false; pdfPreview.innerHTML = ''; } } downloadPdfBtn.addEventListener('click', downloadPDF); // --- Initial Load --- populateJurisdictionDropdowns(); updateDisplay(); });
Scroll to Top