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
|
package generator
// matrixTemplate is a hacker-style theme inspired by The Matrix — black
// background, bright matrix-green (#00ff41) text, monospace throughout,
// no decorations beyond a faint scanline overlay.
// WebGL scene: digital rain particle columns that simulate the iconic falling
// green characters, with vertex-colour fading from bright head to dark tail.
const matrixTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>snonux.foo // MATRIX</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<style>
:root { --g:#00ff41; --g2:#008f11; --g3:#003b00; --bg:#000; }
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Courier New',Courier,monospace; background:var(--bg); color:var(--g);
overflow:hidden; height:100vh; }
/* scanline overlay sits above WebGL */
body::before { content:''; position:fixed; inset:0; z-index:999; pointer-events:none;
background:repeating-linear-gradient(0deg,transparent,transparent 3px,
rgba(0,0,0,0.08) 3px,rgba(0,0,0,0.08) 4px); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
/* WebGL background canvas */
#three-canvas { position:fixed; top:0; left:0; width:100%; height:100%; z-index:1; }
.overlay { position:relative; z-index:10; height:100vh; display:flex; flex-direction:column; }
header { padding:12px 24px; background:#000; border-bottom:1px solid var(--g2);
display:flex; align-items:center; justify-content:space-between; }
.logo { display:flex; align-items:center; gap:14px; }
.logo-mark { font-size:1.8rem; color:var(--g); text-shadow:0 0 18px var(--g); letter-spacing:3px; }
/* blinking cursor after logo mark */
.logo-mark::after { content:'_'; animation:blink 1.2s step-start infinite; }
.logo-title h1 { font-size:1.2rem; color:var(--g); text-shadow:0 0 10px var(--g);
letter-spacing:4px; font-weight:normal; }
.logo-title .subtitle { font-size:0.72rem; color:var(--g2); margin-top:2px; letter-spacing:1px; }
.logo-title .subtitle a { color:var(--g); text-decoration:none; }
.logo-title .subtitle a:hover { text-shadow:0 0 6px var(--g); }
.transmit-btn { border:1px solid var(--g2); color:var(--g); padding:8px 18px;
text-decoration:none; font-size:0.82rem; letter-spacing:2px;
transition:all 0.1s; }
.transmit-btn:hover { background:var(--g); color:var(--bg); }
.nav-hints { background:#000; border-bottom:1px solid var(--g3); color:var(--g2);
padding:4px 24px; display:flex; gap:18px; font-size:0.68rem; flex-wrap:wrap; }
.nav-hints kbd { background:transparent; border:1px solid var(--g3); color:var(--g);
padding:0 5px; font-size:0.68rem; margin:0 2px; }
.content { flex:1; overflow-y:auto; padding:14px 24px;
scrollbar-width:thin; scrollbar-color:var(--g2) var(--bg); }
.page-nav { display:flex; justify-content:center; margin:12px 0; }
.page-nav a { border:1px solid var(--g2); color:var(--g); padding:7px 20px;
text-decoration:none; font-size:0.82rem; letter-spacing:2px; }
.page-nav a:hover { background:var(--g); color:var(--bg); }
.post { background:#000; border:1px solid var(--g3); padding:16px 18px;
margin-bottom:10px; cursor:pointer; transition:border-color 0.15s; }
.post:hover { border-color:var(--g2); box-shadow:0 0 8px rgba(0,255,65,0.2); }
.post-active { border-color:var(--g) !important; background:rgba(0,255,65,0.03) !important;
box-shadow:0 0 14px rgba(0,255,65,0.3),inset 3px 0 0 var(--g) !important; }
.post-header { display:flex; justify-content:space-between; margin-bottom:10px; font-size:0.85rem; }
.post-time { color:var(--g2); font-size:0.78rem; }
.post-text { line-height:1.6; font-size:0.88rem; }
.post-text a { color:var(--g); text-decoration:underline; }
.post-image { max-width:100%; margin-top:10px; border:1px solid var(--g3); }
.post-audio { width:100%; margin-top:10px; }
.post-modal { display:none; position:fixed; inset:0; z-index:100;
background:rgba(0,0,0,0.98); overflow-y:auto; padding:40px 20px; }
.post-modal.active { display:block; }
.modal-inner { max-width:740px; margin:0 auto; background:#000;
border:1px solid var(--g); padding:36px;
box-shadow:0 0 40px rgba(0,255,65,0.25); }
.modal-close { float:right; background:none; border:none; color:var(--g2);
font-family:monospace; font-size:0.9rem; cursor:pointer; letter-spacing:2px; }
@media(max-width:640px) { .nav-hints{display:none;} header{padding:10px 16px;} .content{padding:10px 16px;} }
</style>
</head>
<body>
<canvas id="three-canvas"></canvas>
<div class="overlay">
<header>
<div class="logo">
<span class="logo-mark">SN</span>
<div class="logo-title">
<h1>SNONUX.FOO</h1>
<p class="subtitle">MICROBLOG / <a href="https://foo.zone">FOO.ZONE</a> IS THE REAL BLOG</p>
</div>
</div>
<div class="nav">
<a href="https://foo.zone/about" class="transmit-btn">TRANSMIT</a>
</div>
</header>
{{template "navhints" .}}
<div class="content" id="post-content">
{{if .PrevPage}}<div class="page-nav"><a href="{{.PrevPage}}"><-- NEWER</a></div>{{end}}
{{range $i, $post := .Posts}}
<div class="post" data-index="{{$i}}" onclick="selectPost({{$i}})">
<div class="post-header">
<div><strong>@snonux</strong></div>
<div class="post-time">{{$post.FormattedTime}}</div>
</div>
<div class="post-text">{{$post.ContentHTML}}</div>
</div>
{{end}}
{{if .NextPage}}<div class="page-nav"><a href="{{.NextPage}}">OLDER --></a></div>{{end}}
</div>
</div>
{{template "navmodal" .}}
<script>
// Matrix WebGL scene: 80 columns of falling particles with per-vertex colour.
// Each column has a "head" that falls at a random speed; particles near the head
// are bright green and fade to near-black further behind, simulating digital rain.
(function() {
var NUM_COLS = 80; // number of rain columns
var COL_LEN = 25; // particles per column
var SPACING = 2.2; // vertical gap between particles in a column
var Y_TOP = 30; // world-space top of the rain field
var Y_BOTTOM = -30; // world-space bottom
var scene, camera, renderer;
var points;
var posArr, colArr;
// Per-column state: x position, head y, and fall speed
var colX = [], headY = [], speed = [];
function initThree() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0x000000);
camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 200);
camera.position.set(0, 0, 50);
renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('three-canvas'), antialias: false });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
var totalPts = NUM_COLS * COL_LEN;
posArr = new Float32Array(totalPts * 3);
colArr = new Float32Array(totalPts * 3);
// Spread columns across x: -50..50; initialise heads at random y positions
for (var c = 0; c < NUM_COLS; c++) {
colX[c] = -50 + (c / (NUM_COLS - 1)) * 100;
headY[c] = Y_TOP - Math.random() * (Y_TOP - Y_BOTTOM);
speed[c] = 0.08 + Math.random() * 0.07; // 0.08–0.15 units per frame
}
var geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(posArr, 3));
geo.setAttribute('color', new THREE.BufferAttribute(colArr, 3));
var mat = new THREE.PointsMaterial({ size: 0.35, vertexColors: true });
points = new THREE.Points(geo, mat);
scene.add(points);
window.addEventListener('resize', onResize);
animate();
}
function onResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function animate() {
requestAnimationFrame(animate);
for (var c = 0; c < NUM_COLS; c++) {
// Advance the head downward each frame
headY[c] -= speed[c];
// When the head exits the bottom, reset to a random point above the top
if (headY[c] < Y_BOTTOM - COL_LEN * SPACING) {
headY[c] = Y_TOP + Math.random() * 20;
}
var base = c * COL_LEN;
for (var p = 0; p < COL_LEN; p++) {
var i = base + p;
var y = headY[c] + p * SPACING; // particles trail upward from head
posArr[i * 3] = colX[c];
posArr[i * 3 + 1] = y;
posArr[i * 3 + 2] = 0;
// Brightness falls off with distance behind the head:
// p=0 is the head (bright), p=COL_LEN-1 is the tail (dim)
var bright = Math.max(0, 1 - p / (COL_LEN * 0.7));
// Head particle: #00ff41, tail: #003b00
colArr[i * 3] = 0;
colArr[i * 3 + 1] = bright * (p === 0 ? 1.0 : 0.88);
colArr[i * 3 + 2] = bright * (p === 0 ? 0.255 : 0.04);
}
}
points.geometry.attributes.position.needsUpdate = true;
points.geometry.attributes.color.needsUpdate = true;
renderer.render(scene, camera);
}
initThree();
})();
</script>
{{template "navscript" .}}
</body>
</html>`
|