diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-25 22:13:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-25 22:13:32 +0300 |
| commit | a5cb9f7ad4b2bcb7ac367854147f661ab83c5ec1 (patch) | |
| tree | 96db490ed72dec49c4bc2aba8539fd57f3246f47 /internal/generator/templates/themes/cosmos | |
| parent | cc9c69ce748416ad1d9b28592ec463434023d63c (diff) | |
can swap themes dynamicallyv0.12.0
Diffstat (limited to 'internal/generator/templates/themes/cosmos')
| -rw-r--r-- | internal/generator/templates/themes/cosmos/meta.json | 7 | ||||
| -rw-r--r-- | internal/generator/templates/themes/cosmos/theme.css | 81 | ||||
| -rw-r--r-- | internal/generator/templates/themes/cosmos/theme.js | 239 |
3 files changed, 327 insertions, 0 deletions
diff --git a/internal/generator/templates/themes/cosmos/meta.json b/internal/generator/templates/themes/cosmos/meta.json new file mode 100644 index 0000000..7f7b880 --- /dev/null +++ b/internal/generator/templates/themes/cosmos/meta.json @@ -0,0 +1,7 @@ +{ + "title": "snonux.foo ✧ COSMOS", + "header_html": "\u003cdiv class=\"logo\"\u003e\n \u003cspan class=\"logo-mark\"\u003eSN\u003c/span\u003e\n \u003cdiv class=\"logo-title\"\u003e\n \u003ch1\u003esnonux.foo\u003c/h1\u003e\n \u003cp class=\"subtitle\"\u003emicroblog \u0026mdash; \u003ca href=\"https://foo.zone\"\u003efoo.zone\u003c/a\u003e is the real blog\u003c/p\u003e\n \u003cp class=\"logo-host\"\u003eServed by NetBSD on a Raspberry Pi 3\u003c/p\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n \u003cdiv class=\"nav\"\u003e\n \u003ca href=\"atom.xml\" class=\"header-feed-link\" rel=\"alternate\" title=\"Atom feed\" type=\"application/atom+xml\"\u003eAtom feed\u003c/a\u003e\n \u003ca href=\"https://foo.zone/about\" class=\"transmit-btn\"\u003eTransmit\u003c/a\u003e\n \u003c/div\u003e", + "splash_inner_html": "\u003ccanvas class=\"splash-gl-canvas\" id=\"splash-gl-canvas\" aria-hidden=\"true\"\u003e\u003c/canvas\u003e\n \u003cdiv class=\"splash-stars\" aria-hidden=\"true\"\u003e\u003c/div\u003e\n \u003cdiv class=\"splash-inner\"\u003e\n \u003cdiv class=\"splash-orbit\" aria-hidden=\"true\"\u003e\u003c/div\u003e\n \u003cdiv class=\"splash-title\"\u003esnonux.foo\u003c/div\u003e\n \u003cdiv class=\"splash-tag\"\u003eCosmos gate\u003c/div\u003e\n \u003cdiv class=\"splash-hint\"\u003eEngage — click or Enter\u003c/div\u003e\n \u003c/div\u003e", + "prev_page_text": "\u0026larr; Newer", + "next_page_text": "Older \u0026rarr;" +} diff --git a/internal/generator/templates/themes/cosmos/theme.css b/internal/generator/templates/themes/cosmos/theme.css new file mode 100644 index 0000000..eff1267 --- /dev/null +++ b/internal/generator/templates/themes/cosmos/theme.css @@ -0,0 +1,81 @@ + :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); } + a.header-feed-link { color:var(--blue); } + a.header-feed-link:hover { color:var(--gold); } + .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; } + .page-nav-footer { flex-shrink:0; padding:8px 28px; display:flex; justify-content:center; + background:rgba(2,2,20,0.78); backdrop-filter:blur(14px); + border-top:1px solid rgba(255,209,102,0.2); } + .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;} } + [data-sno-theme="cosmos"] .splash-overlay { background: radial-gradient(ellipse 100% 80% at 50% 100%, rgba(155,93,229,0.2) 0%, transparent 55%), var(--bg); } + [data-sno-theme="cosmos"] .splash-stars { + position:absolute; inset:0; pointer-events:none; opacity:0.5; + background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.9), transparent), + radial-gradient(1px 1px at 80% 20%, rgba(255,209,102,0.8), transparent), + radial-gradient(1px 1px at 40% 70%, rgba(76,201,240,0.7), transparent), + radial-gradient(1px 1px at 65% 55%, rgba(255,255,255,0.6), transparent); + background-size: 100% 100%; + animation: splashTwinkle 4s ease-in-out infinite alternate; + } + @keyframes splashTwinkle { from { opacity:0.35; } to { opacity:0.65; } } + [data-sno-theme="cosmos"] .splash-inner { position:relative; z-index:1; } + [data-sno-theme="cosmos"] .splash-orbit { + width:72px; height:72px; margin:0 auto 1rem; border:2px solid rgba(255,209,102,0.5); + border-radius:50%; animation: splashOrbitSpin 12s linear infinite; + box-shadow: 0 0 30px rgba(155,93,229,0.4); + } + @keyframes splashOrbitSpin { to { transform: rotate(360deg); } } + [data-sno-theme="cosmos"] .splash-title { font-size:clamp(1.45rem,4.5vw,2rem); color:#d4e8ff; } + [data-sno-theme="cosmos"] .splash-tag { + background:linear-gradient(90deg,var(--gold),var(--purple)); + -webkit-background-clip:text; -webkit-text-fill-color:transparent; } + [data-sno-theme="cosmos"] .splash-hint { color:rgba(212,232,255,0.88); } + [data-sno-theme="cosmos"] .splash-stars { z-index:1; } + [data-sno-theme="cosmos"] .splash-inner { text-shadow: 0 2px 20px rgba(0,0,0,0.85); } diff --git a/internal/generator/templates/themes/cosmos/theme.js b/internal/generator/templates/themes/cosmos/theme.js new file mode 100644 index 0000000..be51bd7 --- /dev/null +++ b/internal/generator/templates/themes/cosmos/theme.js @@ -0,0 +1,239 @@ + + (function(){ + if(document.documentElement.classList.contains('sno-splash-skip'))return; + var cv=document.getElementById('splash-gl-canvas'); + if(!cv||typeof THREE==='undefined')return; + var raf,ren,sc,ca,g=new THREE.Group(),t0=performance.now(); + function cleanup(){window.removeEventListener('resize',sz);if(raf)cancelAnimationFrame(raf);raf=null;if(ren)ren.dispose();ren=null;window._snonuxSplashWebGLCleanup=null;} + window._snonuxSplashWebGLCleanup=cleanup; + function sz(){var w=cv.clientWidth||2,h=cv.clientHeight||2;if(ren)ren.setSize(w,h,false);if(ca){ca.aspect=w/h;ca.updateProjectionMatrix();}} + ren=new THREE.WebGLRenderer({canvas:cv,antialias:true,alpha:true});ren.setClearColor(0,0);ren.setPixelRatio(Math.min(window.devicePixelRatio||1,2)); + sc=new THREE.Scene();ca=new THREE.PerspectiveCamera(48,1,0.1,90);ca.position.set(0,0.5,10); + var planet=new THREE.Mesh(new THREE.SphereGeometry(1.35,24,24),new THREE.MeshBasicMaterial({color:0xc8853a,transparent:true,opacity:0.92})); + var ring=new THREE.Mesh(new THREE.TorusGeometry(2.1,0.05,8,64),new THREE.MeshBasicMaterial({color:0xffd166,transparent:true,opacity:0.85})); + ring.rotation.x=Math.PI/2.25;var moon=new THREE.Mesh(new THREE.SphereGeometry(0.35,12,12),new THREE.MeshBasicMaterial({color:0x9b5de5,transparent:true,opacity:0.8})); + moon.position.set(2.8,0.6,0.5);g.add(planet);g.add(ring);g.add(moon);sc.add(g);sz();window.addEventListener('resize',sz); + function loop(now){raf=requestAnimationFrame(loop);var t=(now-t0)*0.001;g.rotation.y=t*0.22;planet.rotation.y=t*0.35; + moon.position.x=2.6*Math.cos(t*0.7);moon.position.z=2.6*Math.sin(t*0.7);ren.render(sc,ca);} + raf=requestAnimationFrame(loop); + })(); + + + // 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 _wild = false; + 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(); + + var sm = _wild ? 22 : 1; + planet.rotation.y += 0.0015 * sm; + + // Planet rings tilt and counter-spin wildly + for (var ri = 0; ri < planetRings.length; ri++) { + planetRings[ri].rotation.y += 0.002 * sm; + planetRings[ri].rotation.z += 0.001 * sm * (ri % 2 === 0 ? 1 : -1); + } + + // Asteroid belt: warp-speed orbit + radial breathing + vertical scatter in wild + var pos = asteroids.geometry.attributes.position; + for (var i = 0; i < ASTEROID_COUNT; i++) { + asteroidAngles[i] += asteroidSpeeds[i] * sm; + var a = asteroidAngles[i]; + var r = asteroidRadii[i] + (_wild ? Math.sin(t * 2.1 + i * 0.3) * 9 : 0); + var y = asteroidY[i] + (_wild ? Math.sin(t * 3.0 + i * 0.7) * 2.5 : 0); + pos.setXYZ(i, Math.cos(a) * r, y, Math.sin(a) * r); + } + pos.needsUpdate = true; + + // Camera: chaotic deep-space flight in wild, gentle orbit otherwise + if (_wild) { + camera.position.x = Math.sin(t * 0.38) * 20; + camera.position.y = 6 + Math.sin(t * 0.29) * 10; + camera.position.z = 38 + Math.sin(t * 0.21) * 14; + camera.fov = 60 + Math.sin(t * 0.47) * 18; + } else { + camera.position.x = Math.sin(t * 0.06) * 6; + camera.position.y = 6 + Math.sin(t * 0.04) * 2; + camera.position.z = 38; + camera.fov = 60; + } + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); + } + + initThree(); + + // Cosmos nav/wild effects — shooting star on navigate, warp speed on wild + window.snonuxOpenEffect = function(post) { + // Materialise from deep space — zoom + gold shimmer + orbiting ring + var modal = document.getElementById('post-modal'); + if (modal) { modal.classList.add('sno-modal-zoom'); setTimeout(function() { modal.classList.remove('sno-modal-zoom'); }, 400); } + var r = post ? post.getBoundingClientRect() : {left: window.innerWidth/2, top: window.innerHeight/2, width: 0, height: 0}; + var ring = document.createElement('div'); + ring.style.cssText = 'position:fixed;top:' + (r.top+r.height/2-5) + 'px;left:' + (r.left+r.width/2-5) + 'px;z-index:997;pointer-events:none;width:10px;height:10px;border-radius:50%;border:2px solid rgba(255,209,102,0.85);box-shadow:0 0 12px rgba(155,93,229,0.5);transition:all 0.4s ease,opacity 0.4s'; + document.body.appendChild(ring); + setTimeout(function() { ring.style.transform='scale(32)'; ring.style.opacity='0'; setTimeout(function() { ring.remove(); }, 440); }, 15); + }; + window.snonuxCloseEffect = function() { + var d = document.createElement('div'); + d.style.cssText = 'position:fixed;inset:0;z-index:998;pointer-events:none;background:radial-gradient(ellipse at center,rgba(155,93,229,0.12) 0%,transparent 65%);transition:opacity 0.25s'; + document.body.appendChild(d); + setTimeout(function() { d.style.opacity='0'; setTimeout(function() { d.remove(); }, 280); }, 15); + }; + window.snonuxScrollEffect = function(dir) { + var isDown = dir === 'down'; + var thick = _wild ? '14px' : '5px'; + var d = document.createElement('div'); + // Cosmos: purple-to-gold stardust streak + d.style.cssText = 'position:fixed;left:0;right:0;height:' + thick + ';z-index:9000;pointer-events:none;' + + 'background:linear-gradient(90deg,transparent,rgba(155,93,229,0.9),rgba(255,200,0,0.9),rgba(155,93,229,0.9),transparent);' + + (isDown ? 'top:0;' : 'bottom:0;') + + 'transition:transform 0.3s ease,opacity 0.3s ease;'; + document.body.appendChild(d); + setTimeout(function() { d.style.transform = isDown ? 'translateY(100vh)' : 'translateY(-100vh)'; d.style.opacity='0'; }, 16); + setTimeout(function() { d.remove(); }, 380); + }; + window.snonuxWildToggle = function() { + _wild = !_wild; + var b = document.getElementById('sno-wild-badge'); + if (b) b.classList.toggle('sno-wild-on', _wild); + }; + window.snonuxNavEffect = function() { + // Shooting star CSS line flashes across screen + var d = document.createElement('div'); + var angle = 30 + Math.random() * 30; + d.style.cssText = 'position:fixed;top:' + (10+Math.random()*40) + '%;left:-10%;z-index:998;pointer-events:none;width:35%;height:2px;background:linear-gradient(90deg,transparent,rgba(255,209,102,0.9),transparent);transform:rotate(-' + angle + 'deg);transition:left 0.28s ease,opacity 0.28s'; + document.body.appendChild(d); + setTimeout(function() { d.style.left='110%'; d.style.opacity='0'; setTimeout(function() { d.remove(); }, 320); }, 20); + }; + window.snonuxPageEffect = function() { + // Warp flash — stars streak white + var d = document.createElement('div'); + d.style.cssText = 'position:fixed;inset:0;z-index:998;pointer-events:none;background:radial-gradient(ellipse at center,rgba(255,255,255,0.25) 0%,transparent 70%);transition:opacity 0.2s'; + document.body.appendChild(d); + setTimeout(function() { d.style.opacity='0'; setTimeout(function() { d.remove(); }, 230); }, 20); + }; + })(); |
