Skip to content

Commit e56bac9

Browse files
committed
Fix proof page no-JS fallback and add root redirect
1 parent c65bdc8 commit e56bac9

2 files changed

Lines changed: 40 additions & 33 deletions

File tree

‎docs/index.html‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="refresh" content="0;url=proof/">
6+
<title>ECP Protocol</title>
7+
</head>
8+
<body>
9+
<p>Redirecting to <a href="proof/">ECP Proof</a>...</p>
10+
</body>
11+
</html>

‎docs/proof/index.html‎

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<title>ECP Proof - 669 vs 8</title>
77
<meta name="description" content="Canonical ECP comparison: CAP XML 669 bytes, JSON 270 bytes, ECP UET 8 bytes.">
8+
<meta property="og:title" content="669 bytes for a fire alert. ECP does it in 8.">
9+
<meta property="og:description" content="CAP XML: 669 bytes. JSON: 270 bytes. ECP: 8 bytes. Same fire alert. Verify it yourself.">
10+
<meta property="og:type" content="website">
11+
<meta property="og:url" content="https://egonex-code.github.io/ecp-protocol/proof/">
12+
<meta name="twitter:card" content="summary">
13+
<meta name="twitter:title" content="669 bytes for a fire alert. ECP does it in 8.">
14+
<meta name="twitter:description" content="CAP XML: 669 bytes. JSON: 270 bytes. ECP: 8 bytes. Same fire alert. Verify it yourself.">
815
<style>
916
:root {
1017
--bg: #0a1020;
@@ -230,25 +237,25 @@ <h1>Why does it take 669 bytes to tell a computer there is a fire?</h1>
230237
<article class="metric" data-key="cap" data-value="669">
231238
<div class="metric-head">
232239
<span class="label">CAP XML</span>
233-
<span class="value" id="cap-value">0 bytes</span>
240+
<span class="value" id="cap-value">669 bytes</span>
234241
</div>
235-
<div class="bar-wrap"><div class="bar cap" id="cap-bar"></div></div>
242+
<div class="bar-wrap"><div class="bar cap" id="cap-bar" style="width:100%"></div></div>
236243
</article>
237244

238245
<article class="metric" data-key="json" data-value="270">
239246
<div class="metric-head">
240247
<span class="label">JSON</span>
241-
<span class="value" id="json-value">0 bytes</span>
248+
<span class="value" id="json-value">270 bytes</span>
242249
</div>
243-
<div class="bar-wrap"><div class="bar json" id="json-bar"></div></div>
250+
<div class="bar-wrap"><div class="bar json" id="json-bar" style="width:40.4%"></div></div>
244251
</article>
245252

246253
<article class="metric" data-key="ecp" data-value="8">
247254
<div class="metric-head">
248255
<span class="label">ECP UET</span>
249-
<span class="value" id="ecp-value">0 bytes</span>
256+
<span class="value" id="ecp-value">8 bytes</span>
250257
</div>
251-
<div class="bar-wrap"><div class="bar ecp" id="ecp-bar"></div></div>
258+
<div class="bar-wrap"><div class="bar ecp" id="ecp-bar" style="width:1.2%"></div></div>
252259
</article>
253260
</section>
254261

@@ -296,9 +303,19 @@ <h1>Why does it take 669 bytes to tell a computer there is a fire?</h1>
296303
document.getElementById("proof-hash").textContent = CANONICAL.proofHash;
297304
document.getElementById("impact-text").textContent = reduction + "% less data";
298305

299-
animateMetric("cap", CANONICAL.cap, max, 0);
300-
animateMetric("json", CANONICAL.json, max, 280);
301-
animateMetric("ecp", CANONICAL.ecp, max, 560);
306+
const canAnimate = typeof requestAnimationFrame === "function";
307+
if (canAnimate) {
308+
resetBars();
309+
animateMetric("cap", CANONICAL.cap, max, 0);
310+
animateMetric("json", CANONICAL.json, max, 280);
311+
animateMetric("ecp", CANONICAL.ecp, max, 560);
312+
}
313+
314+
function resetBars() {
315+
["cap", "json", "ecp"].forEach(function (key) {
316+
document.getElementById(key + "-bar").style.width = "0%";
317+
});
318+
}
302319

303320
const copyBtn = document.getElementById("copy-btn");
304321
const copyStatus = document.getElementById("copy-status");
@@ -321,32 +338,11 @@ <h1>Why does it take 669 bytes to tell a computer there is a fire?</h1>
321338
});
322339

323340
function animateMetric(key, targetValue, maxValue, delayMs) {
324-
const valueEl = document.getElementById(key + "-value");
325341
const barEl = document.getElementById(key + "-bar");
326-
const durationMs = 1300;
327-
const startAt = performance.now() + delayMs;
328-
329-
requestAnimationFrame(function step(now) {
330-
if (now < startAt) {
331-
requestAnimationFrame(step);
332-
return;
333-
}
334-
335-
const progress = Math.min((now - startAt) / durationMs, 1);
336-
const eased = 1 - Math.pow(1 - progress, 3);
337-
const current = Math.round(targetValue * eased);
338-
const widthPct = (current / maxValue) * 100;
339-
340-
valueEl.textContent = current + " bytes";
342+
const widthPct = (targetValue / maxValue) * 100;
343+
setTimeout(function () {
341344
barEl.style.width = widthPct + "%";
342-
343-
if (progress < 1) {
344-
requestAnimationFrame(step);
345-
} else {
346-
valueEl.textContent = targetValue + " bytes";
347-
barEl.style.width = ((targetValue / maxValue) * 100) + "%";
348-
}
349-
});
345+
}, delayMs);
350346
}
351347

352348
function buildTimestampRunId() {

0 commit comments

Comments
 (0)