HTML5 在线漫画阅读器 (index.html)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=3,user-scalable=yes">
<title>惑星密码 - 在线漫画阅读器</title>
<style>
*{box-sizing:border-box;margin:0;padding:0}
body{background:#0d0f17;color:#f1f5f9;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;min-height:100vh;display:flex;flex-direction:column}
header{position:sticky;top:0;z-index:50;background:rgba(13,15,23,0.92);backdrop-filter:blur(12px);border-bottom:1px solid rgba(255,255,255,0.09);padding:10px 16px;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:10px}
.badge{background:linear-gradient(135deg,#ec4899,#8b5cf6);color:#fff;font-size:11px;font-weight:700;padding:3px 8px;border-radius:99px}
.title{font-size:16px;font-weight:700;color:#fff}
.controls{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
button{background:rgba(255,255,255,0.08);color:#e2e8f0;border:1px solid rgba(255,255,255,0.14);padding:6px 12px;border-radius:8px;font-size:12px;cursor:pointer;transition:.18s}
button:hover,button.active{background:#ec4899;color:#fff;border-color:#ec4899}
.hero{max-width:920px;margin:16px auto;padding:18px;background:rgba(255,255,255,0.04);border:1px solid rgba(255,255,255,0.08);border-radius:14px;display:flex;gap:18px;align-items:flex-start}
.hero img{width:120px;height:160px;object-fit:cover;border-radius:10px;flex-shrink:0;box-shadow:0 8px 24px rgba(0,0,0,0.45)}
.hero-meta h1{font-size:20px;margin-bottom:6px}
.hero-meta .sub{font-size:13px;color:#94a3b8;margin-bottom:8px}
.tags{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.tag{background:rgba(236,72,153,0.16);color:#f472b6;padding:2px 8px;border-radius:6px;font-size:11px}
.desc{font-size:13px;line-height:1.6;color:#cbd5e1}
.reader-wrap{max-width:860px;width:100%;margin:0 auto 40px;padding:0 8px;flex:1}
.scroll-mode .page-card{margin-bottom:10px;background:#161925;border-radius:8px;overflow:hidden;box-shadow:0 6px 20px rgba(0,0,0,0.4)}
.scroll-mode .page-card img{width:100%;height:auto;display:block}
.page-footer{text-align:center;font-size:11px;color:#64748b;padding:4px 0}
.flip-controls{display:none;justify-content:center;align-items:center;gap:14px;margin:14px 0}
.flip-mode .flip-controls{display:flex}
.drawer{display:none;max-width:920px;margin:0 auto 20px;padding:16px;background:rgba(255,255,255,0.04);border-radius:12px;border:1px solid rgba(255,255,255,0.1)}
.drawer.open{display:block}
.chap-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:8px;margin-top:10px}
.chap-item{padding:8px 10px;background:rgba(255,255,255,0.06);border-radius:8px;font-size:12px;color:#e2e8f0;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chap-item:hover{background:rgba(236,72,153,0.28)}
@media(max-width:600px){.hero{flex-direction:column;align-items:center;text-align:center}.tags{justify-content:center}}
</style>
</head>
<body>
<header>
<div class="brand">
<span class="badge">BILIMANGA · 统一媒体库</span>
<span class="title" id="hdrTitle"></span>
</div>
<div class="controls">
<button id="btnScroll" class="active" onclick="setMode('scroll')">条漫下拉模式</button>
<button id="btnFlip" onclick="setMode('flip')">单页翻页模式</button>
<button onclick="toggleCatalog()">章节目录 (<span id="chapCount">0</span>)</button>
<button onclick="cycleLang()" id="btnLang">繁/簡/EN</button>
</div>
</header>
<section class="hero">
<img id="heroCover" src="" alt="cover">
<div class="hero-meta">
<h1 id="heroTitle"></h1>
<div class="sub" id="heroSub"></div>
<div class="tags" id="heroTags"></div>
<p class="desc" id="heroDesc"></p>
</div>
</section>
<section class="drawer" id="catDrawer">
<h3 style="font-size:14px;margin-bottom:6px">全卷章节目录 (点击切换预览章节)</h3>
<div class="chap-grid" id="chapGrid"></div>
</section>
<div class="reader-wrap scroll-mode" id="readerWrap">
<div class="flip-controls">
<button onclick="stepPage(-1)">◀ 上一页</button>
<span id="pageIndicator" style="font-size:13px;color:#cbd5e1">1 / 1</span>
<button onclick="stepPage(1)">下一页 ▶</button>
</div>
<div id="pagesContainer"></div>
</div>
<script>
const COMIC = {"slug": "bilimanga-1093", "mangaid": "1093", "zh_title": "惑星密码", "hant_title": "惑星密碼", "en_title": "惑星密码 (Bilimanga #1093)", "author": "松本嵩春", "tags": ["奇幻", "冒险", "战斗", "战争", "科幻", "人外", "斗智", "科幻未来"], "zh_desc": "这个星球经历三次大天灾,整个地表被大量原因不明的砂所覆盖——砂的威力让这个曾被称为「水之星」的星球步入荒废。尽管如此,依然有人们在这地表上和生命在奋斗著————\n\n📚 作品信息:作者 松本嵩春 · 评分 10 · 共收录 9 卷 / 79 话章节目录与高清彩页/条漫预览。", "hant_desc": "這個星球經歷三次大天災,整個地表被大量原因不明的砂所覆蓋——砂的威力讓這個曾被稱為「水之星」的星球步入荒廢。儘管如此,依然有人們在這地表上和生命在奮鬥著————\n\n📚 作品資訊:作者 松本嵩春 · 評分 10 · 共收錄 9 卷 / 79 話章節目錄與高清彩頁/條漫預覽。", "en_desc": "Popular serialized manga '惑星密码' (惑星密碼) by 松本嵩春. Includes 9 volumes and 79 chapters with full online vertical/page-flip web reader.", "pages": ["https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_01.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_02.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_03.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_04.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_05.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1093/page_06.jpg"], "volumes": [{"title_hant": "惑星密碼 1", "title_zh": "惑星密码 1", "cover_id": 1971795, "first_chap_id": 92067, "cover_url": "https://i.motiezw.com/cover/1093/1971795.jpg"}, {"title_hant": "惑星密碼 2", "title_zh": "惑星密码 2", "cover_id": 1972030, "first_chap_id": 92075, "cover_url": "https://i.motiezw.com/cover/1093/1972030.jpg"}, {"title_hant": "惑星密碼 3", "title_zh": "惑星密码 3", "cover_id": 1972260, "first_chap_id": 92084, "cover_url": "https://i.motiezw.com/cover/1093/1972260.jpg"}, {"title_hant": "惑星密碼 4", "title_zh": "惑星密码 4", "cover_id": 1972484, "first_chap_id": 92092, "cover_url": "https://i.motiezw.com/cover/1093/1972484.jpg"}, {"title_hant": "惑星密碼 5", "title_zh": "惑星密码 5", "cover_id": 1972706, "first_chap_id": 92100, "cover_url": "https://i.motiezw.com/cover/1093/1972706.jpg"}, {"title_hant": "惑星密碼 6", "title_zh": "惑星密码 6", "cover_id": 1972927, "first_chap_id": 92109, "cover_url": "https://i.motiezw.com/cover/1093/1972927.jpg"}, {"title_hant": "惑星密碼 7", "title_zh": "惑星密码 7", "cover_id": 1973136, "first_chap_id": 92118, "cover_url": "https://i.motiezw.com/cover/1093/1973136.jpg"}, {"title_hant": "惑星密碼 8", "title_zh": "惑星密码 8", "cover_id": 1973332, "first_chap_id": 92127, "cover_url": "https://i.motiezw.com/cover/1093/1973332.jpg"}, {"title_hant": "惑星密碼 9", "title_zh": "惑星密码 9", "cover_id": 1973558, "first_chap_id": 92142, "cover_url": "https://i.motiezw.com/cover/1093/1973558.jpg"}], "chapters": [{"cid": "92067", "title": "AGHARTA act.1", "title_zh": "AGHARTA act.1"}, {"cid": "92068", "title": "AGHARTA act.2", "title_zh": "AGHARTA act.2"}, {"cid": "92069", "title": "AGHARTA act.3", "title_zh": "AGHARTA act.3"}, {"cid": "92070", "title": "AGHARTA act.4", "title_zh": "AGHARTA act.4"}, {"cid": "92071", "title": "AGHARTA act.5", "title_zh": "AGHARTA act.5"}, {"cid": "92072", "title": "AGHARTA act.6", "title_zh": "AGHARTA act.6"}, {"cid": "92073", "title": "AGHARTA act.7", "title_zh": "AGHARTA act.7"}, {"cid": "92075", "title": "AGHARTA act.8", "title_zh": "AGHARTA act.8"}, {"cid": "92076", "title": "AGHARTA act.9", "title_zh": "AGHARTA act.9"}, {"cid": "92077", "title": "AGHARTA act.10", "title_zh": "AGHARTA act.10"}, {"cid": "92078", "title": "AGHARTA act.11", "title_zh": "AGHARTA act.11"}, {"cid": "92079", "title": "AGHARTA act.12", "title_zh": "AGHARTA act.12"}, {"cid": "92080", "title": "AGHARTA act.13", "title_zh": "AGHARTA act.13"}, {"cid": "92081", "title": "AGHARTA act.14", "title_zh": "AGHARTA act.14"}, {"cid": "92082", "title": "AGHARTA act.15", "title_zh": "AGHARTA act.15"}, {"cid": "92084", "title": "AGHARTA act.16", "title_zh": "AGHARTA act.16"}, {"cid": "92085", "title": "AGHARTA act.17", "title_zh": "AGHARTA act.17"}, {"cid": "92086", "title": "AGHARTA act.18", "title_zh": "AGHARTA act.18"}, {"cid": "92087", "title": "AGHARTA act.19", "title_zh": "AGHARTA act.19"}, {"cid": "92088", "title": "AGHARTA act.20", "title_zh": "AGHARTA act.20"}, {"cid": "92089", "title": "AGHARTA act.21", "title_zh": "AGHARTA act.21"}, {"cid": "92092", "title": "AGHARTA act.23", "title_zh": "AGHARTA act.23"}, {"cid": "92093", "title": "AGHARTA act.24", "title_zh": "AGHARTA act.24"}, {"cid": "92094", "title": "AGHARTA act.25", "title_zh": "AGHARTA act.25"}, {"cid": "92095", "title": "AGHARTA act.26", "title_zh": "AGHARTA act.26"}, {"cid": "92096", "title": "AGHARTA act.27", "title_zh": "AGHARTA act.27"}, {"cid": "92097", "title": "AGHARTA act.28", "title_zh": "AGHARTA act.28"}, {"cid": "92098", "title": "AGHARTA act.29", "title_zh": "AGHARTA act.29"}, {"cid": "92100", "title": "AGHARTA act.30", "title_zh": "AGHARTA act.30"}, {"cid": "92101", "title": "AGHARTA act.31", "title_zh": "AGHARTA act.31"}, {"cid": "92102", "title": "AGHARTA act.32", "title_zh": "AGHARTA act.32"}, {"cid": "92103", "title": "AGHARTA act.33", "title_zh": "AGHARTA act.33"}, {"cid": "92104", "title": "AGHARTA act.34", "title_zh": "AGHARTA act.34"}, {"cid": "92105", "title": "AGHARTA act.35", "title_zh": "AGHARTA act.35"}, {"cid": "92106", "title": "AGHARTA act.36", "title_zh": "AGHARTA act.36"}, {"cid": "92107", "title": "AGHARTA act.37", "title_zh": "AGHARTA act.37"}, {"cid": "92109", "title": "AGHARTA act.38", "title_zh": "AGHARTA act.38"}, {"cid": "92110", "title": "AGHARTA act.39", "title_zh": "AGHARTA act.39"}, {"cid": "92111", "title": "AGHARTA act.40", "title_zh": "AGHARTA act.40"}, {"cid": "92112", "title": "AGHARTA act.41", "title_zh": "AGHARTA act.41"}, {"cid": "92113", "title": "AGHARTA act.42", "title_zh": "AGHARTA act.42"}, {"cid": "92114", "title": "AGHARTA act.43", "title_zh": "AGHARTA act.43"}, {"cid": "92116", "title": "AGHARTA act.45", "title_zh": "AGHARTA act.45"}, {"cid": "92118", "title": "AGHARTA act.46", "title_zh": "AGHARTA act.46"}, {"cid": "92119", "title": "AGHARTA act.47", "title_zh": "AGHARTA act.47"}, {"cid": "92120", "title": "AGHARTA act.48", "title_zh": "AGHARTA act.48"}, {"cid": "92121", "title": "AGHARTA act.49", "title_zh": "AGHARTA act.49"}, {"cid": "92122", "title": "AGHARTA act.50", "title_zh": "AGHARTA act.50"}, {"cid": "92123", "title": "AGHARTA act.51", "title_zh": "AGHARTA act.51"}, {"cid": "92124", "title": "AGHARTA act.52", "title_zh": "AGHARTA act.52"}, {"cid": "92125", "title": "AGHARTA act.53", "title_zh": "AGHARTA act.53"}, {"cid": "92127", "title": "AGHARTA act.54", "title_zh": "AGHARTA act.54"}, {"cid": "92128", "title": "AGHARTA act.55", "title_zh": "AGHARTA act.55"}, {"cid": "92129", "title": "AGHARTA act.56", "title_zh": "AGHARTA act.56"}, {"cid": "92130", "title": "AGHARTA act.57", "title_zh": "AGHARTA act.57"}, {"cid": "92131", "title": "AGHARTA act.58", "title_zh": "AGHARTA act.58"}, {"cid": "92132", "title": "AGHARTA act.59", "title_zh": "AGHARTA act.59"}, {"cid": "92133", "title": "AGHARTA act.60", "title_zh": "AGHARTA act.60"}, {"cid": "92134", "title": "AGHARTA act.61", "title_zh": "AGHARTA act.61"}, {"cid": "92135", "title": "AGHARTA act.62", "title_zh": "AGHARTA act.62"}]};
let lang = 'zh';
let mode = 'scroll';
let curPage = 0;
function renderMeta() {
const t = lang === 'zh' ? COMIC.zh_title : (lang === 'hant' ? COMIC.hant_title : COMIC.en_title);
const d = lang === 'zh' ? COMIC.zh_desc : (lang === 'hant' ? COMIC.hant_desc : COMIC.en_desc);
document.getElementById('hdrTitle').textContent = t;
document.getElementById('heroTitle').textContent = t;
document.getElementById('heroSub').textContent = `${COMIC.author} · 共 ${COMIC.volumes.length} 卷 / ${COMIC.chapters.length} 话`;
document.getElementById('heroDesc').textContent = d;
document.getElementById('heroCover').src = COMIC.pages[0] || '';
document.getElementById('chapCount').textContent = COMIC.chapters.length;
const tg = document.getElementById('heroTags');
tg.innerHTML = '';
(COMIC.tags || []).forEach(x => {
const s = document.createElement('span');
s.className = 'tag';
s.textContent = x;
tg.appendChild(s);
});
}
function renderCatalog() {
const g = document.getElementById('chapGrid');
g.innerHTML = '';
(COMIC.chapters || []).forEach((c, idx) => {
const d = document.createElement('div');
d.className = 'chap-item';
d.textContent = c.title_zh || c.title;
d.onclick = () => {
curPage = idx % COMIC.pages.length;
if (mode === 'flip') renderPages();
else document.querySelectorAll('.page-card')[curPage]?.scrollIntoView({behavior:'smooth'});
document.getElementById('catDrawer').classList.remove('open');
};
g.appendChild(d);
});
}
function renderPages() {
const wrap = document.getElementById('readerWrap');
wrap.className = 'reader-wrap ' + (mode === 'scroll' ? 'scroll-mode' : 'flip-mode');
const box = document.getElementById('pagesContainer');
box.innerHTML = '';
const list = mode === 'scroll' ? COMIC.pages : [COMIC.pages[curPage]];
list.forEach((url, i) => {
const idx = mode === 'scroll' ? i : curPage;
const card = document.createElement('div');
card.className = 'page-card';
card.innerHTML = `<img src="${url}" loading="lazy" alt="Page ${idx+1}"><div class="page-footer">第 ${idx+1} / ${COMIC.pages.length} 页 · ${COMIC.zh_title}</div>`;
if (mode === 'flip') card.onclick = () => stepPage(1);
box.appendChild(card);
});
document.getElementById('pageIndicator').textContent = `${curPage + 1} / ${COMIC.pages.length}`;
}
function setMode(m) {
mode = m;
document.getElementById('btnScroll').classList.toggle('active', m === 'scroll');
document.getElementById('btnFlip').classList.toggle('active', m === 'flip');
renderPages();
}
function stepPage(delta) {
curPage = (curPage + delta + COMIC.pages.length) % COMIC.pages.length;
renderPages();
}
function toggleCatalog() {
document.getElementById('catDrawer').classList.toggle('open');
}
function cycleLang() {
lang = lang === 'zh' ? 'hant' : (lang === 'hant' ? 'en' : 'zh');
renderMeta();
}
renderMeta();
renderCatalog();
renderPages();
</script>
</body>
</html>