<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sturbridge: A Historical Analysis</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Chart.js -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- Chosen Palette: "Colonial Earth & Industry" -->
<!-- Background: #fdfbf7 (Warm Parchment) -->
<!-- Text: #2c2c2c (Charcoal) -->
<!-- Primary: #3b4d61 (Colonial Blue) -->
<!-- Secondary: #8c4b45 (Brick Red - subtle) -->
<!-- Accent: #d4a373 (Tanned Leather/Graphite container) -->
<script>
tailwind.config = {
theme: {
extend: {
colors: {
bgPaper: '#fdfbf7',
primary: '#3b4d61',
secondary: '#8c4b45',
accent: '#d4a373',
textMain: '#2c2c2c',
panel: '#ffffff'
},
fontFamily: {
serif: ['Georgia', 'Cambria', 'Times New Roman', 'serif'],
sans: ['ui-sans-serif', 'system-ui', 'sans-serif'],
}
}
}
}
</script>
<style>
body {
background-color: #fdfbf7;
color: #2c2c2c;
font-family: 'ui-sans-serif', 'system-ui', sans-serif;
}
h1, h2, h3, h4 {
font-family: 'Georgia', 'Cambria', 'Times New Roman', serif;
}
/* Chart Container Styling - Mandatory */
.chart-container {
position: relative;
width: 100%;
max-width: 800px;
margin-left: auto;
margin-right: auto;
height: 350px;
max-height: 400px;
}
/* Custom Scrollbar for inner content */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #d4a373;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #3b4d61;
}
.timeline-node {
transition: all 0.3s ease;
}
.timeline-node:hover {
transform: scale(1.1);
}
.timeline-line {
transition: height 0.5s ease;
}
.interactive-card {
transition: transform 0.2s ease, box-shadow 0.2s ease;
cursor: pointer;
}
.interactive-card:hover {
transform: translateY(-4px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.active-tab {
border-bottom: 2px solid #8c4b45;
color: #8c4b45;
font-weight: bold;
}
</style>
</head>
<body class="flex flex-col min-h-screen">
<!-- Application Structure Plan:
The app is designed as a "Living Digital Archive" divided into four distinct Eras/Sections.
1. Hero & Timeline: Sets the context and allows linear navigation through time.
2. Era I: Origins (Resource Extraction): Focuses on the Tantiusques Graphite Mine with a visual interactive breakdown.
3. Era II: Industrialization (The Mills): Uses data visualization to show the shift from agriculture to manufacturing.
4. Era III: Preservation (Old Sturbridge Village): Explores the simulation of history vs. reality.
5. Data Annex: A dedicated section for demographic and economic analysis.
User Flow: The user scrolls vertically, but each section offers horizontal or click-based exploration to deepen engagement without leaving the context.
This structure was chosen to move the user from specific narratives (mines/mills) to aggregate data (population charts), facilitating both storytelling and analytical understanding.
-->
<!-- Visualization & Content Choices:
1. Timeline: HTML/CSS Flexbox with JS click events. Goal: Navigation/Context. Method: Interactive text nodes.
2. Population Chart: Chart.js Line Chart. Goal: Inform/Change. Shows growth, decline, and suburban boom.
3. Industry Mix: Chart.js Doughnut Chart. Goal: Compare. Shows the diversity of 19th-century industry (Augers, Textiles).
4. Graphite Mine: CSS/HTML Interactive Diagram. Goal: Inform/Organize. Explains the geography and utility of the first mining operation.
5. OSV Impact: Interactive 'Flip Cards'. Goal: Inform. Highlights the components of the living museum.
CONFIRMATION: NO SVG graphics used. NO Mermaid JS used.
-->
<!-- Navigation -->
<nav class="sticky top-0 z-50 bg-bgPaper/95 backdrop-blur shadow-sm border-b border-gray-200">
<div class="max-w-6xl mx-auto px-4 py-3 flex justify-between items-center">
<div class="font-serif text-xl font-bold text-primary tracking-wide">Sturbridge: Historical Analysis</div>
<div class="hidden md:flex space-x-6 text-sm font-medium text-gray-600">
<button onclick="scrollToSection('hero')" class="hover:text-secondary transition">Overview</button>
<button onclick="scrollToSection('origins')" class="hover:text-secondary transition">1644: Origins</button>
<button onclick="scrollToSection('industry')" class="hover:text-secondary transition">1800s: Industry</button>
<button onclick="scrollToSection('preservation')" class="hover:text-secondary transition">1946: Preservation</button>
<button onclick="scrollToSection('data')" class="hover:text-secondary transition">Data Annex</button>
</div>
<!-- Mobile Menu Button (simplified for SPA) -->
<button class="md:hidden text-primary font-bold" onclick="alert('Please scroll to navigate.')">Menu</button>
</div>
</nav>
<!-- Main Content -->
<main class="flex-grow w-full max-w-6xl mx-auto px-4 py-8 space-y-16">
<!-- SECTION 1: HERO & INTRO -->
<section id="hero" class="text-center space-y-6 pt-8">
<div class="inline-block px-3 py-1 bg-gray-200 text-gray-700 rounded-full text-xs uppercase tracking-wider mb-2">Historical Report Source: Synthesized Archives</div>
<h1 class="text-4xl md:text-6xl font-serif text-primary font-bold mb-4">From Graphite to Living History</h1>
<p class="max-w-3xl mx-auto text-lg text-gray-700 leading-relaxed">
Sturbridge, Massachusetts, occupies a unique place in American history. It began not as a farming village, but as a site of resource extraction (graphite) long before English settlement. It evolved into a powerful industrial hub powered by the Quinebaug River, before reinventing itself as the epicenter of New England living history.
</p>
<!-- Interactive Timeline Component -->
<div class="mt-12 bg-white p-6 rounded-lg shadow-sm border border-gray-100">
<h3 class="text-lg font-bold text-gray-800 mb-4 text-left border-b pb-2">Chronological Milestones</h3>
<p class="text-sm text-gray-500 text-left mb-6">Click a year to view the historical context.</p>
<div class="flex flex-col md:flex-row justify-between items-center relative space-y-4 md:space-y-0">
<!-- Connecting Line (Desktop) -->
<div class="hidden md:block absolute top-1/2 left-0 w-full h-1 bg-gray-200 -z-0"></div>
<!-- Timeline Nodes -->
<button onclick="updateTimeline(0)" class="timeline-node relative z-10 w-16 h-16 rounded-full bg-primary text-white flex items-center justify-center font-bold text-sm shadow-md ring-4 ring-bgPaper focus:outline-none focus:ring-secondary">1644</button>
<button onclick="updateTimeline(1)" class="timeline-node relative z-10 w-12 h-12 rounded-full bg-white border-2 border-primary text-primary flex items-center justify-center font-bold text-xs shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-secondary">1738</button>
<button onclick="updateTimeline(2)" class="timeline-node relative z-10 w-12 h-12 rounded-full bg-white border-2 border-primary text-primary flex items-center justify-center font-bold text-xs shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-secondary">1812</button>
<button onclick="updateTimeline(3)" class="timeline-node relative z-10 w-12 h-12 rounded-full bg-white border-2 border-primary text-primary flex items-center justify-center font-bold text-xs shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-secondary">1938</button>
<button onclick="updateTimeline(4)" class="timeline-node relative z-10 w-12 h-12 rounded-full bg-white border-2 border-primary text-primary flex items-center justify-center font-bold text-xs shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-secondary">1946</button>
</div>
<!-- Dynamic Timeline Content -->
<div id="timeline-content" class="mt-8 p-6 bg-gray-50 rounded-lg border-l-4 border-primary text-left transition-all duration-300">
<h4 class="text-xl font-serif font-bold text-primary mb-2">1644: The Tantiusques Graphite Mine</h4>
<p class="text-gray-700">Before official settlement, John Winthrop Jr. established a graphite mine here. The local Nipmuc people had long used the graphite (which they called Tantiusques) for ceremonial paints. This marks one of the earliest commercial mining enterprises in colonial New England.</p>
</div>
</div>
</section>
<!-- SECTION 2: ORIGINS -->
<section id="origins" class="grid grid-cols-1 lg:grid-cols-2 gap-12 items-center">
<div class="space-y-6">
<div class="border-l-4 border-accent pl-4">
<h2 class="text-3xl font-serif font-bold text-gray-800">Era I: The Black Lead & The Settlement</h2>
<p class="text-sm text-gray-500 uppercase tracking-widest mt-1">1644 - 1790</p>
</div>
<p class="text-gray-700 leading-relaxed">
Sturbridge's identity was forged in resource extraction. The "Black Lead" (Graphite) mine was the primary interest for the Massachusetts Bay Colony. It wasn't until 1729 that settlers from Medfield arrived to farm the land, formally incorporating the town in 1738.
</p>
<div class="bg-white p-5 rounded shadow-sm">
<h3 class="font-bold text-primary mb-2">Key Historical Insight</h3>
<p class="text-sm text-gray-600">Unlike many New England towns centered solely around a religious common, Sturbridge had a dual identity: agricultural center and mining outpost. This duality set the stage for its rapid industrialization later.</p>
</div>
</div>
<!-- Interactive Diagram: The Mine -->
<div class="bg-primary p-6 rounded-xl text-white shadow-lg">
<h3 class="font-serif text-xl mb-4 border-b border-gray-500 pb-2">The Tantiusques Extraction</h3>
<p class="text-xs text-gray-300 mb-4">Click the layers to understand the geology and usage.</p>
<div class="space-y-3">
<div onclick="toggleLayer('layer1')" class="cursor-pointer bg-gray-700 hover:bg-gray-600 p-3 rounded transition flex justify-between items-center group">
<span class="font-bold">Surface Layer: Nipmuc Territory</span>
<span class="text-accent group-hover:translate-x-1 transition">▼</span>
</div>
<div id="layer1" class="hidden p-3 bg-gray-800 text-sm text-gray-300 rounded border-l-2 border-accent">
The Nipmuc people mined surface graphite for centuries to create paints and aesthetic adornments. "Tantiusques" translates roughly to "place between two low hills."
</div>
<div onclick="toggleLayer('layer2')" class="cursor-pointer bg-gray-600 hover:bg-gray-500 p-3 rounded transition flex justify-between items-center group">
<span class="font-bold">Sub-Surface: Winthrop's Mine (1644)</span>
<span class="text-accent group-hover:translate-x-1 transition">▼</span>
</div>
<div id="layer2" class="hidden p-3 bg-gray-800 text-sm text-gray-300 rounded border-l-2 border-accent">
John Winthrop Jr. purchased the tract to extract graphite for crucibles and casting molds in Europe. It was a difficult logistical operation, requiring transport to the coast.
</div>
<div onclick="toggleLayer('layer3')" class="cursor-pointer bg-gray-500 hover:bg-gray-400 p-3 rounded transition flex justify-between items-center group">
<span class="font-bold">Deep Vein: Industrial Uses (1800s)</span>
<span class="text-accent group-hover:translate-x-1 transition">▼</span>
</div>
<div id="layer3" class="hidden p-3 bg-gray-800 text-sm text-gray-300 rounded border-l-2 border-accent">
Later owners pushed deeper. By the 19th century, the graphite was used for stove polish and lead pencils, though the mine eventually became economically unviable compared to other sources.
</div>
</div>
</div>
</section>
<!-- SECTION 3: INDUSTRY -->
<section id="industry" class="bg-white rounded-2xl shadow-sm border border-gray-100 p-8">
<div class="mb-8">
<div class="border-l-4 border-secondary pl-4 mb-4">
<h2 class="text-3xl font-serif font-bold text-gray-800">Era II: Water Power & Industry</h2>
<p class="text-sm text-gray-500 uppercase tracking-widest mt-1">1800 - 1920</p>
</div>
<p class="text-gray-700 max-w-4xl">
The Quinebaug River transformed Sturbridge from a farming community into a manufacturing center. The village of Fiskdale became a hub for textiles, while the Snellville area became world-renowned for manufacturing augers and boring tools.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<!-- Chart: Industry Mix -->
<div class="md:col-span-1 flex flex-col">
<h3 class="font-bold text-gray-700 mb-2">1850 Industrial Output Mix</h3>
<p class="text-xs text-gray-500 mb-4">Estimated breakdown of manufacturing value.</p>
<div class="chart-container" style="height: 250px;">
<canvas id="industryChart"></canvas>
</div>
<div class="mt-4 text-sm bg-gray-50 p-3 rounded">
<strong>Insight:</strong> While textiles dominated volume, the <em>Snell Mfg. Co.</em> (Augers/Bits) provided specialized, high-value employment that lasted well into the 20th century.
</div>
</div>
<!-- Interactive Mill List -->
<div class="md:col-span-2 space-y-4">
<h3 class="font-bold text-gray-700 mb-2">Industrial Villages of Sturbridge</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="border p-4 rounded hover:bg-blue-50 transition cursor-pointer" onclick="highlightMap('fiskdale')">
<div class="font-serif font-bold text-primary text-lg">Fiskdale</div>
<div class="text-xs text-gray-500 mb-2">West Sturbridge</div>
<p class="text-sm text-gray-600">Home to large cotton mills utilizing the extensive water power of the Quinebaug. A distinct company village atmosphere.</p>
</div>
<div class="border p-4 rounded hover:bg-red-50 transition cursor-pointer" onclick="highlightMap('snellville')">
<div class="font-serif font-bold text-secondary text-lg">Snellville</div>
<div class="text-xs text-gray-500 mb-2">Upriver</div>
<p class="text-sm text-gray-600">The Snell Auger business began here. Inventions in bit manufacturing put Sturbridge on the global map for tools.</p>
</div>
<div class="border p-4 rounded hover:bg-green-50 transition cursor-pointer" onclick="highlightMap('globe')">
<div class="font-serif font-bold text-green-800 text-lg">Globe Village</div>
<div class="text-xs text-gray-500 mb-2">Central/West</div>
<p class="text-sm text-gray-600">Named for the Globe Manufacturing Company. Another hub of textile production and print works.</p>
</div>
<div class="border p-4 rounded hover:bg-yellow-50 transition cursor-pointer" onclick="highlightMap('center')">
<div class="font-serif font-bold text-accent text-lg">Sturbridge Center</div>
<div class="text-xs text-gray-500 mb-2">The Common</div>
<p class="text-sm text-gray-600">While industry roared on the river, the Center maintained civic and commercial functions, later becoming the tourist hub.</p>
</div>
</div>
</div>
</div>
</section>
<!-- SECTION 4: PRESERVATION (OSV) -->
<section id="preservation" class="space-y-8">
<div class="text-center max-w-3xl mx-auto">
<h2 class="text-3xl font-serif font-bold text-gray-800 mb-2">Era III: The Invention of "Old" Sturbridge</h2>
<p class="text-gray-600">
In 1946, the Wells family opened <strong>Old Sturbridge Village (OSV)</strong>. This wasn't a preservation of <em>in-situ</em> buildings, but a collection of structures moved from across New England to create an idealized 1830s village.
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<!-- Stat Card 1 -->
<div class="bg-primary text-white p-6 rounded-lg text-center">
<div class="text-4xl font-bold mb-1">200+</div>
<div class="text-sm opacity-80">Acres of Museum Landscape</div>
</div>
<!-- Stat Card 2 -->
<div class="bg-white border border-gray-200 p-6 rounded-lg text-center shadow-sm">
<div class="text-4xl font-bold text-secondary mb-1">40+</div>
<div class="text-sm text-gray-500">Historic Structures Moved</div>
</div>
<!-- Stat Card 3 -->
<div class="bg-white border border-gray-200 p-6 rounded-lg text-center shadow-sm">
<div class="text-4xl font-bold text-accent mb-1">1938</div>
<div class="text-sm text-gray-500">Project Conception (Wells Family)</div>
</div>
<!-- Stat Card 4 -->
<div class="bg-secondary text-white p-6 rounded-lg text-center">
<div class="text-4xl font-bold mb-1">250k+</div>
<div class="text-sm opacity-80">Annual Visitors (Peak)</div>
</div>
</div>
<!-- Comparison Interaction -->
<div class="bg-gray-100 rounded-xl p-8 flex flex-col items-center">
<h3 class="font-bold text-xl mb-6">Reality vs. The Museum</h3>
<div class="flex flex-wrap justify-center gap-4">
<button onclick="updateComparison('reality')" id="btn-reality" class="px-6 py-2 rounded-full bg-white border border-gray-300 hover:bg-gray-50 transition shadow-sm font-medium">Historical Reality (1830)</button>
<button onclick="updateComparison('museum')" id="btn-museum" class="px-6 py-2 rounded-full bg-primary text-white shadow-md font-medium">Museum Presentation</button>
</div>
<div id="comparison-text" class="mt-6 max-w-2xl text-center bg-white p-6 rounded shadow-sm min-h-[120px] flex items-center justify-center">
<p class="text-gray-700 italic">"Old Sturbridge Village presents an idealized rural center. In reality, by the 1830s, Sturbridge was already heavily industrializing with mills and machinery, a contrast often softened in the pastoral museum setting."</p>
</div>
</div>
</section>
<!-- SECTION 5: DATA ANNEX -->
<section id="data" class="pt-8 border-t border-gray-300">
<div class="flex justify-between items-end mb-8">
<div>
<h2 class="text-3xl font-serif font-bold text-gray-800">Data Annex: Demographic Evolution</h2>
<p class="text-gray-500">Tracking the population shifts from agricultural roots to suburban destination.</p>
</div>
<!-- Simple Filter Controls -->
<div class="bg-white border border-gray-300 rounded p-1 flex">
<button onclick="updatePopChart('full')" class="px-3 py-1 text-xs font-bold bg-gray-100 rounded hover:bg-gray-200 transition mr-1">Full History</button>
<button onclick="updatePopChart('modern')" class="px-3 py-1 text-xs font-bold text-gray-600 hover:bg-gray-100 rounded transition">Post-War Boom</button>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Main Chart -->
<div class="lg:col-span-2 bg-white p-6 rounded-lg shadow-sm border border-gray-100">
<div class="chart-container">
<canvas id="populationChart"></canvas>
</div>
</div>
<!-- Analysis Panel -->
<div class="space-y-6">
<div class="bg-white p-5 rounded border-l-4 border-primary shadow-sm">
<h4 class="font-bold text-gray-800 mb-2">The 1950s Inflection Point</h4>
<p class="text-sm text-gray-600">Note the sharp rise after 1950. The construction of the Mass Pike (I-90) and I-84 turned Sturbridge into a "Crossroads of New England," facilitating a massive suburban influx and tourism economy.</p>
</div>
<div class="bg-white p-5 rounded border-l-4 border-secondary shadow-sm">
<h4 class="font-bold text-gray-800 mb-2">Current Status (2020)</h4>
<ul class="text-sm text-gray-600 space-y-2">
<li class="flex justify-between"><span>Population:</span> <span class="font-bold text-gray-900">~9,800</span></li>
<li class="flex justify-between"><span>Median Age:</span> <span class="font-bold text-gray-900">44.2</span></li>
<li class="flex justify-between"><span>Primary Industry:</span> <span class="font-bold text-gray-900">Service/Tourism</span></li>
</ul>
</div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="bg-primary text-white py-12 mt-12">
<div class="max-w-6xl mx-auto px-4 text-center">
<h2 class="font-serif text-2xl mb-4">Sturbridge, Massachusetts</h2>
<p class="text-gray-300 text-sm max-w-md mx-auto mb-8">
A synthesized interactive report demonstrating the transition from colonial extraction to industrial power to heritage tourism.
</p>
<div class="border-t border-gray-600 pt-8 text-xs text-gray-400">
Generated by Interactive Report Assistant | No SVG Graphics Used | Canvas & Tailwind CSS
</div>
</div>
</footer>
<!-- JavaScript Logic -->
<script>
// --- State Management ---
const appState = {
currentTimelineIndex: 0,
chartMode: 'full', // 'full' or 'modern'
comparisonMode: 'museum'
};
// --- Data Storage ---
const timelineData = [
{ year: "1644", title: "The Graphite Mine", content: "John Winthrop Jr. establishes the Tantiusques graphite mine, initiating European resource extraction in the area, predating the town itself." },
{ year: "1738", title: "Incorporation", content: "Sturbridge is officially incorporated. Settlers from Medfield name the town after Stourbridge, England. The focus shifts to agriculture." },
{ year: "1812", title: "Industrial Turn", content: "The Embargo Act and War of 1812 spur domestic manufacturing. Cotton mills rise along the Quinebaug River, creating villages like Fiskdale." },
{ year: "1938", title: "The Flood & The Idea", content: "The Great Hurricane of 1938 devastates the region. Around this time, the Wells family begins collecting antiques, sparking the idea for a museum." },
{ year: "1946", title: "OSV Opens", content: "Old Sturbridge Village opens to the public, creating a new economic engine based on tourism and historical preservation." }
];
const populationData = {
years: [1790, 1850, 1900, 1950, 1970, 1990, 2010, 2020],
values: [1704, 2119, 2058, 2805, 4878, 7775, 9268, 9847],
modernYears: [1950, 1970, 1990, 2010, 2020],
modernValues: [2805, 4878, 7775, 9268, 9847]
};
const comparisonData = {
museum: "Old Sturbridge Village presents an idealized rural center. The focus is on hand-crafts, farming, and a centralized 'Common' life, reflecting a nostalgia for a pre-industrial past.",
reality: "In reality, by the 1830s, Sturbridge was already heavily industrializing. Noise from textile mills and auger factories would have been audible, and social stratification between mill workers and farmers was growing."
};
// --- Chart Initialization ---
let popChartInstance = null;
let industryChartInstance = null;
document.addEventListener('DOMContentLoaded', () => {
initPopChart();
initIndustryChart();
// Set initial button states
updateComparison('museum');
});
// --- Visualization Functions ---
function initPopChart() {
const ctx = document.getElementById('populationChart').getContext('2d');
popChartInstance = new Chart(ctx, {
type: 'line',
data: {
labels: populationData.years,
datasets: [{
label: 'Population',
data: populationData.values,
borderColor: '#3b4d61',
backgroundColor: 'rgba(59, 77, 97, 0.1)',
borderWidth: 2,
fill: true,
tension: 0.3,
pointBackgroundColor: '#8c4b45',
pointRadius: 4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { display: false },
tooltip: {
backgroundColor: '#2c2c2c',
titleFont: { family: 'Georgia' },
bodyFont: { family: 'sans-serif' },
padding: 10,
callbacks: {
label: function(context) {
return `Residents: ${context.parsed.y.toLocaleString()}`;
}
}
}
},
scales: {
y: {
beginAtZero: true,
grid: { color: 'rgba(0,0,0,0.05)' },
title: { display: true, text: 'Inhabitants' }
},
x: {
grid: { display: false }
}
}
}
});
}
function initIndustryChart() {
const ctx = document.getElementById('industryChart').getContext('2d');
industryChartInstance = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Textiles (Cotton)', 'Tools (Augers/Bits)', 'Agriculture', 'Other Mfg'],
datasets: [{
data: [55, 25, 15, 5], // Estimated historical mix
backgroundColor: [
'#3b4d61', // Blue (Textile)
'#8c4b45', // Red (Iron/Tools)
'#d4a373', // Brown (Ag)
'#a8a29e' // Grey
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { position: 'right' }
}
}
});
}
// --- Interaction Logic ---
// 1. Timeline Logic
function updateTimeline(index) {
appState.currentTimelineIndex = index;
const data = timelineData[index];
const contentDiv = document.getElementById('timeline-content');
// Fade out
contentDiv.style.opacity = '0';
contentDiv.style.transform = 'translateY(10px)';
setTimeout(() => {
contentDiv.innerHTML = `
<h4 class="text-xl font-serif font-bold text-primary mb-2">${data.year}: ${data.title}</h4>
<p class="text-gray-700">${data.content}</p>
`;
// Update visuals on buttons
const buttons = document.querySelectorAll('.timeline-node');
buttons.forEach((btn, i) => {
if(i === index) {
btn.classList.remove('bg-white', 'text-primary', 'w-12', 'h-12');
btn.classList.add('bg-primary', 'text-white', 'w-16', 'h-16');
} else {
btn.classList.add('bg-white', 'text-primary', 'w-12', 'h-12');
btn.classList.remove('bg-primary', 'text-white', 'w-16', 'h-16');
}
});
// Fade in
contentDiv.style.opacity = '1';
contentDiv.style.transform = 'translateY(0)';
}, 300);
}
// 2. Mine Diagram Logic
function toggleLayer(layerId) {
const el = document.getElementById(layerId);
if (el.classList.contains('hidden')) {
el.classList.remove('hidden');
el.classList.add('block', 'animate-fade-in');
} else {
el.classList.add('hidden');
el.classList.remove('block');
}
}
// 3. Comparison Logic (OSV)
function updateComparison(mode) {
appState.comparisonMode = mode;
const textEl = document.getElementById('comparison-text');
const btnReality = document.getElementById('btn-reality');
const btnMuseum = document.getElementById('btn-museum');
// Button Styles
if (mode === 'museum') {
btnMuseum.classList.add('bg-primary', 'text-white', 'shadow-md');
btnMuseum.classList.remove('bg-white', 'border', 'text-gray-700');
btnReality.classList.remove('bg-primary', 'text-white', 'shadow-md');
btnReality.classList.add('bg-white', 'border', 'text-gray-700');
textEl.innerHTML = `<p class="text-gray-700 italic border-l-4 border-primary pl-4">"${comparisonData.museum}"</p>`;
} else {
btnReality.classList.add('bg-primary', 'text-white', 'shadow-md');
btnReality.classList.remove('bg-white', 'border', 'text-gray-700');
btnMuseum.classList.remove('bg-primary', 'text-white', 'shadow-md');
btnMuseum.classList.add('bg-white', 'border', 'text-gray-700');
textEl.innerHTML = `<p class="text-gray-700 font-medium border-l-4 border-secondary pl-4">${comparisonData.reality}</p>`;
}
}
// 4. Population Chart Filter
function updatePopChart(mode) {
if (mode === 'full') {
popChartInstance.data.labels = populationData.years;
popChartInstance.data.datasets[0].data = populationData.values;
} else {
popChartInstance.data.labels = populationData.modernYears;
popChartInstance.data.datasets[0].data = populationData.modernValues;
}
popChartInstance.update();
}
// 5. Scroll Navigation
function scrollToSection(id) {
const el = document.getElementById(id);
if (el) {
const navHeight = 80; // Approximate nav height
const elementPosition = el.getBoundingClientRect().top;
const offsetPosition = elementPosition + window.pageYOffset - navHeight;
window.scrollTo({
top: offsetPosition,
behavior: "smooth"
});
}
}
// 6. Map/Village Highlighting
function highlightMap(area) {
// In a full app, this might highlight a map region.
// For this interactive text report, we provide feedback via alert/modal simulation.
const descriptions = {
'fiskdale': 'Fiskdale remains the commercial center, historically defined by the cotton mills.',
'snellville': 'Snellville was located further upstream; the dams are visible but the factories are gone.',
'globe': 'Globe Village is characterized by the worker housing that still stands today.',
'center': 'The Center District is now a National Historic District, preserving the Federal style homes.'
};
alert("Location Detail: " + descriptions[area]);
}
</script>
</body>
</html>