History Research Report Writer

History Research Report Writer

Craft well-structured historical arguments with sources and timelines.

Core Topic Information


Primary Sources

Secondary Sources

Timeline of Key Events


Historical Analysis / Argument

Draft Research Report

Date: September 18, 2025


Introduction & Thesis

${thesis}

Historical Analysis

${analysis}

`; if (timeline.length > 0) { reportHTML += `

Chronology of Key Events

    `; timeline.forEach(t => { reportHTML += `
  • ${t.date}: ${t.event}
  • `; }); reportHTML += `
`; } if (primarySources.length > 0 || secondarySources.length > 0) { reportHTML += `

Bibliography

`; if (primarySources.length > 0) { reportHTML += `

Primary Sources

    `; primarySources.forEach(s => { reportHTML += `
  • ${s.author}. ${s.title}.
  • `; }); reportHTML += `
`; } if (secondarySources.length > 0) { reportHTML += `

Secondary Sources

    `; secondarySources.forEach(s => { reportHTML += `
  • ${s.author}. ${s.title}.
  • `; }); reportHTML += `
`; } } document.getElementById('fullReport').innerHTML = reportHTML; } // --- Tab Navigation --- function changeTab(tabIndex) { currentTab = tabIndex; document.querySelectorAll('.tab-btn').forEach((btn, i) => btn.classList.toggle('tab-active', i === tabIndex)); document.querySelectorAll('.tab-content').forEach((content, i) => content.classList.toggle('tab-content-active', i === tabIndex)); updateNavButtons(); if (tabIndex === 2) { generateReport(); } } function navigateTabs(direction) { let targetTab = (direction === 'next') ? currentTab + 1 : currentTab - 1; if (targetTab >= 0 && targetTab < totalTabs) { changeTab(targetTab); } } function updateNavButtons() { const prevBtn = document.getElementById('prev-btn'); const nextBtn = document.getElementById('next-btn'); if (!prevBtn || !nextBtn) return; prevBtn.disabled = currentTab === 0; nextBtn.style.display = currentTab === totalTabs - 1 ? 'none' : 'inline-block'; } // --- PDF Generation --- function downloadPDF() { const { jsPDF } = window.jspdf; const doc = new jsPDF({ unit: 'pt', format: 'a4' }); const title = document.getElementById('reportTitle').value; const author = document.getElementById('authorName').value || "N/A"; const thesis = document.getElementById('thesisStatement').value; const analysis = document.getElementById('analysisText').value; const primarySources = collectData('#primary-sources-container .dynamic-row', [{key: 'author', class: 'primary-source-author'}, {key: 'title', class: 'primary-source-title'}]); const secondarySources = collectData('#secondary-sources-container .dynamic-row', [{key: 'author', class: 'secondary-source-author'}, {key: 'title', class: 'secondary-source-title'}]); const timeline = collectData('#timeline-container .dynamic-row', [{key: 'date', class: 'timeline-date'}, {key: 'event', class: 'timeline-event'}]); const pageWidth = doc.internal.pageSize.getWidth(); const pageHeight = doc.internal.pageSize.getHeight(); const margin = 72; // 1 inch const usableWidth = pageWidth - margin * 2; let cursorY = 0; // --- Title Page --- doc.setFont('times', 'bold'); doc.setFontSize(24); doc.text(title, pageWidth / 2, pageHeight / 2 - 80, { align: 'center', maxWidth: usableWidth }); doc.setFontSize(14); doc.setFont('times', 'normal'); doc.text(`By: ${author}`, pageWidth / 2, pageHeight / 2, { align: 'center' }); doc.text(`September 18, 2025`, pageWidth / 2, pageHeight / 2 + 20, { align: 'center' }); // --- Main Content --- doc.addPage(); cursorY = margin; const addSectionTitle = (text) => { if (cursorY > pageHeight - margin - 30) { doc.addPage(); cursorY = margin; } doc.setFont('times', 'bold'); doc.setFontSize(14); doc.text(text, margin, cursorY); cursorY += 20; }; const addBodyText = (text, options = {}) => { doc.setFont('times', options.style || 'normal'); doc.setFontSize(12); const lines = doc.splitTextToSize(text, usableWidth); lines.forEach(line => { if (cursorY > pageHeight - margin) { doc.addPage(); cursorY = margin; } doc.text(line, margin, cursorY); cursorY += 15; // Line height }); cursorY += (options.spacing || 10); }; addSectionTitle("Introduction & Thesis Statement"); addBodyText(thesis, { style: 'italic', spacing: 20 }); if (timeline.length > 0) { addSectionTitle("Chronology of Key Events"); timeline.forEach(t => { const eventText = `${t.event}`; const dateText = `${t.date}:`; const dateWidth = doc.getTextWidth(dateText) + 5; const eventLines = doc.splitTextToSize(eventText, usableWidth - dateWidth); if (cursorY > pageHeight - margin - (eventLines.length * 15)) { doc.addPage(); cursorY = margin; } doc.setFont('times', 'bold'); doc.text(dateText, margin, cursorY); doc.setFont('times', 'normal'); doc.text(eventLines, margin + dateWidth, cursorY); cursorY += eventLines.length * 15; }); cursorY += 10; } addSectionTitle("Historical Analysis"); addBodyText(analysis, { spacing: 20 }); if (primarySources.length > 0 || secondarySources.length > 0) { if (cursorY > pageHeight - margin - 80) { doc.addPage(); cursorY = margin; } addSectionTitle("Bibliography"); if (primarySources.length > 0) { if (cursorY > pageHeight - margin - 30) { doc.addPage(); cursorY = margin; } doc.setFont('times', 'bold'); doc.setFontSize(12); doc.text("Primary Sources", margin, cursorY); cursorY += 15; primarySources.forEach(s => addBodyText(`${s.author}. ${s.title}.`, {style: 'italic', spacing: 2})); cursorY += 10; } if (secondarySources.length > 0) { if (cursorY > pageHeight - margin - 30) { doc.addPage(); cursorY = margin; } doc.setFont('times', 'bold'); doc.setFontSize(12); doc.text("Secondary Sources", margin, cursorY); cursorY += 15; secondarySources.forEach(s => addBodyText(`${s.author}. ${s.title}.`, {style: 'italic', spacing: 2})); } } // --- Page Numbers --- const pageCount = doc.internal.getNumberOfPages(); for(let i = 1; i <= pageCount; i++) { doc.setPage(i); if (i > 1) { // No number on title page doc.setFont('times', 'normal'); doc.setFontSize(10); doc.text(`Page ${i - 1}`, pageWidth / 2, pageHeight - 30, { align: 'center' }); } } doc.save('History-Research-Report.pdf'); }
Scroll to Top