mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-18 04:05:58 +00:00
Fix corrupted main.js syntax error that broke entire site
This commit is contained in:
38
main.js
38
main.js
@@ -312,6 +312,43 @@ function getUserUuid() {
|
|||||||
let uuid = localStorage.getItem('user_uuid');
|
let uuid = localStorage.getItem('user_uuid');
|
||||||
if (!uuid) {
|
if (!uuid) {
|
||||||
uuid = crypto.randomUUID();
|
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) {
|
if (data.checks.length === 0) {
|
||||||
@@ -326,6 +363,7 @@ function getUserUuid() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Initialization
|
// Initialization
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Ensure we have an identity
|
// Ensure we have an identity
|
||||||
|
|||||||
Reference in New Issue
Block a user