-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdecoder.html
More file actions
584 lines (534 loc) · 21.3 KB
/
decoder.html
File metadata and controls
584 lines (534 loc) · 21.3 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WebXOS Decoder 2025</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #000000;
font-family: 'Orbitron', 'OCR-A', 'Courier New', monospace;
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
perspective: 1000px;
}
.logo {
font-size: 64px;
color: #00ff00;
text-shadow: 0 0 12px #00ff00, 0 0 20px #00ff00;
animation: glow 2s infinite alternate;
margin-bottom: 20px;
letter-spacing: 2px;
font-family: 'Orbitron', monospace;
}
.input-container {
width: 90vw;
max-width: 600px;
display: flex;
gap: 10px;
padding: 10px;
background: rgba(0, 0, 0, 0.7);
border: 2px solid #00ff00;
border-radius: 10px;
box-shadow: 0 0 15px #00ff00, inset 0 0 8px #00ff00;
position: relative;
}
#messageInput {
flex-grow: 1;
background: rgba(0, 255, 0, 0.2);
border: 2px solid #00ff00;
color: #00ff00;
padding: 10px;
font-size: 14px;
border-radius: 5px;
box-shadow: 0 0 8px #00ff00;
font-family: 'OCR-A', 'Courier New', monospace;
}
#decodeBtn {
background: #00ff00;
border: 2px solid #00ff00;
color: #000000;
padding: 10px 20px;
cursor: pointer;
font-size: 14px;
border-radius: 5px;
transition: all 0.3s;
text-shadow: 0 0 5px #000000;
font-family: 'Orbitron', monospace;
}
#decodeBtn:hover {
background: #000000;
color: #00ff00;
box-shadow: 0 0 12px #00ff00;
transform: scale(1.05);
}
.error-message {
position: absolute;
top: -40px;
left: 50%;
transform: translateX(-50%);
color: #ff3333;
text-shadow: 0 0 8px #ff3333;
font-size: 14px;
text-align: center;
opacity: 0;
transition: opacity 0.5s ease;
font-family: 'OCR-A', 'Courier New', monospace;
white-space: nowrap;
}
.error-message.show {
opacity: 1;
}
.certificate-modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
z-index: 1000;
}
.certificate-container {
min-width: 300px;
min-height: 300px;
background: #000000;
border: 4px solid #00ff00;
border-radius: 15px;
box-shadow: 0 0 20px #00ff00, inset 0 0 10px #00ff00;
display: flex;
justify-content: center;
align-items: center;
position: relative;
perspective: 1000px;
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 20px #00ff00, inset 0 0 10px #00ff00; }
50% { box-shadow: 0 0 30px #00ff00, inset 0 0 15px #00ff00; }
100% { box-shadow: 0 0 20px #00ff00, inset 0 0 10px #00ff00; }
}
.certificate {
min-width: 260px;
min-height: 260px;
padding: 15px;
background: #001100;
color: #00ff00;
text-align: center;
position: absolute;
transform: perspective(1000px) translateZ(40px) rotateX(5deg) rotateY(5deg);
z-index: 2;
font-family: 'OCR-A', 'Orbitron', 'Courier New', monospace;
font-weight: 700;
background-image: linear-gradient(rgba(0, 255, 0, 0.3) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 255, 0, 0.3) 1px, transparent 1px);
background-size: 8px 8px;
border: 1px dashed #00ff00;
box-shadow: 0 0 20px rgba(0, 255, 0, 0.4), inset 0 0 10px rgba(0, 255, 0, 0.3);
animation: flicker 3s infinite ease-in-out;
cursor: pointer;
}
.certificate.spinning {
animation: spinHologram 2s ease-in-out forwards;
}
.certificate-title {
font-size: 28px;
font-weight: 700;
color: #00ff00;
text-shadow: 0 0 10px #00ff00;
margin-bottom: 8px;
-webkit-text-stroke: 1px #004d00;
animation: flicker 2s infinite ease-in-out;
font-family: 'Orbitron', monospace;
letter-spacing: 1px;
line-height: 1.1;
white-space: nowrap;
}
.certificate p {
font-size: 12px;
text-shadow: 0 0 8px #00ff00;
margin: 8px 0;
font-family: 'OCR-A', 'Courier New', monospace;
}
.certificate a {
color: #00ffcc;
text-decoration: none;
font-size: 8px;
text-shadow: 0 0 5px #00ffcc;
font-family: 'OCR-A', 'Courier New', monospace;
}
.certificate a:hover {
text-decoration: underline;
}
.score-display {
font-size: 22px;
color: #00ff00;
text-shadow: 0 0 8px #00ff00;
font-family: 'OCR-A', 'Courier New', monospace;
}
.emoji-reward {
font-size: 40px;
display: inline-block;
text-shadow: 0 0 8px #00ff00, 0 0 12px #00ffcc;
margin: 8px 0;
line-height: 1;
}
.scramble-char {
display: inline-block;
position: relative;
transition: all 0.2s ease;
}
.dissolving {
animation: dissolve 1.6s ease-out forwards;
color: #00ff00;
}
.rebuilding {
animation: rebuild 1.4s ease-in forwards;
}
@keyframes dissolve {
0% { transform: translate(0, 0); opacity: 1; }
50% { transform: translate(0, -15px); opacity: 0.7; }
100% { transform: translate(calc((50 - 100 * var(--rand-x)) * 1px), calc((50 - 100 * var(--rand-y)) * 1px)); opacity: 0; }
}
@keyframes rebuild {
0% { transform: translate(calc((50 - 100 * var(--rand-x)) * 1px), calc((50 - 100 * var(--rand-y)) * 1px)); opacity: 0; }
100% { transform: translate(0, 0); opacity: 1; }
}
@keyframes glow {
from { text-shadow: 0 0 5px #00ff00; }
to { text-shadow: 0 0 12px #00ff00, 0 0 20px #00ff00; }
}
@keyframes flicker {
0% { opacity: 1; }
50% { opacity: 0.85; }
100% { opacity: 1; }
}
@keyframes spinHologram {
0% { transform: perspective(1000px) translateZ(40px) rotateX(5deg) rotateY(5deg); }
100% { transform: perspective(1000px) translateZ(40px) rotateX(5deg) rotateY(365deg); }
}
@media (max-width: 600px) {
.logo {
font-size: 48px;
}
.input-container {
width: 95vw;
}
#messageInput, #decodeBtn {
font-size: 12px;
}
.error-message {
font-size: 12px;
top: -35px;
}
.certificate-container {
min-width: 260px;
min-height: 260px;
}
.certificate {
min-width: 220px;
min-height: 220px;
}
.certificate-title {
font-size: 22px;
-webkit-text-stroke: 0.8px #004d00;
text-shadow: 0 0 2px #00ff00;
}
.certificate p {
font-size: 10px;
}
.score-display {
font-size: 18px;
}
.emoji-reward {
font-size: 32px;
}
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=VT323&display=swap" rel="stylesheet">
</head>
<body>
<div class="logo">DECODER</div>
<div class="input-container">
<div class="error-message" id="errorMessage"></div>
<input type="text" id="messageInput" placeholder="Enter WebXOS code...">
<button id="decodeBtn">DECODE</button>
</div>
<div class="certificate-modal" id="certificateModal">
<div class="certificate-container">
<div class="certificate" id="certificate">
<h2 class="certificate-title" id="certificateTitle"></h2>
<div id="certificateContent"></div>
</div>
</div>
</div>
<script>
const input = document.getElementById('messageInput');
const decodeBtn = document.getElementById('decodeBtn');
const errorMessage = document.getElementById('errorMessage');
const certificateModal = document.getElementById('certificateModal');
const certificate = document.getElementById('certificate');
const certificateTitle = document.getElementById('certificateTitle');
const certificateContent = document.getElementById('certificateContent');
const certificateContainer = document.querySelector('.certificate-container');
// Show error message
function showError(message) {
errorMessage.textContent = message;
errorMessage.classList.add('show');
setTimeout(() => {
errorMessage.classList.remove('show');
errorMessage.textContent = '';
}, 3000);
}
// Random digit for scramble effect
const getRandomDigit = () => String.fromCharCode(48 + Math.floor(Math.random() * 10));
const getRandomDirection = () => Math.random();
// Convert hex back to string
function hexToString(hex) {
let str = '';
for (let i = 0; i < hex.length; i += 2) {
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
}
return str;
}
// Decoding function
function decodeWebXOS(code) {
if (!code || typeof code !== 'string' || !code.startsWith('WEBXOS-')) {
return {
success: false,
message: "ERROR: Invalid WebXOS code format. Must start with 'WEBXOS-'",
decoded: null
};
}
const parts = code.split('-');
if (parts.length !== 6) {
return {
success: false,
message: `ERROR: Invalid code structure. Expected 6 parts, got ${parts.length}`,
decoded: null
};
}
const [prefix, timestamp, encodedMessage, random1, random2, checksum] = parts;
try {
const decoded = hexToString(encodedMessage);
const expectedChecksum = (decoded.length * 17).toString(36).toUpperCase().padStart(4, '0');
if (checksum !== expectedChecksum) {
return {
success: false,
message: `ERROR: Checksum mismatch. Expected ${expectedChecksum}, got ${checksum}`,
decoded: null
};
}
return {
success: true,
message: `DECODED MESSAGE: ${decoded}`,
decoded: decoded,
timestamp: parseInt(timestamp, 36)
};
} catch (e) {
return {
success: false,
message: `ERROR: Decoding failed. ${e.message}`,
decoded: null
};
}
}
// Parse game data from decoded message
function parseGameData(decoded) {
const data = {};
const pairs = decoded.split(';');
pairs.forEach(pair => {
const [key, value] = pair.split(':');
if (key && value) {
data[key.trim()] = value.trim();
}
});
if (Object.keys(data).length === 0 && !isNaN(parseFloat(decoded))) {
data.Time = decoded;
data.WPM = 'N/A';
data.Lang = 'Unknown';
}
return data;
}
// Wrap text in spans for scramble effect
function wrapScrambleChars(text, isScore = false, isEmoji = false) {
if (isEmoji) {
return `<span class="emoji-reward" style="font-size: 40px; text-shadow: 0 0 8px #00ff00, 0 0 12px #00ffcc; margin: 8px 0; display: inline-block;">${text}</span>`;
}
const chars = text.split('');
return chars
.map((char, index) => `<span class="scramble-char" style="${isScore ? 'font-size: 22px; text-shadow: 0 0 8px #00ff00;' : ''}">${char}</span>`)
.join('');
}
// Apply scramble effect
function displayWithScramble(element, text, isScore = false, isEmoji = false) {
if (isEmoji) {
element.innerHTML = `<span class="emoji-reward" style="font-size: 40px; text-shadow: 0 0 8px #00ff00, 0 0 12px #00ffcc; margin: 8px 0; display: inline-block;">${text}</span>`;
return;
}
element.innerHTML = wrapScrambleChars(text, isScore, isEmoji);
const spans = element.querySelectorAll('.scramble-char');
const chars = text.split('');
spans.forEach((span, index) => {
span.textContent = getRandomDigit();
span.classList.add('dissolving');
span.style.setProperty('--rand-x', getRandomDirection());
span.style.setProperty('--rand-y', getRandomDirection());
});
let rebuildIndex = 0;
const rebuildInterval = setInterval(() => {
if (rebuildIndex >= spans.length) {
clearInterval(rebuildInterval);
return;
}
const span = spans[rebuildIndex];
span.textContent = chars[rebuildIndex] || ' ';
span.classList.remove('dissolving');
span.classList.add('rebuilding');
span.style.setProperty('--rand-x', getRandomDirection());
span.style.setProperty('--rand-y', getRandomDirection());
setTimeout(() => {
span.classList.remove('rebuilding');
}, 1400);
rebuildIndex++;
}, 25);
}
// Show certificate with scramble effect
function showCertificate(data, result) {
const game = data.Game || 'Code Crunch';
certificateTitle.textContent = '';
certificateContent.innerHTML = '';
certificate.classList.remove('spinning');
displayWithScramble(certificateTitle, game === 'Code Crunch' ? 'Code Crunch Certificate' : game);
if (game === 'WebX Universe') {
const content = `
<p>Name: ${data.Name}</p>
<p>Level: ${data.Level}</p>
<p>XP: ${data.XP || '0'}</p>
<p>Resources: ${data.Resources}</p>
`;
certificateContent.innerHTML = content;
const paragraphs = certificateContent.querySelectorAll('p');
paragraphs.forEach(p => {
const text = p.textContent;
p.innerHTML = '';
displayWithScramble(p, text);
});
} else if (game === 'Arachnid') {
const content = `
<p class="score-display">Score: ${data.Score}</p>
<p>Time: ${data.TimeElapsed}</p>
<p><a href="https://arachnid-leaderboard.com">Leaderboard - Coming Soon</a></p>
`;
certificateContent.innerHTML = content;
const scoreP = certificateContent.querySelector('.score-display');
const timeP = certificateContent.querySelector('p:not(.score-display):nth-child(2)');
const linkP = certificateContent.querySelector('p:last-child');
displayWithScramble(scoreP, `Score: ${data.Score}`, true);
displayWithScramble(timeP, `Time: ${data.TimeElapsed}`);
displayWithScramble(linkP, linkP.textContent);
} else if (game === 'Emoji Quest') {
const emojis = ['🏆', '🎖️', '✨', '🪐', '⚡'];
const rewardEmoji = emojis[Math.floor(Math.random() * emojis.length)];
const content = `
<p class="emoji-reward">${rewardEmoji}</p>
<p>Level: ${data.Level}</p>
<p>Gold: ${data.Gold}</p>
<p>Total XP: ${data.TotalXP}</p>
<p>Time: ${data.TimeElapsed}</p>
`;
certificateContent.innerHTML = content;
const emojiP = certificateContent.querySelector('.emoji-reward');
const otherPs = certificateContent.querySelectorAll('p:not(.emoji-reward)');
displayWithScramble(emojiP, rewardEmoji, false, true);
otherPs.forEach(p => {
const text = p.textContent;
p.innerHTML = '';
displayWithScramble(p, text);
});
} else if (game === 'Code Crunch') {
const wpm = data.WPM || 'N/A';
const lang = data.Lang || 'Unknown';
const time = data.Time || result.decoded;
const content = `
<p>Average WPM: ${wpm}</p>
<p>Language: ${lang}</p>
<p>Total Time: ${time} seconds</p>
`;
certificateContent.innerHTML = content;
const paragraphs = certificateContent.querySelectorAll('p');
paragraphs.forEach(p => {
const text = p.textContent;
p.innerHTML = '';
displayWithScramble(p, text);
});
}
// Dynamically adjust certificate size
setTimeout(() => {
const titleRect = certificateTitle.getBoundingClientRect();
const contentRect = certificateContent.getBoundingClientRect();
const padding = 30;
const newWidth = Math.max(260, titleRect.width + padding * 2);
const newHeight = Math.max(260, titleRect.height + contentRect.height + padding * 2);
const maxWidth = 600;
const maxHeight = 600;
certificate.style.width = `${Math.min(newWidth, maxWidth)}px`;
certificate.style.height = `${Math.min(newHeight, maxHeight)}px`;
certificateContainer.style.width = `${Math.min(newWidth + 40, maxWidth + 40)}px`;
certificateContainer.style.height = `${Math.min(newHeight + 40, maxHeight + 40)}px`;
}, 100);
certificateModal.style.display = 'flex';
}
// Handle certificate click for spinning and scramble effect
certificate.addEventListener('click', () => {
certificate.classList.remove('spinning');
void certificate.offsetWidth;
certificate.classList.add('spinning');
const titleText = certificateTitle.textContent;
displayWithScramble(certificateTitle, titleText);
const paragraphs = certificateContent.querySelectorAll('p');
paragraphs.forEach(p => {
const text = p.textContent;
p.innerHTML = '';
const isScore = p.classList.contains('score-display');
const isEmoji = p.classList.contains('emoji-reward');
displayWithScramble(p, text, isScore, isEmoji);
});
});
certificateModal.addEventListener('click', (e) => {
if (e.target === certificateModal) {
certificateModal.style.display = 'none';
certificate.classList.remove('spinning');
}
});
// Decode button handler
decodeBtn.addEventListener('click', () => {
const code = input.value.trim();
const result = decodeWebXOS(code);
if (result.success && result.decoded) {
const data = parseGameData(result.decoded);
showCertificate(data, result);
} else {
showError(result.message);
}
input.value = '';
});
input.addEventListener('keypress', (e) => {
if (e.key === 'Enter') {
decodeBtn.click();
}
});
</script>
</body>
</html>