code organisation & refactor

This commit is contained in:
2025-11-27 20:23:00 +01:00
parent 03636fee99
commit 2b29beeeb5
33 changed files with 2099 additions and 1947 deletions

View File

@@ -1,270 +0,0 @@
:root {
--bg-base: #09090b;
--bg-surface: #121215;
--bg-surface-hover: #1e1e22;
--accent: #8b5cf6;
--accent-glow: rgba(139, 92, 246, 0.4);
--text-primary: #ffffff;
--text-secondary: #a1a1aa;
--radius-md: 12px;
--radius-lg: 24px;
--radius-full: 9999px;
}
body {
margin: 0;
background-color: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', system-ui, sans-serif;
overflow-x: hidden;
}
/* --- BACK BUTTON --- */
.back-btn {
position: fixed;
top: 2rem;
left: 2rem;
z-index: 100;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.8rem 1.5rem;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: var(--radius-full);
color: white;
text-decoration: none;
font-weight: 600;
transition: all 0.2s ease;
cursor: pointer;
}
.back-btn:hover {
background: rgba(255, 255, 255, 0.1);
transform: translateX(-5px);
}
/* --- HERO VIDEO SECTION --- */
.hero-wrapper {
position: relative;
width: 100%;
height: 85vh; /* Covers most of the screen */
overflow: hidden;
}
.video-background {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1.35); /* Zoom to remove black bars */
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
opacity: 0.6;
}
.hero-overlay {
position: absolute;
inset: 0;
background: radial-gradient(circle at center, transparent 0%, var(--bg-base) 120%),
linear-gradient(to top, var(--bg-base) 10%, rgba(9,9,11,0.8) 25%, transparent 60%);
z-index: 1;
}
/* --- CONTENT LAYOUT --- */
.content-container {
position: relative;
z-index: 10;
max-width: 1600px;
margin: -350px auto 0 auto; /* Pull content up over the video */
padding: 0 3rem 4rem 3rem;
display: grid;
grid-template-columns: 280px 1fr;
gap: 3rem;
animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
/* LEFT SIDEBAR */
.sidebar {
display: flex;
flex-direction: column;
gap: 2rem;
}
.poster-card {
width: 100%;
aspect-ratio: 2/3;
border-radius: var(--radius-lg);
overflow: hidden;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
border: 1px solid rgba(255,255,255,0.1);
}
.poster-card img {
width: 100%;
height: 100%;
object-fit: cover;
}
.info-grid {
background: var(--bg-surface);
border: 1px solid rgba(255,255,255,0.05);
border-radius: var(--radius-md);
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.info-item h4 { margin: 0 0 0.25rem 0; font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.info-item span { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.character-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.character-item { display: flex; align-items: center; gap: 0.75rem; font-size: 0.95rem; }
.char-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
/* RIGHT MAIN CONTENT */
.main-content {
display: flex;
flex-direction: column;
justify-content: flex-end; /* Align header to bottom of hero area */
}
.anime-header {
margin-bottom: 2rem;
}
.anime-title {
font-size: 4rem;
font-weight: 900;
line-height: 1;
margin: 0 0 1.5rem 0;
text-shadow: 0 4px 30px rgba(0,0,0,0.8);
}
.meta-row {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
flex-wrap: wrap;
}
.pill {
padding: 0.5rem 1.25rem;
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.1);
border-radius: var(--radius-full);
font-weight: 600;
font-size: 0.95rem;
}
.pill.score { background: rgba(34, 197, 94, 0.2); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
.action-row {
display: flex;
gap: 1rem;
margin-top: 1rem;
}
.btn-watch {
padding: 1rem 3rem;
background: var(--text-primary);
color: var(--bg-base);
border-radius: var(--radius-full);
font-weight: 800;
font-size: 1.1rem;
border: none;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.75rem;
transition: transform 0.2s, box-shadow 0.2s;
}
.btn-watch:hover {
transform: scale(1.05);
box-shadow: 0 0 30px rgba(255, 255, 255, 0.25);
}
.btn-secondary {
padding: 1rem 2rem;
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
color: white;
border-radius: var(--radius-full);
font-weight: 700;
font-size: 1rem;
border: 1px solid rgba(255,255,255,0.2);
cursor: pointer;
transition: background 0.2s;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.2); }
.description-box {
margin-top: 3rem;
font-size: 1.15rem;
line-height: 1.8;
color: #e4e4e7;
max-width: 900px;
background: rgba(255,255,255,0.03);
padding: 2rem;
border-radius: var(--radius-md);
border: 1px solid rgba(255,255,255,0.05);
}
/* EPISODES */
.episodes-section {
margin-top: 4rem;
}
.section-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.8rem; }
.section-title::before { content: ''; width: 4px; height: 28px; background: var(--accent); border-radius: 2px; }
.episodes-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1rem;
}
.episode-btn {
background: var(--bg-surface);
border: 1px solid rgba(255,255,255,0.1);
padding: 1.25rem 1rem;
border-radius: var(--radius-md);
cursor: pointer;
transition: 0.2s;
text-align: center;
font-weight: 600;
color: var(--text-secondary);
}
.episode-btn:hover {
background: var(--bg-surface-hover);
color: white;
transform: translateY(-3px);
border-color: var(--accent);
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(60px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 1024px) {
.content-container {
grid-template-columns: 1fr;
margin-top: -100px;
padding: 0 1.5rem 4rem 1.5rem;
}
.poster-card { width: 220px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.main-content { text-align: center; align-items: center; }
.anime-title { font-size: 2.5rem; }
.meta-row { justify-content: center; }
.sidebar { display: none; /* Hide sidebar on mobile for simplicity, or move to bottom */ }
}

View File

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View File

@@ -1,234 +0,0 @@
:root {
--bg-base: #09090b;
--bg-surface: #121215;
--bg-surface-hover: #1e1e22;
--accent: #8b5cf6;
--text-primary: #ffffff;
--text-secondary: #a1a1aa;
--radius-md: 12px;
--radius-lg: 24px;
--radius-full: 9999px;
--glass-border: 1px solid rgba(255, 255, 255, 0.1);
--glass-bg: rgba(20, 20, 23, 0.7);
--nav-height: 80px;
}
/* Global Reset */
* { box-sizing: border-box; outline: none; }
body {
margin: 0;
background-color: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', system-ui, sans-serif;
overflow-x: hidden;
}
/* Back Button */
.back-btn {
position: fixed;
top: 2rem; left: 2rem; z-index: 100;
display: flex; align-items: center; gap: 0.5rem;
padding: 0.8rem 1.5rem;
background: var(--glass-bg); backdrop-filter: blur(12px);
border: var(--glass-border); border-radius: var(--radius-full);
color: white; text-decoration: none; font-weight: 600;
transition: all 0.2s ease;
}
.back-btn:hover { background: rgba(255, 255, 255, 0.15); transform: translateX(-5px); }
/* Hero */
.hero-wrapper {
position: relative; width: 100%; height: 60vh; overflow: hidden;
}
.hero-background { position: absolute; inset: 0; z-index: 0; }
.hero-background img { width: 100%; height: 100%; object-fit: cover; opacity: 0.4; filter: blur(8px); transform: scale(1.1); }
.hero-overlay {
position: absolute; inset: 0; z-index: 1;
background: linear-gradient(to bottom, transparent 0%, var(--bg-base) 100%);
}
/* Content Layout - Pulled Up Higher */
.content-container {
position: relative; z-index: 10;
max-width: 1600px; margin: -350px auto 0 auto; /* Pulled up significantly */
padding: 0 3rem 4rem 3rem;
display: grid;
grid-template-columns: 260px 1fr;
gap: 3rem;
align-items: flex-start; /* Important for sticky sidebar */
animation: slideUp 0.8s ease;
}
/* Hero Content Overlay (Hidden) */
.hero-content { display: none; }
/* Left Sidebar - Sticky Poster */
.sidebar {
display: flex;
flex-direction: column;
gap: 1.5rem;
position: sticky;
top: calc(var(--nav-height) + 2rem); /* Sticks to top when scrolling */
align-self: flex-start;
z-index: 20;
}
.poster-card {
width: 100%; aspect-ratio: 2/3; border-radius: var(--radius-lg);
overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.8);
border: 1px solid rgba(255,255,255,0.1);
background: #1a1a1a;
}
.poster-card img { width: 100%; height: 100%; object-fit: cover; }
.info-grid {
background: var(--bg-surface); border: var(--glass-border);
border-radius: var(--radius-md); padding: 1.25rem;
display: flex; flex-direction: column; gap: 1rem;
}
.info-item h4 { margin: 0 0 0.25rem 0; font-size: 0.8rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.info-item span { font-weight: 600; font-size: 0.95rem; }
/* Main Content */
.main-content {
display: flex; flex-direction: column;
padding-top: 4rem; /* Adjusted spacing */
justify-content: flex-start;
}
/* Header Section */
.book-header { margin-bottom: 1.5rem; }
.book-title { font-size: 3.5rem; font-weight: 900; line-height: 1.1; margin: 0 0 1rem 0; text-shadow: 0 4px 30px rgba(0,0,0,0.8); }
.meta-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.pill { padding: 0.4rem 1rem; background: rgba(255,255,255,0.1); border-radius: 99px; font-size: 0.9rem; font-weight: 600; border: var(--glass-border); backdrop-filter: blur(10px); }
.pill.score { background: rgba(34, 197, 94, 0.2); color: #4ade80; border-color: rgba(34, 197, 94, 0.2); }
/* Hidden elements as requested */
#description { display: none; } /* Hides description box */
#year { display: none; } /* Hides year pill */
.action-row { display: flex; gap: 1rem; }
.btn-primary {
padding: 0.8rem 2rem; background: white; color: black; border: none; border-radius: 99px;
font-weight: 800; cursor: pointer; transition: transform 0.2s;
}
.btn-primary:hover { transform: scale(1.05); }
/* Fixed Add to Library Button (Matching books.html style) */
.btn-secondary {
padding: 0.8rem 2rem;
background: rgba(255,255,255,0.1);
color: white;
border: 1px solid rgba(255,255,255,0.2);
border-radius: 99px;
font-weight: 700;
cursor: pointer;
transition: 0.2s;
backdrop-filter: blur(10px);
}
.btn-secondary:hover {
background: rgba(255,255,255,0.2);
}
/* Legacy class support if HTML uses btn-blur */
.btn-blur {
padding: 0.8rem 2rem;
background: rgba(255,255,255,0.1);
color: white;
border: 1px solid rgba(255,255,255,0.2);
border-radius: 99px;
font-weight: 700;
cursor: pointer;
transition: 0.2s;
backdrop-filter: blur(10px);
}
.btn-blur:hover { background: rgba(255,255,255,0.2); }
/* Chapters Section */
.chapters-section { margin-top: 1rem; }
.section-title { display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.8rem; margin-bottom: 1.5rem; }
.section-title h2 { font-size: 1.5rem; margin: 0; border-left: 4px solid var(--accent); padding-left: 1rem; }
.chapters-table-wrapper {
background: var(--bg-surface); border-radius: var(--radius-md);
border: 1px solid rgba(255,255,255,0.05); overflow: hidden;
}
.chapters-table { width: 100%; border-collapse: collapse; text-align: left; }
.chapters-table th {
padding: 0.8rem 1.2rem; background: rgba(255,255,255,0.03);
color: var(--text-secondary); font-weight: 600; font-size: 0.85rem;
text-transform: uppercase; letter-spacing: 0.5px;
}
.chapters-table td {
padding: 1rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.05);
color: var(--text-primary); font-size: 0.95rem;
}
.chapters-table tr:last-child td { border-bottom: none; }
.chapters-table tr:hover { background: var(--bg-surface-hover); }
.filter-select {
appearance: none;
-webkit-appearance: none;
background-color: var(--bg-surface); /* Dark background */
color: var(--text-primary); /* White text */
border: 1px solid rgba(255,255,255,0.1);
padding: 0.5rem 2rem 0.5rem 1rem;
border-radius: 99px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
outline: none;
background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 1rem center;
}
.filter-select:hover {
border-color: var(--accent);
background-color: var(--bg-surface-hover);
}
/* Force Dropdown Options Background (browser dependent but works on most modern ones) */
.filter-select option {
background-color: var(--bg-surface);
color: var(--text-primary);
}
.read-btn-small {
background: var(--accent); color: white; border: none;
padding: 0.4rem 0.9rem; border-radius: 6px; font-weight: 600; cursor: pointer;
font-size: 0.8rem; transition: 0.2s;
}
.read-btn-small:hover { background: #7c3aed; }
/* Pagination */
.pagination-controls {
display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; align-items: center;
}
.page-btn {
background: var(--bg-surface); border: 1px solid rgba(255,255,255,0.1);
color: white; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.page-btn:hover:not(:disabled) { border-color: var(--accent); }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1024px) {
.hero-wrapper { height: 40vh; }
.content-container { grid-template-columns: 1fr; margin-top: -80px; padding: 0 1.5rem 4rem 1.5rem; }
.poster-card { display: none; } /* Hide large poster on mobile */
.main-content { padding-top: 0; align-items: center; text-align: center; }
.book-title { font-size: 2.2rem; }
.meta-row { justify-content: center; }
.action-row { justify-content: center; width: 100%; }
.btn-primary, .btn-blur { flex: 1; justify-content: center; }
.sidebar { display: none; }
.chapters-table th:nth-child(3), .chapters-table td:nth-child(3) { display: none; }
.chapters-table th:nth-child(4), .chapters-table td:nth-child(4) { display: none; }
}

View File

@@ -1,217 +0,0 @@
const bookId = window.location.pathname.split('/').pop();
let allChapters = []; // Stores all fetched chapters
let filteredChapters = []; // Stores currently displayed chapters (filtered)
let currentPage = 1;
const itemsPerPage = 12;
async function init() {
try {
// 1. Load Metadata
const res = await fetch(`/api/book/${bookId}`);
const data = await res.json();
if (data.error) {
const titleEl = document.getElementById('title');
if (titleEl) titleEl.innerText = "Book Not Found";
return;
}
// Populate Hero Elements
const title = data.title.english || data.title.romaji;
document.title = `${title} | WaifuBoard Books`;
const titleEl = document.getElementById('title');
if (titleEl) titleEl.innerText = title;
const descEl = document.getElementById('description');
if (descEl) descEl.innerHTML = data.description || "No description available.";
const scoreEl = document.getElementById('score');
if (scoreEl) scoreEl.innerText = (data.averageScore || '?') + '% Score';
const pubEl = document.getElementById('published-date');
if (pubEl) {
if (data.startDate && data.startDate.year) {
const y = data.startDate.year;
const m = data.startDate.month ? `-${data.startDate.month.toString().padStart(2, '0')}` : '';
const d = data.startDate.day ? `-${data.startDate.day.toString().padStart(2, '0')}` : '';
pubEl.innerText = `${y}${m}${d}`;
} else {
pubEl.innerText = '????';
}
}
const statusEl = document.getElementById('status');
if (statusEl) statusEl.innerText = data.status || 'Unknown';
const formatEl = document.getElementById('format');
if (formatEl) formatEl.innerText = data.format || 'MANGA';
const chaptersEl = document.getElementById('chapters');
if (chaptersEl) chaptersEl.innerText = data.chapters || '?';
const genresEl = document.getElementById('genres');
if(genresEl && data.genres) {
genresEl.innerText = data.genres.slice(0, 3).join(' • ');
}
const img = data.coverImage.extraLarge || data.coverImage.large;
const posterEl = document.getElementById('poster');
if (posterEl) posterEl.src = img;
const heroBgEl = document.getElementById('hero-bg');
if (heroBgEl) heroBgEl.src = data.bannerImage || img;
// 2. Load Chapters
loadChapters();
} catch (err) {
console.error("Metadata Error:", err);
}
}
async function loadChapters() {
const tbody = document.getElementById('chapters-body');
if (!tbody) return;
tbody.innerHTML = '<tr><td colspan="4" style="text-align:center; padding: 2rem;">Searching extensions for chapters...</td></tr>';
try {
const res = await fetch(`/api/book/${bookId}/chapters`);
const data = await res.json();
allChapters = data.chapters || [];
filteredChapters = [...allChapters]; // Initially, show all
const totalEl = document.getElementById('total-chapters');
if (allChapters.length === 0) {
tbody.innerHTML = '<tr><td colspan="4" style="text-align:center; padding: 2rem;">No chapters found on loaded extensions.</td></tr>';
if (totalEl) totalEl.innerText = "0 Found";
return;
}
if (totalEl) totalEl.innerText = `${allChapters.length} Found`;
// Populate Provider Filter
populateProviderFilter();
// Read Button Action (Start at filtered Ch 1)
const readBtn = document.getElementById('read-start-btn');
if (readBtn && filteredChapters.length > 0) {
readBtn.onclick = () => openReader(filteredChapters[0].id);
}
renderTable();
} catch (err) {
tbody.innerHTML = '<tr><td colspan="4" style="text-align:center; color: #ef4444;">Error loading chapters.</td></tr>';
console.error(err);
}
}
function populateProviderFilter() {
const select = document.getElementById('provider-filter');
if (!select) return;
// Extract unique providers
const providers = [...new Set(allChapters.map(ch => ch.provider))];
// Only show filter if there are actual providers found
if (providers.length > 0) {
select.style.display = 'inline-block';
// Clear existing options except "All"
select.innerHTML = '<option value="all">All Providers</option>';
providers.forEach(prov => {
const opt = document.createElement('option');
opt.value = prov;
opt.innerText = prov;
select.appendChild(opt);
});
// Attach Event Listener
select.onchange = (e) => {
const selected = e.target.value;
if (selected === 'all') {
filteredChapters = [...allChapters];
} else {
filteredChapters = allChapters.filter(ch => ch.provider === selected);
}
currentPage = 1; // Reset to page 1 on filter change
renderTable();
};
}
}
function renderTable() {
const tbody = document.getElementById('chapters-body');
if (!tbody) return;
tbody.innerHTML = '';
if (filteredChapters.length === 0) {
tbody.innerHTML = '<tr><td colspan="4" style="text-align:center; padding: 2rem;">No chapters match this filter.</td></tr>';
updatePagination();
return;
}
const start = (currentPage - 1) * itemsPerPage;
const end = start + itemsPerPage;
const pageItems = filteredChapters.slice(start, end);
pageItems.forEach((ch, idx) => {
const realIndex = start + idx;
const row = document.createElement('tr');
row.innerHTML = `
<td>${ch.number}</td>
<td>${ch.title || 'Chapter ' + ch.number}</td>
<td><span class="pill" style="font-size:0.75rem;">${ch.provider}</span></td>
<td>
<button class="read-btn-small" onclick="openReader('${bookId}', '${realIndex}', '${ch.provider}')">
Read
</button>
</td>
`;
tbody.appendChild(row);
});
updatePagination();
}
function updatePagination() {
const totalPages = Math.ceil(filteredChapters.length / itemsPerPage);
const pagination = document.getElementById('pagination');
if (!pagination) return;
if (totalPages <= 1) {
pagination.style.display = 'none';
return;
}
pagination.style.display = 'flex';
document.getElementById('page-info').innerText = `Page ${currentPage} of ${totalPages}`;
const prevBtn = document.getElementById('prev-page');
const nextBtn = document.getElementById('next-page');
prevBtn.disabled = currentPage === 1;
nextBtn.disabled = currentPage >= totalPages;
prevBtn.onclick = () => { currentPage--; renderTable(); };
nextBtn.onclick = () => { currentPage++; renderTable(); };
}
function openReader(bookId, chapterId, provider) {
localStorage.setItem('reader_prev_url', window.location.href);
const c = encodeURIComponent(chapterId);
const p = encodeURIComponent(provider);
window.location.href = `/read/${bookId}/${c}/${p}`;
}
init();

View File

@@ -1,346 +0,0 @@
:root {
--bg-base: #09090b;
--bg-surface: #121215;
--bg-surface-hover: #1e1e22;
--accent: #8b5cf6;
--accent-glow: rgba(139, 92, 246, 0.4);
--text-primary: #ffffff;
--text-secondary: #a1a1aa;
--radius-md: 12px;
--radius-lg: 24px;
--nav-height: 80px;
}
* { box-sizing: border-box; outline: none; }
body {
margin: 0;
background-color: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', system-ui, sans-serif;
overflow-x: hidden;
}
/* --- NAV --- */
.navbar {
width: 100%;
height: var(--nav-height);
position: fixed;
top: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 3rem;
background: linear-gradient(to bottom, rgba(9,9,11,0.9) 0%, rgba(9,9,11,0) 100%);
transition: background 0.3s;
}
.navbar.scrolled {
background: rgba(9, 9, 11, 0.85);
backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.nav-brand {
font-weight: 900;
font-size: 1.5rem;
display: flex;
align-items: center;
gap: 0.8rem;
letter-spacing: -0.5px;
min-width: 200px;
color: white;
text-decoration: none;
cursor: pointer;
}
.brand-icon {
width: 36px;
height: 36px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.brand-icon img {
width: 70%;
height: 70%;
object-fit: contain;
}
.nav-center {
display: flex;
gap: 0.5rem;
background: rgba(255,255,255,0.03);
padding: 0.4rem;
border-radius: 999px;
border: 1px solid rgba(255,255,255,0.05);
}
.nav-button {
background: transparent;
border: none;
color: var(--text-secondary);
padding: 0.6rem 1.5rem;
border-radius: 999px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.nav-button:hover { color: white; }
.nav-button.active {
background: rgba(255, 255, 255, 0.1);
color: white;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
backdrop-filter: blur(8px);
border: 1px solid rgba(255,255,255,0.1);
}
/* SEARCH BAR */
.search-wrapper {
position: relative;
width: 300px;
z-index: 2000;
}
.search-input {
width: 100%;
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
padding: 0.7rem 1rem 0.7rem 2.5rem;
border-radius: 99px;
color: white;
font-family: inherit;
transition: 0.2s;
}
.search-input:focus {
background: rgba(0, 0, 0, 0.8);
border-color: var(--accent);
box-shadow: 0 0 15px var(--accent-glow);
border-radius: 12px 12px 0 0;
}
.search-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: var(--text-secondary);
}
/* Dropdown */
.search-results {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: rgba(15, 15, 18, 0.95);
backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.1);
border-top: none;
border-radius: 0 0 12px 12px;
padding: 0.5rem;
display: none;
flex-direction: column;
gap: 0.25rem;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
max-height: 400px;
overflow-y: auto;
}
.search-results.active { display: flex; }
.search-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.5rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
text-decoration: none;
color: inherit;
}
.search-item:hover { background: rgba(255,255,255,0.1); }
.search-poster {
width: 40px;
height: 56px;
border-radius: 4px;
object-fit: cover;
background: #222;
}
.search-info { flex: 1; overflow: hidden; }
.search-title {
font-size: 0.9rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text-primary);
}
.search-meta {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.75rem;
color: var(--text-secondary);
margin-top: 2px;
}
.rating-pill { color: #4ade80; font-weight: 700; }
/* --- HERO --- */
.hero-wrapper {
position: relative;
height: 85vh;
width: 100%;
overflow: hidden;
}
.hero-background { position: absolute; inset: 0; z-index: 0; }
#hero-bg-media {
width: 100%; height: 100%; object-fit: cover; opacity: 0.6;
transform: scale(1.1); transition: opacity 1s ease;
}
.hero-vignette {
position: absolute; inset: 0;
background: radial-gradient(circle at center, transparent 0%, var(--bg-base) 120%),
linear-gradient(to top, var(--bg-base) 10%, transparent 60%);
z-index: 1;
}
.hero-content {
position: relative; z-index: 10; height: 100%;
max-width: 1600px; margin: 0 auto; padding: 0 3rem;
display: flex; align-items: flex-end; padding-bottom: 6rem; gap: 3rem;
}
.hero-poster-card {
width: 260px; height: 380px; border-radius: var(--radius-lg);
overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
background: #1a1a1a;
}
.hero-poster-card img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { flex: 1; max-width: 800px; margin-bottom: 1rem; animation: fadeInUp 0.8s ease; }
.hero-title {
font-size: 4rem; font-weight: 900; line-height: 1.1; margin: 0 0 1rem 0;
text-shadow: 0 4px 20px rgba(0,0,0,0.8);
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-meta { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; font-size: 1.1rem; font-weight: 600; }
.score-badge { color: #22c55e; background: rgba(34, 197, 94, 0.1); padding: 0.2rem 0.8rem; border-radius: 6px; border: 1px solid rgba(34, 197, 94, 0.2); }
.hero-desc {
font-size: 1.1rem; line-height: 1.6; color: #e4e4e7; margin-bottom: 2rem;
max-width: 650px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
overflow: hidden; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.hero-buttons { display: flex; gap: 1rem; }
.btn-primary, .btn-blur {
padding: 1rem 2.5rem; border-radius: 999px; font-weight: 700; font-size: 1rem;
border: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
transition: transform 0.2s;
}
.btn-primary { background: white; color: black; }
.btn-primary:hover { transform: scale(1.05); }
.btn-blur { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn-blur:hover { background: rgba(255, 255, 255, 0.2); }
/* --- SECTIONS --- */
.section { max-width: 1700px; margin: 0 auto; padding: 2rem 3rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-title { font-size: 1.8rem; font-weight: 800; }
.carousel-wrapper { position: relative; }
.carousel { display: flex; gap: 1.25rem; overflow-x: auto; padding: 1rem 0; scroll-behavior: smooth; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.scroll-btn {
position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px;
border-radius: 50%; background: rgba(20, 20, 23, 0.9); border: 1px solid rgba(255,255,255,0.1);
color: white; z-index: 20; cursor: pointer; display: flex; align-items: center; justify-content: center;
opacity: 0; transition: 0.3s;
}
.carousel-wrapper:hover .scroll-btn { opacity: 1; }
.scroll-btn:hover { background: var(--accent); }
.scroll-btn.left { left: -25px; }
.scroll-btn.right { right: -25px; }
/* --- CARDS --- */
.card { min-width: 220px; cursor: pointer; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.card:hover { transform: translateY(-8px); }
.card-img-wrap { width: 100%; aspect-ratio: 2/3; border-radius: var(--radius-md); overflow: hidden; position: relative; margin-bottom: 0.8rem; background: #222; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card:hover .card-img-wrap img { transform: scale(1.05); }
.card-content h3 { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-content p { margin: 4px 0 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.skeleton {
background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 6px;
display: inline-block;
}
.text-skeleton { height: 1em; width: 70%; margin-bottom: 0.5rem; }
.title-skeleton { height: 3em; width: 80%; margin-bottom: 1rem; }
.poster-skeleton { width: 100%; height: 100%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* --- MOBILE --- */
@media (max-width: 768px) {
:root { --nav-height: auto; }
.navbar { padding: 1rem; flex-wrap: wrap; gap: 1rem; background: rgba(9,9,11,0.98); position: fixed; }
.nav-brand { flex: 1; min-width: auto; font-size: 1.3rem; }
.search-wrapper { order: 2; width: auto; flex: 1; min-width: 140px; }
.search-input { width: 100%; padding-left: 2.2rem; font-size: 0.9rem; }
.nav-center {
order: 3; width: 100%; padding: 0.5rem 0; overflow-x: auto;
justify-content: flex-start; gap: 0.8rem; background: transparent; border: none;
border-radius: 0; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.nav-center::-webkit-scrollbar { display: none; }
.nav-button { flex-shrink: 0; background: rgba(255,255,255,0.05); padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: 99px; }
.hero-wrapper { height: 75vh; }
.hero-content { flex-direction: column; justify-content: flex-end; padding: 0 1.5rem 6rem 1.5rem; gap: 1rem; }
.hero-poster-card { display: none; }
.hero-text { width: 100%; text-align: center; margin-bottom: 0; }
.hero-title { font-size: 2.5rem; line-height: 1.1; }
.hero-meta { justify-content: center; flex-wrap: wrap; gap: 0.8rem; }
.hero-buttons { justify-content: center; width: 100%; }
.btn-primary, .btn-blur { flex: 1; justify-content: center; }
.hero-desc { text-align: center; -webkit-line-clamp: 3; font-size: 0.95rem; }
.section { padding: 1.5rem 1rem; }
.section-title { font-size: 1.4rem; }
.scroll-btn { display: none; }
.card { min-width: 140px; }
.search-results {
position: fixed; top: 120px; left: 0; right: 0;
width: 100%; border-radius: 0; max-height: 60vh; border: none; z-index: 2001;
}
}

View File

@@ -1,189 +0,0 @@
let trendingBooks = [];
let currentHeroIndex = 0;
let heroInterval;
// --- NAVBAR SCROLL ---
window.addEventListener('scroll', () => {
const nav = document.getElementById('navbar');
if (window.scrollY > 50) nav.classList.add('scrolled');
else nav.classList.remove('scrolled');
});
// --- SEARCH LOGIC ---
const searchInput = document.getElementById('search-input');
const searchResults = document.getElementById('search-results');
let searchTimeout;
searchInput.addEventListener('input', (e) => {
const query = e.target.value;
clearTimeout(searchTimeout);
if (query.length < 2) {
searchResults.classList.remove('active');
searchResults.innerHTML = '';
searchInput.style.borderRadius = '99px';
return;
}
// Debounce 300ms
searchTimeout = setTimeout(() => {
fetchBookSearch(query);
}, 300);
});
// Hide results on outside click
document.addEventListener('click', (e) => {
if (!e.target.closest('.search-wrapper')) {
searchResults.classList.remove('active');
searchInput.style.borderRadius = '99px';
}
});
async function fetchBookSearch(query) {
try {
const res = await fetch(`/api/search/books?q=${encodeURIComponent(query)}`);
const data = await res.json();
renderSearchResults(data.results || []);
} catch (err) {
console.error("Search Error:", err);
renderSearchResults([]);
}
}
function renderSearchResults(results) {
searchResults.innerHTML = '';
if (!results || results.length === 0) {
searchResults.innerHTML = '<div style="padding:1rem; color:#888; text-align:center">No results found</div>';
} else {
results.forEach(book => {
const title = book.title.english || book.title.romaji || "Unknown";
const img = (book.coverImage && (book.coverImage.medium || book.coverImage.large)) || '';
const rating = book.averageScore ? `${book.averageScore}%` : 'N/A';
const year = book.seasonYear || (book.startDate ? book.startDate.year : '') || '????';
const format = book.format || 'MANGA';
const item = document.createElement('a');
item.className = 'search-item';
item.href = `/book/${book.id}`; // Direct navigation link
item.innerHTML = `
<img src="${img}" class="search-poster" alt="${title}">
<div class="search-info">
<div class="search-title">${title}</div>
<div class="search-meta">
<span class="rating-pill">${rating}</span>
<span>• ${year}</span>
<span>• ${format}</span>
</div>
</div>
`;
searchResults.appendChild(item);
});
}
searchResults.classList.add('active');
searchInput.style.borderRadius = '12px 12px 0 0';
}
// --- CAROUSEL LOGIC ---
function scrollCarousel(id, direction) {
const container = document.getElementById(id);
if(container) {
const scrollAmount = container.clientWidth * 0.75;
container.scrollBy({ left: direction * scrollAmount, behavior: 'smooth' });
}
}
// --- FETCH DATA ---
async function init() {
try {
// Fetch Trending
const res = await fetch('/api/books/trending');
const data = await res.json();
if (data.results && data.results.length > 0) {
trendingBooks = data.results;
updateHeroUI(trendingBooks[0]);
renderList('trending', trendingBooks);
startHeroCycle();
}
// Fetch Popular
const resPop = await fetch('/api/books/popular');
const dataPop = await resPop.json();
if (dataPop.results) renderList('popular', dataPop.results);
} catch (e) {
console.error("Books Error:", e);
}
}
// --- HERO LOGIC ---
function startHeroCycle() {
if(heroInterval) clearInterval(heroInterval);
heroInterval = setInterval(() => {
if(trendingBooks.length > 0) {
currentHeroIndex = (currentHeroIndex + 1) % trendingBooks.length;
updateHeroUI(trendingBooks[currentHeroIndex]);
}
}, 8000);
}
function updateHeroUI(book) {
if(!book) return;
const title = book.title.english || book.title.romaji;
const desc = book.description || "No description available.";
const poster = (book.coverImage && (book.coverImage.extraLarge || book.coverImage.large)) || '';
const banner = book.bannerImage || poster;
document.getElementById('hero-title').innerText = title;
document.getElementById('hero-desc').innerHTML = desc;
document.getElementById('hero-score').innerText = (book.averageScore || '?') + '% Score';
document.getElementById('hero-year').innerText = (book.startDate && book.startDate.year) ? book.startDate.year : '????';
document.getElementById('hero-type').innerText = book.format || 'MANGA';
const heroPoster = document.getElementById('hero-poster');
if(heroPoster) heroPoster.src = poster;
// Update background
const bg = document.getElementById('hero-bg-media');
if(bg) bg.src = banner;
// Setup Read Now Button
const readBtn = document.getElementById('read-btn');
if (readBtn) {
readBtn.onclick = () => window.location.href = `/book/${book.id}`;
}
}
// --- RENDER LIST ---
function renderList(id, list) {
const container = document.getElementById(id);
container.innerHTML = '';
list.forEach(book => {
const title = book.title.english || book.title.romaji;
const cover = book.coverImage ? book.coverImage.large : '';
const score = book.averageScore || '--';
const type = book.format || 'Book';
const el = document.createElement('div');
el.className = 'card';
el.onclick = () => {
// Navigate to book page
window.location.href = `/book/${book.id}`;
};
el.innerHTML = `
<div class="card-img-wrap"><img src="${cover}" loading="lazy"></div>
<div class="card-content">
<h3>${title}</h3>
<p>${score}% • ${type}</p>
</div>
`;
container.appendChild(el);
});
}
init();

View File

@@ -1,361 +0,0 @@
:root {
--bg-base: #09090b;
--bg-surface: #121215;
--bg-surface-hover: #1e1e22;
--accent: #8b5cf6;
--accent-glow: rgba(139, 92, 246, 0.4);
--text-primary: #ffffff;
--text-secondary: #a1a1aa;
--radius-md: 12px;
--radius-lg: 24px;
--nav-height: 80px;
}
* { box-sizing: border-box; outline: none; }
body {
margin: 0;
background-color: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', system-ui, sans-serif;
overflow-x: hidden;
}
/* --- NAV --- */
.navbar {
width: 100%;
height: var(--nav-height);
position: fixed;
top: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 3rem;
background: linear-gradient(to bottom, rgba(9,9,11,0.9) 0%, rgba(9,9,11,0) 100%);
transition: background 0.3s;
}
.navbar.scrolled {
background: rgba(9, 9, 11, 0.85);
backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.nav-brand {
font-weight: 900;
font-size: 1.5rem;
display: flex;
align-items: center;
gap: 0.8rem;
letter-spacing: -0.5px;
min-width: 200px;
color: white;
text-decoration: none;
cursor: pointer;
}
.brand-icon {
width: 36px;
height: 36px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.brand-icon img {
width: 70%;
height: 70%;
object-fit: contain;
}
.nav-center {
display: flex;
gap: 0.5rem;
background: rgba(255,255,255,0.03);
padding: 0.4rem;
border-radius: 999px;
border: 1px solid rgba(255,255,255,0.05);
}
.nav-button {
background: transparent;
border: none;
color: var(--text-secondary);
padding: 0.6rem 1.5rem;
border-radius: 999px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.nav-button:hover { color: white; }
.nav-button.active {
background: rgba(255, 255, 255, 0.1);
color: white;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
backdrop-filter: blur(8px);
border: 1px solid rgba(255,255,255,0.1);
}
/* SEARCH BAR */
.search-wrapper {
position: relative;
width: 250px;
}
.search-input {
width: 100%;
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
padding: 0.7rem 1rem 0.7rem 2.5rem;
border-radius: 99px;
color: white;
font-family: inherit;
transition: 0.2s;
}
.search-input:focus {
background: rgba(255,255,255,0.1);
border-color: var(--accent);
box-shadow: 0 0 15px var(--accent-glow);
}
.search-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: var(--text-secondary);
}
/* --- HERO --- */
.hero-wrapper {
position: relative;
height: 85vh;
width: 100%;
overflow: hidden;
}
.hero-background { position: absolute; inset: 0; z-index: 0; }
#hero-bg-media {
width: 100%; height: 100%; object-fit: cover; opacity: 0.6;
transform: scale(1.1); transition: opacity 1s ease;
}
.hero-vignette {
position: absolute; inset: 0;
background: radial-gradient(circle at center, transparent 0%, var(--bg-base) 120%),
linear-gradient(to top, var(--bg-base) 10%, transparent 60%);
z-index: 1;
}
.hero-content {
position: relative; z-index: 10; height: 100%;
max-width: 1600px; margin: 0 auto; padding: 0 3rem;
display: flex; align-items: flex-end; padding-bottom: 6rem; gap: 3rem;
}
.hero-poster-card {
width: 260px; height: 380px; border-radius: var(--radius-lg);
overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
background: #1a1a1a; /* fallback */
}
.hero-poster-card img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { flex: 1; max-width: 800px; margin-bottom: 1rem; animation: fadeInUp 0.8s ease; }
.hero-title {
font-size: 4rem; font-weight: 900; line-height: 1.1; margin: 0 0 1rem 0;
text-shadow: 0 4px 20px rgba(0,0,0,0.8);
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-meta { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1.5rem; font-size: 1.1rem; font-weight: 600; }
.score-badge { color: #22c55e; background: rgba(34, 197, 94, 0.1); padding: 0.2rem 0.8rem; border-radius: 6px; border: 1px solid rgba(34, 197, 94, 0.2); }
.hero-desc {
font-size: 1.1rem; line-height: 1.6; color: #e4e4e7; margin-bottom: 2rem;
max-width: 650px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
overflow: hidden; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.hero-buttons { display: flex; gap: 1rem; }
.btn-primary, .btn-blur {
padding: 1rem 2.5rem; border-radius: 999px; font-weight: 700; font-size: 1rem;
border: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem;
transition: transform 0.2s;
}
.btn-primary { background: white; color: black; }
.btn-primary:hover { transform: scale(1.05); }
.btn-blur { background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn-blur:hover { background: rgba(255, 255, 255, 0.2); }
/* --- CAROUSELS --- */
.section { max-width: 1700px; margin: 0 auto; padding: 2rem 3rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-title { font-size: 1.8rem; font-weight: 800; }
.carousel-wrapper { position: relative; }
.carousel { display: flex; gap: 1.25rem; overflow-x: auto; padding: 1rem 0; scroll-behavior: smooth; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.scroll-btn {
position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px;
border-radius: 50%; background: rgba(20, 20, 23, 0.9); border: 1px solid rgba(255,255,255,0.1);
color: white; z-index: 20; cursor: pointer; display: flex; align-items: center; justify-content: center;
opacity: 0; transition: 0.3s;
}
.carousel-wrapper:hover .scroll-btn { opacity: 1; }
.scroll-btn:hover { background: var(--accent); }
.scroll-btn.left { left: -25px; }
.scroll-btn.right { right: -25px; }
/* --- CARDS --- */
.card { min-width: 220px; cursor: pointer; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.card:hover { transform: translateY(-8px); }
.card-img-wrap { width: 100%; aspect-ratio: 2/3; border-radius: var(--radius-md); overflow: hidden; position: relative; margin-bottom: 0.8rem; background: #222; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card:hover .card-img-wrap img { transform: scale(1.05); }
.card-content h3 { margin: 0; font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-content p { margin: 4px 0 0 0; font-size: 0.85rem; color: var(--text-secondary); }
/* SKELETON LOADING (The "Non-Dumb" Metadata fix) */
.skeleton {
background: linear-gradient(90deg, #18181b 25%, #27272a 50%, #18181b 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
border-radius: 6px;
display: inline-block;
}
.text-skeleton { height: 1em; width: 70%; margin-bottom: 0.5rem; }
.title-skeleton { height: 3em; width: 80%; margin-bottom: 1rem; }
.poster-skeleton { width: 100%; height: 100%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.search-wrapper {
position: relative;
width: 300px;
z-index: 2000; /* Ensure it sits above hero content */
}
.search-input {
width: 100%;
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
padding: 0.7rem 1rem 0.7rem 2.5rem;
border-radius: 99px;
color: white;
font-family: inherit;
transition: 0.2s;
}
.search-input:focus {
background: rgba(0, 0, 0, 0.8);
border-color: var(--accent);
box-shadow: 0 0 15px var(--accent-glow);
border-radius: 12px 12px 0 0; /* Flatten bottom corners when open */
}
.search-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
color: var(--text-secondary);
}
/* The Dropdown Container */
.search-results {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: rgba(15, 15, 18, 0.95);
backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.1);
border-top: none;
border-radius: 0 0 12px 12px;
padding: 0.5rem;
display: none; /* Hidden by default */
flex-direction: column;
gap: 0.25rem;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
max-height: 400px;
overflow-y: auto;
}
.search-results.active {
display: flex;
}
/* Individual Result Item */
.search-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.5rem;
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
text-decoration: none;
color: inherit;
}
.search-item:hover {
background: rgba(255,255,255,0.1);
}
.search-poster {
width: 40px;
height: 56px;
border-radius: 4px;
object-fit: cover;
background: #222;
}
.search-info {
flex: 1;
overflow: hidden;
}
.search-title {
font-size: 0.9rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text-primary);
}
.search-meta {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.75rem;
color: var(--text-secondary);
margin-top: 2px;
}
.rating-pill {
color: #4ade80;
font-weight: 700;
}
/* Scrollbar for results */
.search-results::-webkit-scrollbar {
width: 6px;
}
.search-results::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 3px;
}

View File

@@ -1,592 +0,0 @@
:root {
--bg-base: #0a0a0f;
--bg-surface: #14141b;
--bg-elevated: #1c1c26;
--bg-hover: #252530;
--accent: #8b5cf6;
--accent-hover: #7c3aed;
--accent-light: rgba(139, 92, 246, 0.15);
--text-primary: #ffffff;
--text-secondary: #9ca3af;
--text-muted: #6b7280;
--border: rgba(255, 255, 255, 0.08);
--border-focus: rgba(139, 92, 246, 0.4);
--shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
--shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.5);
--radius-sm: 8px;
--radius-md: 12px;
--radius-lg: 16px;
--radius-xl: 24px;
--radius-full: 9999px;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
overflow-x: hidden;
line-height: 1.6;
}
.hidden { display: none !important; }
/* ===== TOP BAR ===== */
.top-bar {
position: fixed;
top: 0; left: 0; right: 0;
height: 64px;
background: rgba(10, 10, 15, 0.85);
backdrop-filter: blur(20px) saturate(180%);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 1.5rem;
z-index: 1000;
box-shadow: var(--shadow-sm);
}
.glass-btn {
background: var(--bg-surface);
border: 1px solid var(--border);
color: var(--text-primary);
padding: 0.625rem 1.25rem;
border-radius: var(--radius-full);
font-weight: 600;
font-size: 0.875rem;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.glass-btn:hover {
background: var(--bg-hover);
border-color: var(--accent);
transform: translateY(-1px);
}
.glass-btn:active {
transform: translateY(0);
}
.chapter-info {
display: flex;
align-items: center;
gap: 1rem;
font-size: 0.95rem;
font-weight: 600;
color: var(--text-primary);
}
.nav-arrow {
background: var(--bg-surface);
border: 1px solid var(--border);
width: 36px;
height: 36px;
border-radius: 50%;
font-size: 1.25rem;
cursor: pointer;
transition: all 0.2s;
color: var(--text-primary);
display: flex;
align-items: center;
justify-content: center;
}
.nav-arrow:hover {
background: var(--accent);
border-color: var(--accent);
transform: scale(1.05);
}
.nav-arrow:disabled {
opacity: 0.4;
cursor: not-allowed;
}
/* ===== READER CONTAINER ===== */
#reader {
margin-top: 64px;
padding: 2rem 1rem;
display: flex;
flex-direction: column;
align-items: center;
min-height: calc(100vh - 64px);
width: 100%;
}
/* ===== MANGA STYLES ===== */
.manga-container {
width: 100%;
max-width: var(--manga-max-width, 1200px);
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
gap: var(--page-spacing, 16px);
}
.page-img {
width: 100%;
max-width: var(--page-max-width, 900px);
height: auto;
border-radius: var(--radius-md);
box-shadow: var(--shadow-lg);
transition: transform 0.2s ease, box-shadow 0.2s ease;
cursor: pointer;
display: block;
}
.page-img:hover {
box-shadow: 0 24px 56px rgba(0, 0, 0, 0.6);
}
.page-img.zoomed {
position: fixed;
top: 64px;
left: 0;
right: 0;
bottom: 0;
max-width: 100vw;
max-height: calc(100vh - 64px);
width: auto;
height: auto;
margin: auto;
z-index: 999;
cursor: zoom-out;
border-radius: 0;
object-fit: contain;
}
.zoom-overlay {
position: fixed;
top: 64px;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.95);
z-index: 998;
cursor: zoom-out;
}
.double-container {
display: flex;
gap: var(--page-spacing, 16px);
width: 100%;
max-width: var(--manga-max-width, 1400px);
justify-content: center;
}
.double-container img {
width: 48%;
max-width: 700px;
height: auto;
border-radius: var(--radius-md);
box-shadow: var(--shadow-lg);
object-fit: contain;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.double-container img:hover {
box-shadow: 0 24px 56px rgba(0, 0, 0, 0.6);
}
/* ===== LIGHT NOVEL STYLES ===== */
.ln-content {
max-width: var(--ln-max-width, 750px);
width: 100%;
margin: 0 auto;
padding: 3rem 2.5rem;
line-height: var(--ln-line-height, 1.8);
font-size: var(--ln-font-size, 18px);
font-family: var(--ln-font-family, 'Georgia', serif);
color: var(--ln-text-color, #e5e7eb);
text-align: var(--ln-text-align, left);
}
.ln-content p {
margin-bottom: 1.5em;
}
.ln-content h1, .ln-content h2, .ln-content h3 {
margin-top: 2em;
margin-bottom: 1em;
font-weight: 700;
}
/* ===== SETTINGS PANEL ===== */
.settings-panel {
position: fixed;
right: 0;
top: 0;
bottom: 0;
width: 400px;
padding: 0;
z-index: 1001;
transform: translateX(100%);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow-y: auto;
display: flex;
flex-direction: column;
background: var(--bg-surface);
border-left: 1px solid var(--border);
box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
}
.settings-panel.open {
transform: translateX(0);
}
.panel-header {
position: sticky;
top: 0;
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
z-index: 10;
background: #0a0a0f;
border-bottom: 1px solid var(--border);
}
.panel-header h3 {
margin: 0;
font-size: 1.25rem;
font-weight: 700;
}
.close-btn {
width: 32px;
height: 32px;
border-radius: 50%;
font-size: 1.25rem;
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg-elevated);
border: none;
color: var(--text-secondary);
}
.close-btn:hover {
background: var(--accent);
color: var(--text-primary);
transform: rotate(90deg);
}
.panel-content {
flex: 1;
padding: 1.5rem;
overflow-y: auto;
}
.settings-section {
margin-bottom: 2rem;
padding-bottom: 2rem;
border-bottom: 1px solid var(--border);
}
.settings-section:last-child {
border-bottom: none;
margin-bottom: 0;
padding-bottom: 0;
}
.settings-section h4 {
margin: 0 0 1.25rem 0;
color: var(--text-primary);
font-size: 1rem;
font-weight: 700;
letter-spacing: -0.01em;
}
.control {
margin-bottom: 1.25rem;
}
.control:last-child {
margin-bottom: 0;
}
.control label {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.625rem;
font-size: 0.875rem;
color: var(--text-secondary);
font-weight: 500;
}
.control label span {
color: var(--text-primary);
font-weight: 600;
font-family: 'JetBrains Mono', monospace;
font-size: 0.8125rem;
}
/* Range Inputs */
input[type="range"] {
width: 100%;
border-radius: var(--radius-full);
outline: none;
-webkit-appearance: none;
cursor: pointer;
height: 8px;
background: var(--bg-hover);
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
border-radius: 50%;
cursor: pointer;
transition: all 0.2s;
box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
width: 20px;
height: 20px;
background: var(--accent);
}
input[type="range"]::-webkit-slider-thumb:hover {
transform: scale(1.15);
box-shadow: 0 4px 12px rgba(139, 92, 246, 0.6);
}
input[type="range"]::-moz-range-thumb {
width: 18px;
height: 18px;
background: var(--accent);
border-radius: 50%;
cursor: pointer;
border: none;
transition: all 0.2s;
}
/* Select & Color Inputs */
select, input[type="color"], input[type="number"] {
width: 100%;
padding: 0.625rem 0.875rem;
border-radius: var(--radius-md);
color: var(--text-primary);
font-size: 0.875rem;
transition: all 0.2s;
cursor: pointer;
background: var(--bg-elevated);
border: 1px solid var(--border);
}
select:hover, input[type="color"]:hover, input[type="number"]:hover {
border-color: var(--accent);
}
select:focus, input[type="color"]:focus, input[type="number"]:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-light);
transform: translateY(-1px);
}
input[type="color"] {
height: 44px;
padding: 0.25rem;
cursor: pointer;
}
/* Presets */
.presets {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;
}
.presets button {
background: var(--bg-elevated);
border-radius: var(--radius-md);
color: var(--text-primary);
cursor: pointer;
transition: all 0.2s;
font-size: 0.875rem;
padding: 1rem;
background: var(--bg-elevated);
border: 1px solid var(--border);
font-weight: 700;
letter-spacing: 0.02em;
}
.presets button:hover {
background: var(--accent);
background: var(--accent);
border-color: var(--accent);
transform: translateY(-2px);
box-shadow: 0 4px 15px var(--accent-light);
}
/* Toggle Switches */
.toggle-group {
display: flex;
gap: 0.5rem;
margin-top: 0.5rem;
}
.toggle-btn {
flex: 1;
background: var(--bg-elevated);
border-radius: var(--radius-md);
cursor: pointer;
transition: all 0.2s;
font-size: 0.8125rem;
text-align: center;
padding: 0.75rem 1rem;
background: var(--bg-elevated);
border: 1px solid var(--border);
color: var(--text-secondary);
font-weight: 600;
}
.toggle-btn:hover {
border-color: var(--accent);
color: var(--text-primary);
}
.toggle-btn.active {
background: var(--accent);
border-color: var(--accent);
color: var(--text-primary);
box-shadow: 0 2px 10px var(--accent-light);
}
/* Overlay */
.overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.75);
z-index: 1000;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s;
}
.overlay.active {
opacity: 1;
pointer-events: all;
}
/* Loading State */
.loading-spinner {
display: inline-block;
width: 40px;
height: 40px;
border: 3px solid var(--bg-elevated);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 4rem 2rem;
gap: 1rem;
color: var(--text-secondary);
}
/* Scrollbar */
.settings-panel::-webkit-scrollbar {
width: 8px;
}
.settings-panel::-webkit-scrollbar-track {
background: var(--bg-surface);
}
.settings-panel::-webkit-scrollbar-thumb {
background: var(--bg-elevated);
border-radius: 4px;
}
.settings-panel::-webkit-scrollbar-thumb:hover {
background: var(--bg-hover);
}
/* Responsive */
@media (max-width: 768px) {
.settings-panel {
width: 100%;
max-width: 100%;
}
.top-bar {
padding: 0 1rem;
}
.glass-btn {
padding: 0.5rem 1rem;
font-size: 0.8125rem;
}
.chapter-info {
font-size: 0.875rem;
gap: 0.75rem;
}
.double-container {
flex-direction: column;
}
.double-container img {
width: 100%;
max-width: 100%;
}
.ln-content {
padding: 2rem 1.5rem;
font-size: var(--ln-font-size, 16px);
}
}
/* Image Fit Modes */
.fit-width {
width: 100% !important;
height: auto !important;
max-width: 100% !important;
}
.fit-height {
height: var(--viewport-height, 85vh) !important;
width: auto !important;
max-width: 100% !important;
}
.fit-screen {
max-height: var(--viewport-height, 85vh) !important;
max-width: 100% !important;
width: auto !important;
height: auto !important;
object-fit: contain !important;
}
.page-img.longstrip-fit {
width: 50%;
max-width: 50%;
margin: 0 auto;
display: block;
}

View File

@@ -1,607 +0,0 @@
const reader = document.getElementById('reader');
const panel = document.getElementById('settings-panel');
const overlay = document.getElementById('overlay');
const settingsBtn = document.getElementById('settings-btn');
const closePanel = document.getElementById('close-panel');
const chapterLabel = document.getElementById('chapter-label');
const prevBtn = document.getElementById('prev-chapter');
const nextBtn = document.getElementById('next-chapter');
const prevUrl = localStorage.getItem('reader_prev_url');
const lnSettings = document.getElementById('ln-settings');
const mangaSettings = document.getElementById('manga-settings');
const config = {
ln: {
fontSize: 18,
lineHeight: 1.8,
maxWidth: 750,
fontFamily: '"Georgia", serif',
textColor: '#e5e7eb',
bg: '#14141b',
textAlign: 'justify'
},
manga: {
direction: 'rtl',
mode: 'auto',
spacing: 16,
imageFit: 'screen',
preloadCount: 3
}
};
let currentType = null;
let currentPages = [];
let observer = null;
const parts = window.location.pathname.split('/');
const bookId = parts[2];
let chapter = parts[3];
let provider = parts[4];
function loadConfig() {
try {
const saved = localStorage.getItem('readerConfig');
if (saved) {
const parsed = JSON.parse(saved);
Object.assign(config.ln, parsed.ln || {});
Object.assign(config.manga, parsed.manga || {});
}
} catch (e) {
console.error('Error loading config:', e);
}
updateUIFromConfig();
}
function saveConfig() {
try {
localStorage.setItem('readerConfig', JSON.stringify(config));
} catch (e) {
console.error('Error saving config:', e);
}
}
function updateUIFromConfig() {
// Light Novel
document.getElementById('font-size').value = config.ln.fontSize;
document.getElementById('font-size-value').textContent = config.ln.fontSize + 'px';
document.getElementById('line-height').value = config.ln.lineHeight;
document.getElementById('line-height-value').textContent = config.ln.lineHeight;
document.getElementById('max-width').value = config.ln.maxWidth;
document.getElementById('max-width-value').textContent = config.ln.maxWidth + 'px';
document.getElementById('font-family').value = config.ln.fontFamily;
document.getElementById('text-color').value = config.ln.textColor;
document.getElementById('bg-color').value = config.ln.bg;
// Text alignment buttons
document.querySelectorAll('[data-align]').forEach(btn => {
btn.classList.toggle('active', btn.dataset.align === config.ln.textAlign);
});
// Manga
document.getElementById('display-mode').value = config.manga.mode;
document.getElementById('image-fit').value = config.manga.imageFit;
document.getElementById('page-spacing').value = config.manga.spacing;
document.getElementById('page-spacing-value').textContent = config.manga.spacing + 'px';
document.getElementById('preload-count').value = config.manga.preloadCount;
// Direction buttons
document.querySelectorAll('[data-direction]').forEach(btn => {
btn.classList.toggle('active', btn.dataset.direction === config.manga.direction);
});
}
function applyStyles() {
if (currentType === 'ln') {
document.documentElement.style.setProperty('--ln-font-size', config.ln.fontSize + 'px');
document.documentElement.style.setProperty('--ln-line-height', config.ln.lineHeight);
document.documentElement.style.setProperty('--ln-max-width', config.ln.maxWidth + 'px');
document.documentElement.style.setProperty('--ln-font-family', config.ln.fontFamily);
document.documentElement.style.setProperty('--ln-text-color', config.ln.textColor);
document.documentElement.style.setProperty('--bg-base', config.ln.bg);
document.documentElement.style.setProperty('--ln-text-align', config.ln.textAlign);
}
if (currentType === 'manga') {
document.documentElement.style.setProperty('--page-spacing', config.manga.spacing + 'px');
document.documentElement.style.setProperty('--page-max-width', 900 + 'px');
document.documentElement.style.setProperty('--manga-max-width', 1400 + 'px');
const viewportHeight = window.innerHeight - 64 - 32;
document.documentElement.style.setProperty('--viewport-height', viewportHeight + 'px');
}
}
function updateSettingsVisibility() {
lnSettings.classList.toggle('hidden', currentType !== 'ln');
mangaSettings.classList.toggle('hidden', currentType !== 'manga');
}
async function loadChapter() {
reader.innerHTML = `
<div class="loading-container">
<div class="loading-spinner"></div>
<span>Loading chapter...</span>
</div>
`;
try {
const res = await fetch(`/api/book/${bookId}/${chapter}/${provider}`);
const data = await res.json();
if (data.title) {
chapterLabel.textContent = data.title;
document.title = data.title;
} else {
chapterLabel.textContent = `Chapter ${chapter}`;
document.title = `Chapter ${chapter}`;
}
if (data.error) {
reader.innerHTML = `
<div class="loading-container">
<span style="color: #ef4444;">Error: ${data.error}</span>
</div>
`;
return;
}
currentType = data.type;
updateSettingsVisibility();
applyStyles();
reader.innerHTML = '';
if (data.type === 'manga') {
currentPages = data.pages || [];
loadManga(currentPages);
} else if (data.type === 'ln') {
loadLN(data.content);
}
} catch (error) {
reader.innerHTML = `
<div class="loading-container">
<span style="color: #ef4444;">Error loading chapter: ${error.message}</span>
</div>
`;
}
}
function loadManga(pages) {
if (!pages || pages.length === 0) {
reader.innerHTML = '<div class="loading-container"><span>No pages found</span></div>';
return;
}
const container = document.createElement('div');
container.className = 'manga-container';
let isLongStrip = false;
if (config.manga.mode === 'longstrip') {
isLongStrip = true;
} else if (config.manga.mode === 'auto' && detectLongStrip(pages)) {
isLongStrip = true;
}
const useDouble = config.manga.mode === 'double' ||
(config.manga.mode === 'auto' && !isLongStrip && shouldUseDoublePage(pages));
if (useDouble) {
loadDoublePage(container, pages);
} else {
loadSinglePage(container, pages);
}
reader.appendChild(container);
setupLazyLoading();
enableMangaPageNavigation();
}
function shouldUseDoublePage(pages) {
if (pages.length <= 5) return false;
const widePages = pages.filter(p => {
if (!p.height || !p.width) return false;
const ratio = p.width / p.height;
return ratio > 1.3;
});
if (widePages.length > pages.length * 0.3) return false;
return true;
}
function loadSinglePage(container, pages) {
pages.forEach((page, index) => {
const img = createImageElement(page, index);
container.appendChild(img);
});
}
function loadDoublePage(container, pages) {
let i = 0;
while (i < pages.length) {
const currentPage = pages[i];
const nextPage = pages[i + 1];
const isWide = currentPage.width && currentPage.height &&
(currentPage.width / currentPage.height) > 1.1;
if (isWide) {
const img = createImageElement(currentPage, i);
container.appendChild(img);
i++;
} else {
const doubleContainer = document.createElement('div');
doubleContainer.className = 'double-container';
const leftPage = createImageElement(currentPage, i);
if (nextPage) {
const nextIsWide = nextPage.width && nextPage.height &&
(nextPage.width / nextPage.height) > 1.3;
if (nextIsWide) {
const singleImg = createImageElement(currentPage, i);
container.appendChild(singleImg);
i++;
} else {
const rightPage = createImageElement(nextPage, i + 1);
if (config.manga.direction === 'rtl') {
doubleContainer.appendChild(rightPage);
doubleContainer.appendChild(leftPage);
} else {
doubleContainer.appendChild(leftPage);
doubleContainer.appendChild(rightPage);
}
container.appendChild(doubleContainer);
i += 2;
}
} else {
const singleImg = createImageElement(currentPage, i);
container.appendChild(singleImg);
i++;
}
}
}
}
function createImageElement(page, index) {
const img = document.createElement('img');
img.className = 'page-img';
img.dataset.index = index;
const url = buildProxyUrl(page.url, page.headers);
if (config.manga.mode === 'longstrip' && index > 0) {
img.classList.add('longstrip-fit');
} else {
if (config.manga.imageFit === 'width') img.classList.add('fit-width');
else if (config.manga.imageFit === 'height') img.classList.add('fit-height');
else if (config.manga.imageFit === 'screen') img.classList.add('fit-screen');
}
if (index < config.manga.preloadCount) {
img.src = url;
} else {
img.dataset.src = url;
img.loading = 'lazy';
}
img.alt = `Page ${index + 1}`;
return img;
}
function buildProxyUrl(url, headers = {}) {
const params = new URLSearchParams({
url
});
if (headers.referer) params.append('referer', headers.referer);
if (headers['user-agent']) params.append('ua', headers['user-agent']);
if (headers.cookie) params.append('cookie', headers.cookie);
return `/api/proxy?${params.toString()}`;
}
function detectLongStrip(pages) {
if (!pages || pages.length === 0) return false;
const relevant = pages.slice(1);
const tall = relevant.filter(p => p.height && p.width && (p.height / p.width) > 2);
return tall.length >= 2 || (tall.length / relevant.length) > 0.3;
}
function setupLazyLoading() {
if (observer) observer.disconnect();
observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
if (img.dataset.src) {
img.src = img.dataset.src;
delete img.dataset.src;
observer.unobserve(img);
}
}
});
}, {
rootMargin: '200px'
});
document.querySelectorAll('img[data-src]').forEach(img => observer.observe(img));
}
function loadLN(html) {
const div = document.createElement('div');
div.className = 'ln-content';
div.innerHTML = html;
reader.appendChild(div);
}
// Event Listeners - Light Novel
document.getElementById('font-size').addEventListener('input', (e) => {
config.ln.fontSize = parseInt(e.target.value);
document.getElementById('font-size-value').textContent = e.target.value + 'px';
applyStyles();
saveConfig();
});
document.getElementById('line-height').addEventListener('input', (e) => {
config.ln.lineHeight = parseFloat(e.target.value);
document.getElementById('line-height-value').textContent = e.target.value;
applyStyles();
saveConfig();
});
document.getElementById('max-width').addEventListener('input', (e) => {
config.ln.maxWidth = parseInt(e.target.value);
document.getElementById('max-width-value').textContent = e.target.value + 'px';
applyStyles();
saveConfig();
});
document.getElementById('font-family').addEventListener('change', (e) => {
config.ln.fontFamily = e.target.value;
applyStyles();
saveConfig();
});
document.getElementById('text-color').addEventListener('change', (e) => {
config.ln.textColor = e.target.value;
applyStyles();
saveConfig();
});
document.getElementById('bg-color').addEventListener('change', (e) => {
config.ln.bg = e.target.value;
applyStyles();
saveConfig();
});
// Text alignment
document.querySelectorAll('[data-align]').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('[data-align]').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
config.ln.textAlign = btn.dataset.align;
applyStyles();
saveConfig();
});
});
// Presets
document.querySelectorAll('[data-preset]').forEach(btn => {
btn.addEventListener('click', () => {
const preset = btn.dataset.preset;
const presets = {
dark: { bg: '#14141b', textColor: '#e5e7eb' },
sepia: { bg: '#f4ecd8', textColor: '#5c472d' },
light: { bg: '#fafafa', textColor: '#1f2937' },
amoled: { bg: '#000000', textColor: '#ffffff' }
};
if (presets[preset]) {
Object.assign(config.ln, presets[preset]);
document.getElementById('bg-color').value = config.ln.bg;
document.getElementById('text-color').value = config.ln.textColor;
applyStyles();
saveConfig();
}
});
});
// Event Listeners - Manga
document.getElementById('display-mode').addEventListener('change', (e) => {
config.manga.mode = e.target.value;
saveConfig();
loadChapter();
});
document.getElementById('image-fit').addEventListener('change', (e) => {
config.manga.imageFit = e.target.value;
saveConfig();
loadChapter();
});
document.getElementById('page-spacing').addEventListener('input', (e) => {
config.manga.spacing = parseInt(e.target.value);
document.getElementById('page-spacing-value').textContent = e.target.value + 'px';
applyStyles();
saveConfig();
});
document.getElementById('preload-count').addEventListener('change', (e) => {
config.manga.preloadCount = parseInt(e.target.value);
saveConfig();
});
// Direction
document.querySelectorAll('[data-direction]').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('[data-direction]').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
config.manga.direction = btn.dataset.direction;
saveConfig();
loadChapter();
});
});
// Navigation
prevBtn.addEventListener('click', () => {
const newChapter = String(parseInt(chapter) - 1);
updateURL(newChapter);
window.scrollTo(0, 0);
loadChapter();
});
nextBtn.addEventListener('click', () => {
const newChapter = String(parseInt(chapter) + 1);
updateURL(newChapter);
window.scrollTo(0, 0);
loadChapter();
});
function updateURL(newChapter) {
chapter = newChapter;
const newUrl = `/reader/${bookId}/${chapter}/${provider}`;
window.history.pushState({}, '', newUrl);
}
document.getElementById('back-btn').addEventListener('click', () => {
const prev = localStorage.getItem('reader_prev_url');
if (prev) {
window.location.href = prev;
} else {
history.back();
}
});
settingsBtn.addEventListener('click', () => {
panel.classList.add('open');
overlay.classList.add('active');
});
closePanel.addEventListener('click', closeSettings);
overlay.addEventListener('click', closeSettings);
function closeSettings() {
panel.classList.remove('open');
overlay.classList.remove('active');
}
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && panel.classList.contains('open')) {
closeSettings();
}
});
function enableMangaPageNavigation() {
if (currentType !== 'manga') return;
const logicalPages = [];
document.querySelectorAll('.manga-container > *').forEach(el => {
if (el.classList.contains('double-container')) {
logicalPages.push(el);
} else if (el.tagName === 'IMG') {
logicalPages.push(el);
}
});
if (logicalPages.length === 0) return;
function scrollToLogical(index) {
if (index < 0 || index >= logicalPages.length) return;
const topBar = document.querySelector('.top-bar');
const offset = topBar ? -topBar.offsetHeight : 0;
const y = logicalPages[index].getBoundingClientRect().top
+ window.pageYOffset
+ offset;
window.scrollTo({
top: y,
behavior: 'smooth'
});
}
function getCurrentLogicalIndex() {
let closest = 0;
let minDist = Infinity;
logicalPages.forEach((el, i) => {
const rect = el.getBoundingClientRect();
const dist = Math.abs(rect.top);
if (dist < minDist) {
minDist = dist;
closest = i;
}
});
return closest;
}
const rtl = () => config.manga.direction === 'rtl';
document.addEventListener('keydown', (e) => {
if (currentType !== 'manga') return;
if (e.target.tagName === 'INPUT' || e.target.tagName === 'SELECT') return;
const index = getCurrentLogicalIndex();
if (e.key === 'ArrowLeft') {
scrollToLogical(rtl() ? index + 1 : index - 1);
}
if (e.key === 'ArrowRight') {
scrollToLogical(rtl() ? index - 1 : index + 1);
}
});
reader.addEventListener('click', (e) => {
if (currentType !== 'manga') return;
const bounds = reader.getBoundingClientRect();
const x = e.clientX - bounds.left;
const half = bounds.width / 2;
const index = getCurrentLogicalIndex();
if (x < half) {
scrollToLogical(rtl() ? index + 1 : index - 1);
} else {
scrollToLogical(rtl() ? index - 1 : index + 1);
}
});
}
let resizeTimer;
window.addEventListener('resize', () => {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(() => {
applyStyles();
}, 250);
});
if (!bookId || !chapter || !provider) {
reader.innerHTML = `
<div class="loading-container">
<span style="color: #ef4444;">Missing required parameters (bookId, chapter, provider)</span>
</div>
`;
} else {
loadConfig();
loadChapter();
}

View File

@@ -1,418 +0,0 @@
:root {
--bg-base: #000000;
--bg-overlay: #101012;
--accent: #8b5cf6; /* Keeping your purple accent for brand consistency */
--accent-dark: #7c3aed;
--text-primary: #ffffff;
--text-secondary: #a1a1aa;
--radius-full: 9999px;
--radius-md: 16px;
--glass-border: 1px solid rgba(255, 255, 255, 0.1);
--glass-bg: rgba(20, 20, 23, 0.7);
/* Plyr Theme Variables - YouTube Style */
--plyr-color-main: #8b5cf6;
--plyr-video-control-color: #ffffff;
--plyr-video-control-background-hover: rgba(255, 255, 255, 0.1); /* Subtle hover like YT */
--plyr-menu-background: rgba(28, 28, 30, 0.95);
--plyr-menu-color: #ffffff;
--plyr-menu-border-color: rgba(255, 255, 255, 0.1);
--plyr-font-family: 'Inter', sans-serif;
/* Custom YT-like sizing */
--plyr-control-icon-size: 18px;
--plyr-control-spacing: 10px;
}
body {
margin: 0;
background-color: var(--bg-base);
color: var(--text-primary);
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
}
/* --- TOP BAR --- */
.top-bar {
padding: 1.5rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
top: 0; left: 0; right: 0;
z-index: 100;
background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, transparent 100%);
pointer-events: none;
}
.back-btn {
pointer-events: auto;
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.8rem 1.8rem;
background: var(--glass-bg);
backdrop-filter: blur(12px);
border: var(--glass-border);
border-radius: var(--radius-full);
color: white;
text-decoration: none;
font-weight: 600;
font-size: 0.95rem;
transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.back-btn:hover {
background: rgba(255, 255, 255, 0.15);
transform: scale(1.02);
box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
border-color: rgba(139, 92, 246, 0.3);
}
/* --- THEATER LAYOUT --- */
.theater-container {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
max-width: 1300px;
margin: 0 auto;
padding: 0 2rem;
position: relative;
z-index: 10;
}
/* --- TOOLBAR (Extensions + Toggles) --- */
.player-toolbar {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
gap: 1rem;
margin-bottom: 1rem;
position: relative;
z-index: 50;
}
/* Modern Pill Dropdown */
.extension-select {
appearance: none;
-webkit-appearance: none;
background-color: var(--glass-bg);
backdrop-filter: blur(12px);
border: var(--glass-border);
color: var(--text-primary);
padding: 0.7rem 2.5rem 0.7rem 1.5rem;
border-radius: var(--radius-full);
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
outline: none;
min-width: 180px;
transition: all 0.2s ease;
background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 1rem center;
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.extension-select:hover {
background-color: rgba(255,255,255,0.1);
border-color: var(--accent);
}
/* SUB / DUB TOGGLE */
.sd-toggle {
display: flex;
background: var(--glass-bg);
border: var(--glass-border);
border-radius: var(--radius-full);
padding: 4px;
position: relative;
cursor: pointer;
backdrop-filter: blur(12px);
}
.sd-option {
padding: 0.5rem 1.2rem;
font-size: 0.85rem;
font-weight: 700;
color: var(--text-secondary);
z-index: 2;
transition: color 0.3s;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.sd-option.active {
color: white;
}
/* The sliding pill background */
.sd-bg {
position: absolute;
top: 4px;
left: 4px;
bottom: 4px;
width: calc(50% - 4px);
background: var(--accent);
border-radius: var(--radius-full);
transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
z-index: 1;
}
/* Toggle State Logic handled via class on parent */
.sd-toggle[data-state="dub"] .sd-bg {
transform: translateX(100%);
}
/* --- VIDEO WRAPPER --- */
.video-wrapper {
width: 100%;
aspect-ratio: 16/9;
background: #000;
border-radius: 20px;
overflow: hidden;
box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.08);
position: relative;
transition: box-shadow 0.3s ease;
}
.video-wrapper:hover {
box-shadow: 0 25px 70px rgba(139, 92, 246, 0.15), 0 0 0 1px rgba(139, 92, 246, 0.3);
}
video {
width: 100%;
height: 100%;
object-fit: contain;
}
/* Loading Overlay */
.loading-overlay {
position: absolute;
inset: 0;
background: #000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 20;
color: var(--text-secondary);
gap: 1rem;
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid rgba(255,255,255,0.1);
border-radius: 50%;
border-top-color: var(--accent);
animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
/* --- CONTROLS --- */
.controls-area {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1.5rem;
padding: 0 0.5rem;
}
.episode-info h2 {
margin: 0;
font-size: 1.4rem;
font-weight: 700;
letter-spacing: -0.5px;
text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.episode-info span {
color: var(--accent);
font-size: 0.95rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
margin-top: 4px;
display: block;
}
.nav-controls {
display: flex;
gap: 1rem;
}
.nav-btn {
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.1);
color: white;
padding: 0.8rem 1.6rem;
border-radius: var(--radius-full);
font-weight: 600;
cursor: pointer;
display: flex;
align-items: center;
gap: 0.6rem;
transition: all 0.2s ease;
backdrop-filter: blur(10px);
}
.nav-btn:hover:not(:disabled) {
background: var(--accent);
border-color: var(--accent);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}
.nav-btn:disabled {
opacity: 0.3;
cursor: not-allowed;
}
/* --- PLYR YOUTUBE-STYLE OVERRIDES --- */
/* 1. Base Video Container */
.plyr--video {
border-radius: 20px;
font-family: 'Inter', sans-serif;
}
/* 2. Controls Container (Gradient Overlay) */
.plyr__controls {
background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, transparent 100%) !important;
padding: 10px 20px 20px 20px !important;
margin: 0 !important;
border-radius: 0 0 20px 20px !important;
}
/* 3. Progress Bar (YouTube Style) */
.plyr__progress input[type=range] {
cursor: pointer;
}
/* The track */
.plyr--full-ui input[type=range] {
color: var(--accent); /* Your brand color instead of YouTube red */
height: 4px; /* Thinner by default */
transition: height 0.1s ease;
}
/* Expand progress bar on hover like YT */
.plyr__progress__container:hover input[type=range] {
height: 6px;
}
/* 4. Buttons (Clean Icons, No Background) */
.plyr__control {
background: transparent !important;
border-radius: 4px;
transition: transform 0.1s, opacity 0.2s;
padding: 7px !important;
}
.plyr__control:hover {
background: rgba(255,255,255,0.1) !important;
opacity: 1;
}
.plyr__control svg {
width: 24px;
height: 24px;
filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
/* 5. Center Play Button (Large, Pulsing) */
.plyr__control--overlaid {
background: rgba(0, 0, 0, 0.6) !important;
border: 2px solid white; /* Optional: White ring for classic look */
border-radius: 50%;
padding: 1.5rem !important;
opacity: 0.9;
transition: all 0.2s ease;
}
.plyr__control--overlaid svg {
width: 32px;
height: 32px;
}
.plyr__control--overlaid:hover {
background: var(--accent) !important;
border-color: var(--accent);
transform: scale(1.1);
}
/* 6. Time Display */
.plyr__time {
font-size: 13px;
font-weight: 500;
text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
/* 7. Menus (Floating Glass Panels) */
.plyr__menu__container {
background: rgba(28, 28, 30, 0.95) !important;
backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 12px !important;
padding: 8px;
box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
bottom: 60px !important; /* Lift above controls */
}
.plyr__menu__container .plyr__control {
font-size: 13px;
font-weight: 500;
padding: 8px 12px !important;
border-radius: 6px;
justify-content: flex-start;
}
.plyr__menu__container .plyr__control:hover {
background: rgba(255,255,255,0.1) !important;
}
/* Active menu item */
.plyr__menu__container .plyr__control[aria-checked="true"] {
color: var(--accent);
}
.plyr__menu__container .plyr__control[aria-checked="true"]::after {
background: var(--accent); /* The checkmark */
}
/* 8. Tooltips (Time preview) */
.plyr__tooltip {
background: rgba(28, 28, 30, 0.9);
border: 1px solid rgba(255,255,255,0.1);
border-radius: 4px;
font-size: 12px;
font-weight: 600;
padding: 4px 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
/* 9. Subtitles (Cinematic) */
.plyr__cues {
margin-bottom: 50px !important; /* Push subtitles up so controls don't overlap */
}
.plyr__cues span {
background-color: rgba(0, 0, 0, 0.75) !important;
font-family: 'Inter', sans-serif;
font-weight: 600;
font-size: 18px;
padding: 4px 12px;
border-radius: 4px;
text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}