The Essence of Light Center

  • About
  • Audio
  • Book
  • Podcast
  • Video-library


* 4. Save * * Works on EVERY page of your WordPress site. * ═══════════════════════════════════════════════════════════════ */ (function () { 'use strict'; /* Wait for DOM ready */ if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } function init() { /* Don't inject if already present (avoid duplicates) */ if (document.getElementById('ge-canvas')) return; /* ─────────────────────────────────────────── 1. INJECT STAR CANVAS ─────────────────────────────────────────── */ var cv = document.createElement('canvas'); cv.id = 'ge-canvas'; cv.setAttribute('aria-hidden', 'true'); document.body.insertBefore(cv, document.body.firstChild); /* ─────────────────────────────────────────── 2. INJECT SACRED GEOMETRY SVG ─────────────────────────────────────────── */ var sacred = document.createElement('div'); sacred.id = 'ge-sacred'; sacred.setAttribute('aria-hidden', 'true'); sacred.innerHTML = [ '', '', /* Flower of Life */ '', '', '', '', '', '', '', '', '', /* Star of David */ '', '', /* Radial lines */ '', '', '', /* Outer petals */ '', '', '', '', '', '', '', '' ].join(''); document.body.insertBefore(sacred, document.body.firstChild); /* ─────────────────────────────────────────── 3. ADD BODY CLASS (so CSS cosmic bg applies) If page doesn't have a ge- class, we give it a generic one so the gradient shows up. ─────────────────────────────────────────── */ var hasPageClass = /\b(home|about|audio|video|book)-page\b/.test(document.body.className); if (!hasPageClass) { document.body.classList.add('home-page'); } /* ─────────────────────────────────────────── 4. ANIMATED STAR CANVAS ─────────────────────────────────────────── */ var cx = cv.getContext('2d'); var W, H, stars = []; function resize() { W = cv.width = window.innerWidth; H = cv.height = window.innerHeight; } function makeStars() { stars = []; /* Density: ~1 star per 8000 pixels, capped */ var count = Math.min(Math.floor((W * H) / 8000), 300); for (var i = 0; i < count; i++) { stars.push({ x: Math.random() * W, y: Math.random() * H, r: Math.random() * 1.5 + 0.25, a: Math.random() * 0.8 + 0.35, sp: Math.random() * 0.32 + 0.06, ph: Math.random() * Math.PI * 2, gold: Math.random() < 0.08 }); } } function draw(t) { cx.clearRect(0, 0, W, H); var time = (t || 0) * 0.001; for (var i = 0; i < stars.length; i++) { var s = stars[i]; var alpha = s.a * (0.36 + 0.64 * Math.sin(time * s.sp + s.ph)); cx.beginPath(); cx.arc(s.x, s.y, s.r, 0, Math.PI * 2); cx.fillStyle = s.gold ? 'rgba(184,146,58,' + alpha + ')' : 'rgba(255,255,255,' + alpha + ')'; cx.fill(); } requestAnimationFrame(draw); } resize(); makeStars(); requestAnimationFrame(draw); /* Debounced resize handler */ var resizeTimer; window.addEventListener('resize', function () { clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { resize(); makeStars(); }, 150); }); console.info( '%c✦ Гэрлийн Эрин Төв ✦%c Star background loaded', 'color:#f0cc80;font-style:italic;', 'color:#888;' ); } })();