-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidget.html
More file actions
196 lines (166 loc) · 5.28 KB
/
widget.html
File metadata and controls
196 lines (166 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Token Deathclock — Live AI Token Counter</title>
<meta name="robots" content="noindex" />
<!-- death-clock-core.js relies on DeathClockCore being exposed globally;
it has no dependency on Chart.js. The widget does not load Chart.js. -->
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@700;900&family=Share+Tech+Mono&display=swap" rel="stylesheet" />
<style>
/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0a0a0a;
--surface: #161616;
--border: #2a2a2a;
--text: #e8e8e8;
--text-dim: #888888;
--accent: #ff3333;
--accent-2: #ff8800;
--accent-glow: rgba(255,51,51,0.35);
}
html, body {
width: 100%;
height: 100%;
background: var(--bg);
color: var(--text);
font-family: 'Share Tech Mono', monospace;
}
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.25rem;
gap: 0.75rem;
min-height: 100%;
}
.widget-title {
font-family: 'Orbitron', sans-serif;
font-size: clamp(0.6rem, 2vw, 0.75rem);
letter-spacing: 0.2em;
text-transform: uppercase;
color: var(--accent);
text-shadow: 0 0 8px var(--accent-glow);
}
.counter-value {
font-family: 'Orbitron', sans-serif;
font-size: clamp(1.1rem, 5vw, 2rem);
font-weight: 900;
color: var(--accent);
text-shadow: 0 0 20px var(--accent-glow);
text-align: center;
line-height: 1.1;
word-break: break-all;
}
.counter-label {
font-size: clamp(0.55rem, 1.8vw, 0.7rem);
color: var(--text-dim);
text-align: center;
letter-spacing: 0.05em;
}
.rate-row {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: clamp(0.55rem, 1.5vw, 0.68rem);
color: var(--accent-2);
}
.rate-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent-2);
animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.4; transform: scale(0.7); }
}
.widget-footer {
font-size: clamp(0.5rem, 1.5vw, 0.62rem);
color: var(--text-dim);
text-align: center;
opacity: 0.7;
}
.widget-footer a {
color: var(--accent);
text-decoration: none;
}
.widget-footer a:hover { text-decoration: underline; }
.divider {
width: 80%;
height: 1px;
background: var(--border);
}
</style>
</head>
<body>
<p class="widget-title">💀 AI Tokens Consumed (Global)</p>
<div id="totalCounter" class="counter-value" aria-live="polite" aria-atomic="true">Loading…</div>
<p class="counter-label">since 1 January 2020</p>
<div class="divider"></div>
<div class="rate-row">
<span class="rate-dot" aria-hidden="true"></span>
<span id="rateCounter">100,000,000</span>
<span>tokens / sec</span>
</div>
<div class="divider"></div>
<p class="widget-footer">
<a href="https://nitrocode.github.io/token-deathclock/" target="_blank" rel="noopener noreferrer">
nitrocode.github.io/token-deathclock
</a>
· illustrative estimate
</p>
<!-- Core logic (no DOM deps) -->
<script src="milestones-data.js"></script>
<script src="death-clock-core.js"></script>
<script>
'use strict';
(function () {
const {
BASE_TOKENS,
TOKENS_PER_SECOND,
BASE_DATE_ISO,
RATE_SCHEDULE,
formatTokenCount,
} = window.DeathClockCore;
const BASE_DATE_MS = new Date(BASE_DATE_ISO).getTime();
function getRateAtDate(d) {
if (!RATE_SCHEDULE || !RATE_SCHEDULE.length) return TOKENS_PER_SECOND;
const ms = d instanceof Date ? d.getTime() : d;
let rate = RATE_SCHEDULE[0].tokensPerSecond;
for (const entry of RATE_SCHEDULE) {
if (ms >= new Date(entry.date).getTime()) rate = entry.tokensPerSecond;
else break;
}
return rate;
}
function getCurrentTokens() {
const elapsed = (Date.now() - BASE_DATE_MS) / 1000;
return BASE_TOKENS + TOKENS_PER_SECOND * elapsed;
}
function numFmt(n) {
if (n >= 1e15) return (n / 1e15).toFixed(3) + ' Quadrillion';
if (n >= 1e12) return (n / 1e12).toFixed(3) + ' Trillion';
return formatTokenCount(n);
}
const totalEl = document.getElementById('totalCounter');
const rateEl = document.getElementById('rateCounter');
function tick() {
const tokens = getCurrentTokens();
const rate = getRateAtDate(new Date());
if (totalEl) totalEl.textContent = numFmt(tokens);
if (rateEl) rateEl.textContent = formatTokenCount(rate);
requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
})();
</script>
</body>
</html>