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>Happy Sugar Life ~幸福甜蜜生活~ - 在线漫画阅读器</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-1132", "mangaid": "1132", "zh_title": "Happy Sugar Life ~幸福甜蜜生活~", "hant_title": "Happy Sugar Life ~幸福甜蜜生活~", "en_title": "Happy Sugar Life ~幸福甜蜜生活~ (Bilimanga #1132)", "author": "键空富烧", "tags": ["病娇", "恶役", "斗智", "惊悚", "悬疑", "猎奇", "黑暗", "奇异幻想"], "zh_desc": "即使欺骗,甚至违犯;\n\r\n哪怕掠夺,乃至杀害…\n\r\n我认为都没问题。\n\r\n\n\r\n这一定就是「爱」吧!\n\r\n--少女如此认为。\n\r\n只要是为了守护这份思念,\n\r\n一切作为都能获得原谅。\n\n📚 作品信息:作者 键空富烧 · 评分 10 · 共收录 11 卷 / 67 话章节目录与高清彩页/条漫预览。", "hant_desc": "即使欺騙,甚至違犯;\n\r\n哪怕掠奪,乃至殺害…\n\r\n我認為都沒問題。\n\r\n\n\r\n這一定就是「愛」吧!\n\r\n--少女如此認為。\n\r\n只要是為了守護這份思念,\n\r\n一切作為都能獲得原諒。\n\n📚 作品資訊:作者 鍵空富燒 · 評分 10 · 共收錄 11 卷 / 67 話章節目錄與高清彩頁/條漫預覽。", "en_desc": "Popular serialized manga 'Happy Sugar Life ~幸福甜蜜生活~' (Happy Sugar Life ~幸福甜蜜生活~) by 键空富烧. Includes 11 volumes and 67 chapters with full online vertical/page-flip web reader.", "pages": ["https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_01.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_02.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_03.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_04.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_05.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-1132/page_06.jpg"], "volumes": [{"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 1", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 1", "cover_id": 2030228, "first_chap_id": 94785, "cover_url": "https://i.motiezw.com/cover/1132/2030228.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 2", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 2", "cover_id": 2030426, "first_chap_id": 94791, "cover_url": "https://i.motiezw.com/cover/1132/2030426.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 3", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 3", "cover_id": 2030625, "first_chap_id": 94796, "cover_url": "https://i.motiezw.com/cover/1132/2030625.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 4", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 4", "cover_id": 2030798, "first_chap_id": 94802, "cover_url": "https://i.motiezw.com/cover/1132/2030798.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 5", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 5", "cover_id": 2031005, "first_chap_id": 94810, "cover_url": "https://i.motiezw.com/cover/1132/2031005.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 6", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 6", "cover_id": 2031200, "first_chap_id": 94817, "cover_url": "https://i.motiezw.com/cover/1132/2031200.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 7", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 7", "cover_id": 2031379, "first_chap_id": 94825, "cover_url": "https://i.motiezw.com/cover/1132/2031379.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 8", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 8", "cover_id": 2031559, "first_chap_id": 94834, "cover_url": "https://i.motiezw.com/cover/1132/2031559.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 9", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 9", "cover_id": 2031744, "first_chap_id": 94841, "cover_url": "https://i.motiezw.com/cover/1132/2031744.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 10", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 10", "cover_id": 2031927, "first_chap_id": 94849, "cover_url": "https://i.motiezw.com/cover/1132/2031927.jpg"}, {"title_hant": "Happy Sugar Life ~幸福甜蜜生活~ 11 Extra Life", "title_zh": "Happy Sugar Life ~幸福甜蜜生活~ 11 Extra Life", "cover_id": 2032127, "first_chap_id": 94856, "cover_url": "https://i.motiezw.com/cover/1132/2032127.jpg"}], "chapters": [{"cid": "94785", "title": "1st Life 砂糖少NPC愛", "title_zh": "1st Life 砂糖少NPC爱"}, {"cid": "94786", "title": "2nd Life 十分甜蜜的事物,十分苦澀的事物。", "title_zh": "2nd Life 十分甜蜜的事物,十分苦涩的事物。"}, {"cid": "94787", "title": "3rd Life 鹽的箱庭", "title_zh": "3rd Life 盐的箱庭"}, {"cid": "94788", "title": "4th Life 黑白S的漫漫長夜Ⅰ", "title_zh": "4th Life 黑白S的漫漫长夜Ⅰ"}, {"cid": "94789", "title": "附錄", "title_zh": "附录"}, {"cid": "94791", "title": "5th Life 黑白S的漫漫長夜Ⅱ", "title_zh": "5th Life 黑白S的漫漫长夜Ⅱ"}, {"cid": "94792", "title": "6th Life 黑白S的漫漫長夜Ⅲ", "title_zh": "6th Life 黑白S的漫漫长夜Ⅲ"}, {"cid": "94793", "title": "7th Life 黑白S的漫漫長夜Ⅳ", "title_zh": "7th Life 黑白S的漫漫长夜Ⅳ"}, {"cid": "94794", "title": "Protolife White Sugar Garden, Black Salt Cage.", "title_zh": "Protolife White Sugar Garden, Black Salt Cage."}, {"cid": "94796", "title": "8th Life 砂糖少N沒有察覺", "title_zh": "8th Life 砂糖少N没有察觉"}, {"cid": "94797", "title": "9th Life 砂糖少N的原料", "title_zh": "9th Life 砂糖少N的原料"}, {"cid": "94798", "title": "10th Life 罪之味", "title_zh": "10th Life 罪之味"}, {"cid": "94799", "title": "11th Life 罰之味", "title_zh": "11th Life 罚之味"}, {"cid": "94800", "title": "附錄", "title_zh": "附录"}, {"cid": "94802", "title": "12th Life 已然改變的少N的故事", "title_zh": "12th Life 已然改变的少N的故事"}, {"cid": "94803", "title": "13th Life 終將改變的少N的故事", "title_zh": "13th Life 终将改变的少N的故事"}, {"cid": "94804", "title": "14th Life 我們,都繞著月亮不停回轉著", "title_zh": "14th Life 我们,都绕著月亮不停回转著"}, {"cid": "94805", "title": "15th Life 要是越過了那條線", "title_zh": "15th Life 要是越过了那条线"}, {"cid": "94806", "title": "16th Life 箱庭之中", "title_zh": "16th Life 箱庭之中"}, {"cid": "94807", "title": "17th Life 願妳也能得到「愛」的加護", "title_zh": "17th Life 愿妳也能得到「爱」的加护"}, {"cid": "94810", "title": "18th Life 某位少年的決心", "title_zh": "18th Life 某位少年的决心"}, {"cid": "94811", "title": "19th Life 1208號房", "title_zh": "19th Life 1208号房"}, {"cid": "94812", "title": "20th Life 故事的開端", "title_zh": "20th Life 故事的开端"}, {"cid": "94813", "title": "21st Life 搖晃的絲線", "title_zh": "21st Life 摇晃的丝线"}, {"cid": "94814", "title": "22nd Life Future", "title_zh": "22nd Life Future"}, {"cid": "94815", "title": "23rd Life 融化的雨", "title_zh": "23rd Life 融化的雨"}, {"cid": "94817", "title": "24th Life 光的所在之處", "title_zh": "24th Life 光的所在之处"}, {"cid": "94818", "title": "25th Life 不完全的少N們", "title_zh": "25th Life 不完全的少N们"}, {"cid": "94819", "title": "26th Life 兩人的城堡", "title_zh": "26th Life 两人的城堡"}, {"cid": "94820", "title": "27th Life 星空的求婚", "title_zh": "27th Life 星空的求婚"}, {"cid": "94821", "title": "-InterludeA- sweet salt", "title_zh": "-InterludeA- sweet salt"}, {"cid": "94822", "title": "-InterludeB- bitter sugar", "title_zh": "-InterludeB- bitter sugar"}, {"cid": "94823", "title": "附錄", "title_zh": "附录"}, {"cid": "94825", "title": "28th Life 隨處可見的我的人生Ⅰ", "title_zh": "28th Life 随处可见的我的人生Ⅰ"}, {"cid": "94826", "title": "29th Life 隨處可見的我的人生Ⅱ", "title_zh": "29th Life 随处可见的我的人生Ⅱ"}, {"cid": "94827", "title": "Parallel Life 甜蜜、扭曲、痛楚", "title_zh": "Parallel Life 甜蜜、扭曲、痛楚"}, {"cid": "94828", "title": "30th Life 隨處可見的我的人生Ⅲ", "title_zh": "30th Life 随处可见的我的人生Ⅲ"}, {"cid": "94829", "title": "Parallel Life 於是,在冰雨之中", "title_zh": "Parallel Life 于是,在冰雨之中"}, {"cid": "94830", "title": "31st Life 於瓶中融合為一的愛", "title_zh": "31st Life 于瓶中融合为一的爱"}, {"cid": "94831", "title": "附錄", "title_zh": "附录"}, {"cid": "94834", "title": "33rd Life 噪聲", "title_zh": "33rd Life 噪声"}, {"cid": "94835", "title": "34th Life 黎明與少年", "title_zh": "34th Life 黎明与少年"}, {"cid": "94836", "title": "35th Life 潘朵拉之盒", "title_zh": "35th Life 潘朵拉之盒"}, {"cid": "94837", "title": "36th Life 緊繫相連的愛", "title_zh": "36th Life 紧系相连的爱"}, {"cid": "94838", "title": "37th Life 永遠的瞬間,與妳GD。", "title_zh": "37th Life 永远的瞬间,与妳GD。"}, {"cid": "94839", "title": "附錄", "title_zh": "附录"}, {"cid": "94841", "title": "38th Life 他的願望", "title_zh": "38th Life 他的愿望"}, {"cid": "94842", "title": "39th Life 友誼", "title_zh": "39th Life 友谊"}, {"cid": "94843", "title": "40th Life 無法成為母親的媽媽", "title_zh": "40th Life 无法成为母亲的妈妈"}, {"cid": "94844", "title": "41st Life 緊連不斷的線", "title_zh": "41st Life 紧连不断的线"}, {"cid": "94845", "title": "42nd Life 戒指與約定", "title_zh": "42nd Life 戒指与约定"}, {"cid": "94846", "title": "43rd Life 不再純潔的天使", "title_zh": "43rd Life 不再纯洁的天使"}, {"cid": "94847", "title": "附錄", "title_zh": "附录"}, {"cid": "94849", "title": "44th Life 殘暴", "title_zh": "44th Life 残暴"}, {"cid": "94850", "title": "45th Life 神戶鹽的原始材料", "title_zh": "45th Life 神户盐的原始材料"}, {"cid": "94851", "title": "46th Life I", "title_zh": "46th Life I"}, {"cid": "94852", "title": "47th Life 幸福的體溫", "title_zh": "47th Life 幸福的体温"}, {"cid": "94853", "title": "Last Life Happy Sugar Life", "title_zh": "Last Life Happy Sugar Life"}, {"cid": "94854", "title": "附錄", "title_zh": "附录"}, {"cid": "94856", "title": "Extra Life 1 砂糖的阿姨", "title_zh": "Extra Life 1 砂糖的阿姨"}]};
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>