From c3e67bf6e6386f6a549241c6e7c15cd4ac8e0a49 Mon Sep 17 00:00:00 2001 From: oiupoyt Date: Sat, 12 Sep 2026 16:16:24 +0530 Subject: [PATCH] fix: resolve temporal dead zone ReferenceError on bgVideo and make boot screen entry instantaneous --- index.html | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index ecae0ff..504aab5 100644 --- a/index.html +++ b/index.html @@ -760,7 +760,7 @@ -
+
[ click to enter ]
@@ -1614,6 +1614,7 @@ // ── Unique Cybernetic & Audio-Reactive Background Engine ──────────────── const bgCanvas = document.getElementById('bgCanvas'); const bgCtx = bgCanvas.getContext('2d'); + const bgVideo = document.getElementById('bgVideo'); const katToast = document.getElementById('katToast'); let toastTimer = null; @@ -2026,7 +2027,6 @@ setInterval(updateClock, 1000); // ── Background Video Loader ────────────────────────────────────────────── - const bgVideo = document.getElementById('bgVideo'); async function tryLoadBgVideo() { for (const name of ['backgroundVideo.mp4', 'backgroundVideo.webm']) { try { @@ -2043,18 +2043,32 @@ } // ── Loading Screen Enter ───────────────────────────────────────────────── - const loadingScreen = document.getElementById('loadingScreen'); - loadingScreen.addEventListener('click', () => { - loadingScreen.classList.add('hidden'); - tryLoadBgVideo(); - setTimeout(() => { - playMusic(); - focusTermInput(); - }, 300); - }); + function enterKatOS() { + const loadingScreen = document.getElementById('loadingScreen'); + if (loadingScreen && !loadingScreen.classList.contains('hidden')) { + loadingScreen.classList.add('hidden'); + tryLoadBgVideo(); + setTimeout(() => { + playMusic(); + focusTermInput(); + }, 250); + } + } + window.enterKatOS = enterKatOS; - // Keyboard Shortcut (Space to play/pause music) + const loadingScreen = document.getElementById('loadingScreen'); + if (loadingScreen) { + loadingScreen.addEventListener('click', enterKatOS); + } + + // Keyboard Shortcut (Space to play/pause music, Enter/Space to enter from boot screen) window.addEventListener('keydown', e => { + const loadingEl = document.getElementById('loadingScreen'); + if (loadingEl && !loadingEl.classList.contains('hidden')) { + e.preventDefault(); + enterKatOS(); + return; + } if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return; if (e.code === 'Space') { e.preventDefault();