Repository: Hestenb62/_legacy_backup
Author: Hesten Berger
Commit Message: reader updates
URL: https://github.com/Hestenb62/_legacy_backup/commit/f2529a6e3ee6b7df03c309938b3199d3066c6898
Code Changes:
diff --git a/assets/css/components/sticky-reading-bar.css b/assets/css/components/sticky-reading-bar.css
index 29cfa7c..f27c466 100644
--- a/assets/css/components/sticky-reading-bar.css
+++ b/assets/css/components/sticky-reading-bar.css
@@ -26,20 +26,135 @@
pointer-events: auto;
}
+/* Unified Reader Sticky Bar (Pinned at top of reading pages) */
+.sticky-reading-bar.sticky-reader-unified {
+ position: sticky;
+ top: 0;
+ left: 0;
+ right: 0;
+ z-index: 1000;
+ transform: translateY(0) !important;
+ opacity: 1 !important;
+ pointer-events: auto !important;
+ margin-bottom: 2rem;
+ background-color: rgba(255, 255, 255, 0.92);
+}
+
+[data-theme="dark"] .sticky-reading-bar,
+body.dark .sticky-reading-bar,
+body.theme-dark .sticky-reading-bar {
+ background-color: rgba(15, 23, 42, 0.94);
+ border-bottom-color: rgba(255, 255, 255, 0.1);
+ color: #f8fafc;
+ box-shadow: 0 4px 25px -4px rgba(0, 0, 0, 0.5);
+}
+
+body.theme-sepia .sticky-reading-bar {
+ background-color: rgba(246, 241, 233, 0.96);
+ border-bottom-color: rgba(0, 0, 0, 0.08);
+ color: #2d2a26;
+}
+
+body.theme-midnight .sticky-reading-bar {
+ background-color: rgba(11, 15, 25, 0.96);
+ border-bottom-color: rgba(255, 255, 255, 0.08);
+ color: #e2e8f0;
+}
+
body.zen-mode .sticky-reading-bar {
top: 0 !important;
}
.sticky-bar-inner {
- max-width: 72rem;
+ max-width: 84rem;
margin: 0 auto;
- padding: 0.5rem 1rem;
+ padding: 0.5rem 1.25rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
+.sticky-reader-unified .sticky-bar-inner {
+ padding: 0.4rem 1rem;
+ gap: 0.65rem;
+}
+
+/* Center Group in Unified Bar */
+.sticky-bar-center {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.75rem;
+ flex: 1 1 auto;
+ min-width: 0;
+}
+
+/* Right Group in Unified Bar */
+.sticky-bar-right {
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ gap: 0.5rem;
+ flex: 0 1 auto;
+ flex-shrink: 0;
+}
+
+.sticky-bar-tools {
+ display: flex;
+ align-items: center;
+ gap: 0.35rem;
+}
+
+/* Compact controls inside unified reading bar */
+.sticky-reader-unified .speech-btn {
+ padding: 0.3rem 0.65rem;
+ font-size: 0.78rem;
+ font-weight: 700;
+}
+
+.sticky-reader-unified .controls-nav-btn {
+ padding: 0.3rem 0.65rem;
+ font-size: 0.78rem;
+ font-weight: 700;
+}
+
+.sticky-reader-unified .controls-chapter-label {
+ font-size: 0.82rem;
+ font-weight: 800;
+ padding: 0 0.25rem;
+}
+
+.sticky-reader-unified .tool-btn {
+ width: 2.1rem;
+ height: 2.1rem;
+ font-size: 0.8rem;
+}
+
+.sticky-reader-unified .tool-btn-toc {
+ width: auto;
+ padding: 0 0.65rem;
+}
+
+.sticky-reader-unified .controls-quick-scaler {
+ padding: 0.1rem 0.25rem;
+}
+
+.sticky-reader-unified .scaler-btn {
+ width: 1.65rem;
+ height: 1.65rem;
+}
+
+.sticky-reader-unified .scaler-label {
+ font-size: 0.72rem;
+ min-width: 2.35rem;
+}
+
+.sticky-reader-unified .settings-dropdown {
+ top: calc(100% + 0.5rem);
+ right: 0;
+}
+
/* Left Group */
.sticky-bar-left {
display: flex;
@@ -194,6 +309,27 @@ body.zen-mode .sticky-reading-bar {
}
/* Responsive collapse on mobile */
+@media (max-width: 1024px) {
+ .sticky-reader-unified .nav-text {
+ display: none;
+ }
+ .sticky-reader-unified .sticky-time-left span {
+ display: none;
+ }
+}
+
+@media (max-width: 768px) {
+ .sticky-reader-unified .sticky-bar-subtitle,
+ .sticky-reader-unified #reader-session-timer-pill,
+ .sticky-reader-unified .controls-quick-scaler {
+ display: none;
+ }
+ .sticky-reader-unified .sticky-bar-inner {
+ padding: 0.35rem 0.5rem;
+ gap: 0.35rem;
+ }
+}
+
@media (max-width: 640px) {
.sticky-bar-subtitle {
display: none;
diff --git a/assets/css/reader/read-top-progress-bar.css b/assets/css/reader/read-top-progress-bar.css
index b54653d..069cf3a 100644
--- a/assets/css/reader/read-top-progress-bar.css
+++ b/assets/css/reader/read-top-progress-bar.css
@@ -2,21 +2,14 @@
3. Top Progress Bar & Header Navigation
========================================================================== */
-#progress-bar-container {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 4px;
- background-color: transparent;
- z-index: 2500;
+/* Hide duplicate top progress bars on reader pages; only the sticky bar's bottom progress line is used */
+#progress-bar-container,
+.scroll-progress-container {
+ display: none !important;
}
#progress-bar {
- height: 100%;
- width: 0%;
- background: linear-gradient(90deg, #4f46e5, #ec4899, #06b6d4);
- transition: width 0.1s ease-out;
+ display: none !important;
}
.reader-main-layout {
diff --git a/assets/js/components/sticky-reading-bar.js b/assets/js/components/sticky-reading-bar.js
index 4cf24f9..dd37edb 100644
--- a/assets/js/components/sticky-reading-bar.js
+++ b/assets/js/components/sticky-reading-bar.js
@@ -96,8 +96,10 @@
const winHeight = window.innerHeight;
const maxScroll = docHeight - winHeight;
- // Reveal bar after scrolling past 150px
- if (scrollY > 150) {
+ // Reveal bar after scrolling past 150px, or keep pinned if unified reader bar
+ if (this.bar.classList.contains('sticky-reader-unified')) {
+ this.bar.classList.add('is-active');
+ } else if (scrollY > 150) {
this.bar.classList.add('is-active');
} else {
this.bar.classList.remove('is-active');
diff --git a/library/read/reader_template.php b/library/read/reader_template.php
index dc6b466..19867f4 100644
--- a/library/read/reader_template.php
+++ b/library/read/reader_template.php
@@ -127,6 +127,7 @@ include ABSPATH . 'src/header.php';
?>
<link rel="stylesheet" href="<?= function_exists('assetVersion') ? assetVersion('/assets/css/reader-main.css') : '../../assets/css/reader-main.css' ?>">
+<link rel="stylesheet" href="<?= function_exists('assetVersion') ? assetVersion('/assets/css/components/sticky-reading-bar.css') : '../../assets/css/components/sticky-reading-bar.css' ?>">
<style>
body.zen-mode .header-main,
body.zen-mode .footer-main,
@@ -140,165 +141,99 @@ body.zen-mode {
}
</style>
-<!-- Reading Progress Bar -->
-<div id="progress-bar-container" aria-hidden="true">
- <div id="progress-bar"></div>
-</div>
-
-<?php
-$barTitle = $bookTitle;
-$barSubtitle = $currentChapterTitle;
-$barBackUrl = "/library/read/index.php?book=" . urlencode($bookId);
-include_once ABSPATH . 'src/partials/sticky-reading-bar.php';
-?>
-
-<main id="main-content" class="library-main reader-main-layout">
- <script>document.body.classList.add("mode-scroll");</script>
-
- <!-- Top Navigation Bar -->
- <div class="reader-back-nav">
- <a href="../index.php" class="reader-back-btn" title="Return to Digital Library Catalog">
- <i class="fas fa-arrow-left"></i> <span>Catalog</span>
- </a>
- <div style="display: flex; align-items: center; gap: 0.5rem;">
+<!-- Unified Sticky Reading Bar with Bottom Progress Indicator -->
+<header id="sticky-reading-bar" class="sticky-reading-bar is-active sticky-reader-unified" aria-label="Reading Controls & Progress" role="region">
+ <div class="sticky-bar-inner">
+ <!-- Left: Back to Catalog, Book Title, Chapter Subtitle, Session Timer -->
+ <div class="sticky-bar-left">
+ <a href="../index.php" class="sticky-bar-back-btn" title="Return to Digital Library Catalog" aria-label="Back to Catalog">
+ <i class="fas fa-arrow-left" aria-hidden="true"></i>
+ </a>
+ <div class="sticky-bar-info">
+ <span class="sticky-bar-title"><?php echo htmlspecialchars($bookTitle); ?></span>
+ <?php if (!empty($currentChapterTitle)): ?>
+ <span class="sticky-bar-subtitle">
+ <span class="sticky-badge-pill"><i class="fas fa-book-open"></i> <?php echo htmlspecialchars($currentChapterTitle); ?></span>
+ </span>
+ <?php endif; ?>
+ </div>
<div id="reader-session-timer-pill" class="reader-session-timer-pill" title="Daily Reading Tracker">
- <i class="fas fa-stopwatch" style="color: var(--color-primary, #e11d48);"></i>
+ <i class="fas fa-stopwatch" style="color: var(--color-primary, #e11d48);" aria-hidden="true"></i>
<span id="reading-session-time">0m today</span>
- <span id="reading-streak-badge" class="reading-streak-badge"><i class="fas fa-fire" style="color: #f97316;"></i> 1d</span>
+ <span id="reading-streak-badge" class="reading-streak-badge"><i class="fas fa-fire" style="color: #f97316;" aria-hidden="true"></i> 1d</span>
</div>
- <button type="button" id="reader-offline-cache-btn" class="reader-license-btn" onclick="cacheCurrentBookOffline()" title="Save Entire Book for Offline Reading" aria-label="Save Book Offline">
- <i class="fas fa-cloud-download-alt" id="reader-offline-icon"></i>
- </button>
- <button type="button" id="reader-bookmark-btn" class="reader-license-btn" onclick="window.toggleBookBookmark && window.toggleBookBookmark()" title="Bookmark this Book" aria-label="Bookmark this Book">
- <i class="far fa-bookmark" id="reader-bookmark-icon"></i>
- </button>
- <button type="button" class="reader-license-btn" onclick="openLicenseModal()" title="View Book License & Sourcing">
- <i class="fas fa-info-circle"></i>
- </button>
</div>
- </div>
-
- <!-- Book Title Header (Displayed on Chapter 1 and Intro) -->
- <?php if ($chapterNum <= 1): ?>
- <header class="reader-hero-header animate-reveal">
- <h1 class="reader-main-title">
- <?php echo htmlspecialchars($bookTitle); ?>
- </h1>
- <p class="reader-main-author">by <?php echo htmlspecialchars($bookAuthor); ?></p>
- </header>
- <?php endif; ?>