Fix corrupted main.js syntax error that broke entire site

This commit is contained in:
2025-12-28 02:14:56 +11:00
parent 9323293464
commit 4ca5ab1d71

38
main.js
View File

@@ -312,6 +312,43 @@ function getUserUuid() {
let uuid = localStorage.getItem('user_uuid');
if (!uuid) {
uuid = crypto.randomUUID();
localStorage.setItem('user_uuid', uuid);
}
return uuid;
}
async function loadOptimizations(testId) {
try {
const response = await fetch(`/reports/${testId}.optimizations.json`);
if (!response.ok) throw new Error('Optimizations not found');
const data = await response.json();
const container = document.getElementById('optimization-checklist');
const scoreEl = document.getElementById('optimization-score');
const itemsEl = document.getElementById('optimization-items');
// Display score
const score = data.summary.score;
scoreEl.textContent = `${score}%`;
scoreEl.style.color = score >= 80 ? '#4CAF50' : score >= 50 ? '#FFC107' : '#F44336';
// Display checks
let html = '';
data.checks.forEach(check => {
const icon = check.status === 'error' ? '❌' : check.status === 'warning' ? '⚠️' : '';
const color = check.status === 'error' ? '#F44336' : check.status === 'warning' ? '#FFC107' : '#2196F3';
html += `
<div style="border-left: 4px solid ${color}; padding: 1rem; margin: 0.5rem 0; background: var(--color-bg-tertiary); border-radius: 4px;">
<div style="font-weight: 600; margin-bottom: 0.5rem;">
${icon} ${check.title}
</div>
<div style="color: var(--color-text-secondary); font-size: 0.9rem;">
${check.description}
</div>
${check.savings ? `<div style="color: var(--color-accent); font-size: 0.85rem; margin-top: 0.5rem;">Potential savings: ${(check.savings / 1000).toFixed(1)}s</div>` : ''}
</div>
`;
});
if (data.checks.length === 0) {
@@ -326,6 +363,7 @@ function getUserUuid() {
}
}
// Initialization
document.addEventListener('DOMContentLoaded', () => {
// Ensure we have an identity