From 4ca5ab1d711fc830ebf0a03b490d4a622e6cd1fa Mon Sep 17 00:00:00 2001 From: DeNNiiInc Date: Sun, 28 Dec 2025 02:14:56 +1100 Subject: [PATCH] Fix corrupted main.js syntax error that broke entire site --- main.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/main.js b/main.js index 723a3c7..00174c9 100644 --- a/main.js +++ b/main.js @@ -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 += ` +
+
+ ${icon} ${check.title} +
+
+ ${check.description} +
+ ${check.savings ? `
Potential savings: ${(check.savings / 1000).toFixed(1)}s
` : ''} +
+ `; }); if (data.checks.length === 0) { @@ -326,6 +363,7 @@ function getUserUuid() { } } + // Initialization document.addEventListener('DOMContentLoaded', () => { // Ensure we have an identity