Changed around line 45: document.addEventListener("DOMContentLoaded", () => {
- // Simulate analysis
- const randomPoint = points[Math.floor(Math.random() * points.length)];
+ // Show loading indicator
+ const loadingIndicator = document.getElementById("loading-indicator");
+ loadingIndicator.classList.remove("hidden");
+ matchResult.classList.add("hidden"); // Hide previous result if any
- // Animate result
- drawPlot();
- animatePoint(randomPoint.x, randomPoint.y);
+ // Simulate analysis with timeout
+ setTimeout(() => {
+ // Hide loading indicator
+ loadingIndicator.classList.add("hidden");
- // Show result
- matchResult.classList.remove("hidden");
+ // Perform analysis
+ const randomPoint = points[Math.floor(Math.random() * points.length)];
- // Fictional leaders for demo
- const leaders = ["Hitler"];
- matchResult.textContent = `${leaders[Math.floor(Math.random() * leaders.length)]}`;
+ // Animate result
+ drawPlot();
+ animatePoint(randomPoint.x, randomPoint.y);
+
+ // Show result
+ matchResult.classList.remove("hidden");
+
+ // Fictional leaders for demo
+ const leaders = ["Hitler"];
+ matchResult.textContent = `${leaders[Math.floor(Math.random() * leaders.length)]}`;
+ }, 7000); // 7 seconds delay