-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
87 lines (81 loc) · 1.88 KB
/
Copy pathexample.html
File metadata and controls
87 lines (81 loc) · 1.88 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>WOPR Decryptor - Preview</title>
<link href="./dist/styles.css" rel="stylesheet" />
<style>
body {
margin: 0;
padding: 0;
background: #000;
font-family: 'Courier New', monospace;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
}
#app {
display: flex;
justify-content: center;
align-items: center;
width: 90vw;
max-width: 1400px;
}
#app .wopr-root {
width: 100%;
max-width: none;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="module">
import { WOPRDecryptor } from './dist/index.js';
const container = document.getElementById('app');
const wopr = new WOPRDecryptor({
container: container,
codes: ['CPE1704TKS', 'DEFCON-1', 'NORAD-ALPHA-7'],
direction: 'random', // 'ltr', 'rtl', or 'random'
cycles: 0, // 0 = infinite loop through codes
timing: {
durationMs: 10000,
tickInterval: 70,
},
audio: {
enabled: false,
volume: 0.12,
},
ui: {
showOverlay: true,
overlayText: 'INITIATE DECRYPTION',
blinkOnSolved: true,
},
});
// Listen to events (auto-looping handled by cycles: 0)
wopr.on('complete', (code) => {
console.log('✓ Code decrypted:', code);
});
wopr.on('lock', (index, char) => {
console.log(`Character locked at position ${index}: ${char}`);
});
// Keyboard controls
window.addEventListener('keydown', (e) => {
if (e.key === 'r' || e.key === 'R') {
wopr.reset();
wopr.start();
}
if (e.key === 'n' || e.key === 'N') {
wopr.next();
wopr.start();
}
if (e.key === ' ') {
e.preventDefault();
wopr.start();
}
});
</script>
</body>
</html>