Skip to main content

New Commit: Update reader.js

Repository: Hestenb62/_legacy_backup

Author: Hesten Berger

Commit Message: Update reader.js

URL: https://github.com/Hestenb62/_legacy_backup/commit/9eb12b790d4b0d8de3f6ba3315d58181fbc21f4d

Code Changes:

diff --git a/library/read/reader.js b/library/read/reader.js
index 541586d..f43c351 100644
--- a/library/read/reader.js
+++ b/library/read/reader.js
@@ -21,23 +21,33 @@ document.addEventListener("DOMContentLoaded", () => {
     const SCROLL_POS_KEY = `hesten_scroll_pos_${bookId}_chapter_${currentChapter}`;
     const COMPLETION_KEY = `hesten_completion_pct_${bookId}`;
 
-    const saveScrollProgress = debounce(() => {
-        const scrollTop = window.scrollY || document.documentElement.scrollTop;
-        const docHeight = document.documentElement.scrollHeight - window.innerHeight;
-        if (docHeight <= 0) return;
-
-        const scrollPct = Math.min(100, Math.max(0, (scrollTop / docHeight) * 100));
+    function debounce(func, wait) {
+        let timeout;
+        return (...args) => {
+            clearTimeout(timeout);
+            timeout = setTimeout(() => func.apply(this, args), wait);
+        };
+    }
 
+    const saveScrollPosition = debounce((scrollTop, scrollPct) => {
         try {
             localStorage.setItem(SCROLL_POS_KEY, scrollTop);
-
             const totalCh = window.BOOK_METADATA ? (window.BOOK_METADATA.totalChapters || 1) : 1;
             const overallPct = Math.round(((currentChapter - 1) / totalCh) * 100 + (scrollPct / totalCh));
             localStorage.setItem(COMPLETION_KEY, overallPct);
         } catch (e) {}
     }, 150);
 
-    window.addEventListener("scroll", saveScrollProgress);
+    window.addEventListener("scroll", () => {
+        const scrollTop = window.scrollY || document.documentElement.scrollTop;
+        const docHeight = document.documentElement.scrollHeight - window.innerHeight;
+        const scrollPct = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0;
+        
+        if (progressFill) progressFill.style.width = scrollPct + '%';
+        if (goToTopBtn) goToTopBtn.style.display = scrollTop > 300 ? "block" : "none";
+
+        saveScrollPosition(scrollTop, scrollPct);
+    });
 
     // Prompt to resume reading if scrolled past 150px previously
     setTimeout(() => {
@@ -255,49 +265,13 @@ document.addEventListener("DOMContentLoaded", () => {
         }
     });
 
-    // --- Progress Tracking & Go To Top & Bookmark Restore ---
-    window.addEventListener("scroll", () => {
-        const scrollTop = window.scrollY;
-        const docHeight = document.documentElement.scrollHeight - window.innerHeight;
-        const pct = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0;
-        
-        if (progressFill) progressFill.style.width = pct + '%';
-        if (goToTopBtn) goToTopBtn.style.display = scrollTop > 300 ? "block" : "none";
-
-        // Auto bookmark scroll percentage
-        try {
-            if (docHeight > 0) {
-                localStorage.setItem(BOOKMARK_KEY, scrollTop / docHeight);
-            }
-        } catch (e) {}
-    });
-
+    // --- Progress Tracking & Go To Top ---
     if (goToTopBtn) {
         goToTopBtn.addEventListener("click", () => {
             window.scrollTo({ top: 0, behavior: "smooth" });
         });
     }
 
-    function restoreBookmark() {
-        try {
-            const savedPct = localStorage.getItem(BOOKMARK_KEY);
-            if (savedPct) {
-                const pct = parseFloat(savedPct);
-                setTimeout(() => {
-                    const docHeight = document.documentElement.scrollHeight - window.innerHeight;
-                    if (docHeight > 0) {
-                        window.scrollTo({
-                            top: docHeight * pct,
-                            behavior: "smooth"
-                        });
-                    }
-                }, 400);
-            }
-        } catch (e) {}
-    }
-
-    restoreBookmark();
-
     // --- Text to Speech (TTS) ---
     if ('speechSynthesis' in window && ttsSpeakBtn && ttsStopBtn) {
         let utterance = new SpeechSynthesisUtterance();

Popular Posts

New Commit: fixed theme issues

Repository: Hestenb62/_legacy_backup Author: Hesten Berger Commit Message: fixed theme issues URL: https://github.com/Hestenb62/_legacy_backup/commit/498741f8c633ecaf6e7e594bb0aed02c47e69b39 Code Changes: diff --git a/assessment/index.php b/assessment/index.php index 822865b..5e8b706 100644 --- a/assessment/index.php +++ b/assessment/index.php @@ -264,7 +264,7 @@ include '../src/header.php'; </div> <!-- Hint Modal (Inline) --> - <div id="hintText" class="hint-box" style="display: none;"> + <div id="hintText" class="hint-box hidden"> <strong>Hint:</strong> <span id="hint-content"></span> </div> </div> diff --git a/assets/css/pages/assessment.css b/assets/css/pages/assessment.css index b57e964..7eb0d74 100644 --- a/assets/c...

New Commit: added arura mesh

Repository: Hestenb62/_legacy_backup Author: Hesten Berger Commit Message: added arura mesh URL: https://github.com/Hestenb62/_legacy_backup/commit/d8a9c63f2df943f6e40651985fb1c273c5809dd4 Code Changes: diff --git a/assets/css/level-style.css b/assets/css/level-style.css index ed8b60b..49cddf7 100644 --- a/assets/css/level-style.css +++ b/assets/css/level-style.css @@ -100,6 +100,8 @@ h1, h2, h3, h4 { padding: 4rem 1rem 3rem 1rem; background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%); border-bottom: 1px solid var(--glass-border); + position: relative; + overflow: hidden; } .hero-inner { @@ -111,6 +113,78 @@ h1, h2, h3, h4 { flex-wrap: wrap; gap: 1.5rem; animation: fadeUp 0.6s ease-out; + position: relative; + z-index: 2; +} + +/* Aurora Mesh Background for Level Hero */ +.level-aurora-bg { + position: absolute; + inset: 0; + overflow: hidden; + pointer-events: none; + z-index: 1; +} + +....

New Commit: Add JSON lesson migration and renderer scaffold Introduces a first-pass migration pipeline from PHP lesson files to structured JSON with `migrate_lessons.php`, and adds a generated `assets/data/lessons.json` catalog containing extracted metadata plus manual-migration placeholders for complex interactive content. Adds a new universal `src/lesson_renderer.php` to render lessons from JSON, along with initial component templates (`interactive-ladder` and `teacher-concepts`) for modular block rendering. Also includes `audit_report.html` documenting current security, accessibility, and architecture findings that motivated the move toward a template-driven lesson system.

Repository: Hestenb62/_legacy_backup Author: Hesten Berger Commit Message: Add JSON lesson migration and renderer scaffold Introduces a first-pass migration pipeline from PHP lesson files to structured JSON with , and adds a generated catalog containing extracted metadata plus manual-migration placeholders for complex interactive content. Adds a new universal to render lessons from JSON, along with initial component templates ( and ) for modular block rendering. Also includes documenting current security, accessibility, and architecture findings that motivated the move toward a template-driven lesson system. URL: https://github.com/Hestenb62/_legacy_backup/commit/f0c974b613ed65b7edcb712abb88bfae61ef0df5 Code Changes: diff --git a/assets/data/lessons.json b/assets/data/lessons.json new file mode 100644 index 0000000..0389666 --- /dev/null +++ b/assets/data/lessons.json @@ -0,0 +1,2835 @@ +{ + "lessons": { + "k-ela-m1-a-1": { + ...