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
|
package generator
// cosmosTemplate is a deep-space theme — a large ringed planet dominates the
// background, surrounded by swirling nebula clouds, an asteroid belt, and
// thousands of stars. Dark navy-black palette with golden/purple accents.
const cosmosTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>snonux.foo ✧ COSMOS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<style>
:root { --gold:#ffd166; --purple:#9b5de5; --blue:#4cc9f0; --bg:#020214; }
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Segoe UI',system-ui,sans-serif; background:var(--bg);
color:#d4e8ff; overflow:hidden; height:100vh; }
#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:16px 28px; background:rgba(2,2,20,0.78); backdrop-filter:blur(14px);
border-bottom:1px solid rgba(255,209,102,0.2); display:flex; align-items:center; justify-content:space-between; }
.logo { display:flex; align-items:center; gap:14px; }
.logo-mark { font-size:2rem; font-weight:800;
background:linear-gradient(90deg,var(--gold),var(--purple));
-webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.logo-title h1 { font-size:1.5rem; font-weight:700; color:#d4e8ff; }
.logo-title .subtitle { font-size:0.75rem; color:rgba(212,232,255,0.5); margin-top:2px; }
.logo-title .subtitle a { color:var(--gold); text-decoration:none; }
.logo-title .subtitle a:hover { text-shadow:0 0 8px var(--gold); }
.transmit-btn { border:1px solid var(--gold); color:var(--gold); padding:9px 20px;
border-radius:20px; text-decoration:none; font-size:0.85rem; transition:all 0.2s; }
.transmit-btn:hover { background:var(--gold); color:var(--bg); }
.nav-hints { background:rgba(2,2,20,0.6); border-bottom:1px solid rgba(255,209,102,0.12);
color:rgba(212,232,255,0.4); padding:5px 28px; display:flex; gap:18px;
font-size:0.68rem; flex-wrap:wrap; }
.nav-hints kbd { background:rgba(255,209,102,0.1); border:1px solid rgba(255,209,102,0.3);
color:var(--gold); border-radius:3px; padding:0 5px; margin:0 2px; }
.content { flex:1; overflow-y:auto; padding:20px 28px;
scrollbar-width:thin; scrollbar-color:var(--purple) var(--bg); }
.page-nav { display:flex; justify-content:center; margin:14px 0; }
.page-nav a { border:1px solid var(--purple); color:var(--purple); padding:8px 20px;
border-radius:20px; text-decoration:none; font-size:0.82rem; }
.page-nav a:hover { background:var(--purple); color:#fff; }
.post { background:rgba(5,5,30,0.72); border:1px solid rgba(155,93,229,0.22); border-radius:10px;
padding:20px; margin-bottom:14px; cursor:pointer;
transition:all 0.25s; backdrop-filter:blur(6px); }
.post:hover { border-color:var(--gold); box-shadow:0 0 22px rgba(255,209,102,0.18); transform:translateY(-2px); }
.post-active { border-color:var(--gold) !important; background:rgba(10,5,35,0.9) !important;
box-shadow:0 0 28px rgba(255,209,102,0.35),inset 3px 0 0 var(--gold) !important; }
.post-header { display:flex; justify-content:space-between; margin-bottom:12px; font-size:0.88rem; }
.post-time { color:var(--blue); font-family:monospace; font-size:0.8rem; }
.post-text { line-height:1.65; font-size:0.95rem; }
.post-text a { color:var(--blue); text-decoration:none; }
.post-text a:hover { text-shadow:0 0 8px var(--blue); }
.post-audio { width:100%; margin-top:10px; }
.post-modal { display:none; position:fixed; inset:0; z-index:100;
overflow-y:auto; padding:40px 20px; }
.post-modal.active { display:block; }
.modal-inner { max-width:760px; margin:0 auto; background:rgba(5,5,30,0.92);
border:1px solid var(--gold); border-radius:12px;
box-shadow:0 0 60px rgba(255,209,102,0.25); padding:40px; backdrop-filter:blur(16px); }
.modal-close { float:right; background:none; border:none; color:var(--gold);
font-size:0.9rem; cursor:pointer; letter-spacing:1px; }
@media(max-width:640px) { .nav-hints{display:none;} header{padding:12px 18px;} .content{padding:14px 18px;} }
</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>
// Cosmos WebGL: ringed planet, swirling nebula blobs, asteroid belt, and stars.
// The planet sits at lower-right and slowly rotates; asteroids orbit it;
// nebula clouds drift with additive blending for a deep-space glow.
(function() {
var scene, camera, renderer, clock;
var planet, planetRings = [];
var asteroids = [];
var ASTEROID_COUNT = 300;
var asteroidAngles, asteroidRadii, asteroidSpeeds, asteroidY;
function buildPlanet() {
// Planet body — warm golden tone
planet = new THREE.Mesh(
new THREE.SphereGeometry(14, 48, 48),
new THREE.MeshPhongMaterial({
color: 0xc8853a, emissive: 0x3a1800, emissiveIntensity: 0.4, shininess: 60
})
);
planet.position.set(28, -18, -55);
scene.add(planet);
// Ring system — 5 tilted torus rings in gold/purple
var ringCols = [0xffd166, 0xc07c30, 0xffd166, 0x9b5de5, 0xffd166];
for (var i = 0; i < 5; i++) {
var ring = new THREE.Mesh(
new THREE.TorusGeometry(18 + i * 2.5, 0.5 - i * 0.06, 8, 128),
new THREE.MeshBasicMaterial({ color: ringCols[i], transparent: true, opacity: 0.55 - i * 0.08, side: THREE.DoubleSide })
);
ring.position.copy(planet.position);
ring.rotation.x = Math.PI / 2.4;
ring.rotation.z = 0.2;
scene.add(ring);
planetRings.push(ring);
}
}
function buildNebula() {
// Large translucent additive blobs for the nebula cloud
var nCols = [0x9b5de5, 0x4cc9f0, 0x7b2fff, 0x4cc9f0, 0x9b5de5];
var nPos = [[-30,20,-80],[-10,-10,-90],[20,30,-70],[-20,-25,-95],[10,15,-85]];
nCols.forEach(function(c, i) {
var mesh = new THREE.Mesh(
new THREE.SphereGeometry(22 + i * 4, 16, 16),
new THREE.MeshBasicMaterial({
color: c, transparent: true, opacity: 0.09,
blending: THREE.AdditiveBlending, depthWrite: false
})
);
mesh.position.set(nPos[i][0], nPos[i][1], nPos[i][2]);
scene.add(mesh);
});
}
function buildAsteroids() {
asteroidAngles = new Float32Array(ASTEROID_COUNT);
asteroidRadii = new Float32Array(ASTEROID_COUNT);
asteroidSpeeds = new Float32Array(ASTEROID_COUNT);
asteroidY = new Float32Array(ASTEROID_COUNT);
var geo = new THREE.BufferGeometry();
var pos = new Float32Array(ASTEROID_COUNT * 3);
for (var i = 0; i < ASTEROID_COUNT; i++) {
asteroidAngles[i] = Math.random() * Math.PI * 2;
asteroidRadii[i] = 20 + Math.random() * 12;
asteroidSpeeds[i] = 0.003 + Math.random() * 0.004;
asteroidY[i] = (Math.random() - 0.5) * 3;
pos[i*3] = pos[i*3+1] = pos[i*3+2] = 0;
}
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
asteroids = new THREE.Points(geo, new THREE.PointsMaterial({
color: 0xaaaaaa, size: 0.3, transparent: true, opacity: 0.7
}));
// Asteroids orbit the planet — they live in planet-relative coords
planet.add(asteroids);
}
function buildStars() {
var pos = new Float32Array(2500 * 3);
for (var i = 0; i < 2500 * 3; i += 3) {
var r = 100 + Math.random() * 80, t = Math.random() * Math.PI * 2, p = Math.acos(2 * Math.random() - 1);
pos[i] = r * Math.sin(p) * Math.cos(t);
pos[i+1] = r * Math.sin(p) * Math.sin(t);
pos[i+2] = r * Math.cos(p);
}
var geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
scene.add(new THREE.Points(geo, new THREE.PointsMaterial({ color: 0xffffff, size: 0.18, transparent: true, opacity: 0.85 })));
}
function initThree() {
scene = new THREE.Scene();
scene.background = new THREE.Color(0x020214);
scene.fog = new THREE.Fog(0x020214, 80, 200);
camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.1, 300);
camera.position.set(0, 6, 38);
camera.lookAt(0, 0, 0);
renderer = new THREE.WebGLRenderer({ canvas: document.getElementById('three-canvas'), antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
clock = new THREE.Clock();
scene.add(new THREE.AmbientLight(0x4cc9f0, 0.4));
var sun = new THREE.PointLight(0xffd166, 3, 300);
sun.position.set(-60, 40, 30);
scene.add(sun);
buildPlanet();
buildNebula();
buildAsteroids();
buildStars();
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);
var t = clock.getElapsedTime();
planet.rotation.y += 0.0015;
// Update asteroid belt positions
var pos = asteroids.geometry.attributes.position;
for (var i = 0; i < ASTEROID_COUNT; i++) {
asteroidAngles[i] += asteroidSpeeds[i];
var a = asteroidAngles[i], r = asteroidRadii[i];
pos.setXYZ(i, Math.cos(a) * r, asteroidY[i], Math.sin(a) * r);
}
pos.needsUpdate = true;
// Camera orbits gently
camera.position.x = Math.sin(t * 0.06) * 6;
camera.position.y = 6 + Math.sin(t * 0.04) * 2;
renderer.render(scene, camera);
}
initThree();
})();
</script>
{{template "navscript" .}}
</body>
</html>`
|