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-212", "mangaid": "212", "zh_title": "新妹魔王的契约者", "hant_title": "新妹魔王的契約者", "en_title": "新妹魔王的契约者 (Bilimanga #212)", "author": "みやこかしわ / 上栖缀人 / 大熊猫介", "tags": ["校园", "奇幻", "战斗", "后宫", "妹妹", "青梅竹马", "奇幻冒险", "日本漫画"], "zh_desc": "高中生东城刃更突然多了两个继妹——澪和万理亚,但她们的真实身分竟是新任魔王以及梦魔跟班!\n\r\n刃更为了保护遭受魔族威胁的妹妹们,情愿与她们缔结主从契约,想不到立场意外反转,刃更反而成了她们的主人……!\n\n📚 作品信息:作者 みやこかしわ / 上栖缀人 / 大熊猫介 · 评分 10 · 共收录 9 卷 / 45 话章节目录与高清彩页/条漫预览。", "hant_desc": "高中生東城刃更突然多了兩個繼妹——澪和萬理亞,但她們的真實身分竟是新任魔王以及夢魔跟班!\n\r\n刃更為了保護遭受魔族威脅的妹妹們,情願與她們締結主從契約,想不到立場意外反轉,刃更反而成了她們的主人……!\n\n📚 作品資訊:作者 みやこかしわ / 上栖綴人 / 大熊猫介 · 評分 10 · 共收錄 9 卷 / 45 話章節目錄與高清彩頁/條漫預覽。", "en_desc": "Popular serialized manga '新妹魔王的契约者' (新妹魔王的契約者) by みやこかしわ / 上栖缀人 / 大熊猫介. Includes 9 volumes and 45 chapters with full online vertical/page-flip web reader.", "pages": ["https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_01.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_02.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_03.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_04.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_05.jpg", "https://media.huangguodrama.ai/motion/comics/bilimanga-212/page_06.jpg"], "volumes": [{"title_hant": "新妹魔王的契約者 1", "title_zh": "新妹魔王的契约者 1", "cover_id": 389186, "first_chap_id": 18587, "cover_url": "https://i.motiezw.com/cover/212/389186.jpg"}, {"title_hant": "新妹魔王的契約者 2", "title_zh": "新妹魔王的契约者 2", "cover_id": 389378, "first_chap_id": 18593, "cover_url": "https://i.motiezw.com/cover/212/389378.jpg"}, {"title_hant": "新妹魔王的契約者 3", "title_zh": "新妹魔王的契约者 3", "cover_id": 389565, "first_chap_id": 18599, "cover_url": "https://i.motiezw.com/cover/212/389565.jpg"}, {"title_hant": "新妹魔王的契約者 4", "title_zh": "新妹魔王的契约者 4", "cover_id": 389738, "first_chap_id": 18604, "cover_url": "https://i.motiezw.com/cover/212/389738.jpg"}, {"title_hant": "新妹魔王的契約者 5", "title_zh": "新妹魔王的契约者 5", "cover_id": 389894, "first_chap_id": 18611, "cover_url": "https://i.motiezw.com/cover/212/389894.jpg"}, {"title_hant": "新妹魔王的契約者 6", "title_zh": "新妹魔王的契约者 6", "cover_id": 390064, "first_chap_id": 18615, "cover_url": "https://i.motiezw.com/cover/212/390064.jpg"}, {"title_hant": "新妹魔王的契約者 7", "title_zh": "新妹魔王的契约者 7", "cover_id": 390224, "first_chap_id": 18621, "cover_url": "https://i.motiezw.com/cover/212/390224.jpg"}, {"title_hant": "新妹魔王的契約者 8", "title_zh": "新妹魔王的契约者 8", "cover_id": 390402, "first_chap_id": 18628, "cover_url": "https://i.motiezw.com/cover/212/390402.jpg"}, {"title_hant": "新妹魔王的契約者 9", "title_zh": "新妹魔王的契约者 9", "cover_id": 390576, "first_chap_id": 18636, "cover_url": "https://i.motiezw.com/cover/212/390576.jpg"}], "chapters": [{"cid": "18587", "title": "01 攻略繼妹的方法", "title_zh": "01 攻略继妹的方法"}, {"cid": "18588", "title": "02 魔王與勇者", "title_zh": "02 魔王与勇者"}, {"cid": "18589", "title": "03 第一次的主從契約", "title_zh": "03 第一次的主从契约"}, {"cid": "18590", "title": "04 重逢與信賴的夾縫間(上)", "title_zh": "04 重逢与信赖的夹缝间(上)"}, {"cid": "18591", "title": "05 重逢與價賴的夾縫間(下)", "title_zh": "05 重逢与价赖的夹缝间(下)"}, {"cid": "18593", "title": "06 敵人與夥伴", "title_zh": "06 敌人与伙伴"}, {"cid": "18594", "title": "07 直到妳的悲傷消失為止(上)", "title_zh": "07 直到妳的悲伤消失为止(上)"}, {"cid": "18595", "title": "08 直到妳的悲傷消失為止(中)", "title_zh": "08 直到妳的悲伤消失为止(中)"}, {"cid": "18596", "title": "09 直到妳的悲傷消失為止(下)", "title_zh": "09 直到妳的悲伤消失为止(下)"}, {"cid": "18597", "title": "10 想守護的事物", "title_zh": "10 想守护的事物"}, {"cid": "18599", "title": "11 妹妹一早的魔王無雙", "title_zh": "11 妹妹一早的魔王无双"}, {"cid": "18600", "title": "12 懷抱日益激昂的思緒", "title_zh": "12 怀抱日益激昂的思绪"}, {"cid": "18601", "title": "13 直逼而來的敵意", "title_zh": "13 直逼而来的敌意"}, {"cid": "18602", "title": "14 主從與信賴的前程", "title_zh": "14 主从与信赖的前程"}, {"cid": "18604", "title": "15 注視無法抹滅的過去", "title_zh": "15 注视无法抹灭的过去"}, {"cid": "18605", "title": "16 因緣交錯———", "title_zh": "16 因缘交错———"}, {"cid": "18606", "title": "17 決心之後,企望守護的事物", "title_zh": "17 决心之后,企望守护的事物"}, {"cid": "18607", "title": "18 寄於刃鋒的決心", "title_zh": "18 寄于刃锋的决心"}, {"cid": "18608", "title": "特別篇 萬理亞妹妹的一天", "title_zh": "特别篇 万理亚妹妹的一天"}, {"cid": "18611", "title": "20 了斷之時", "title_zh": "20 了断之时"}, {"cid": "18612", "title": "21 男人的信念", "title_zh": "21 男人的信念"}, {"cid": "18613", "title": "22 了斷與別離", "title_zh": "22 了断与别离"}, {"cid": "18615", "title": "23 LLS夢魔的失控", "title_zh": "23 LLS梦魔的失控"}, {"cid": "18616", "title": "24 LLS夢魔的失控 其之2", "title_zh": "24 LLS梦魔的失控 其之2"}, {"cid": "18617", "title": "25 第二次主從契約", "title_zh": "25 第二次主从契约"}, {"cid": "18618", "title": "26 功過難定的主從契約", "title_zh": "26 功过难定的主从契约"}, {"cid": "18619", "title": "22.5[番外篇]東城刃更和平到不行的日常生活", "title_zh": "22.5[番外篇]东城刃更和平到不行的日常生活"}, {"cid": "18621", "title": "27 背叛之後", "title_zh": "27 背叛之后"}, {"cid": "18622", "title": "28 背叛與連鎖", "title_zh": "28 背叛与连锁"}, {"cid": "18623", "title": "28.5[特別篇]新妹魔王的TESTAMENT!", "title_zh": "28.5[特别篇]新妹魔王的TESTAMENT!"}, {"cid": "18624", "title": "29 別離與重逢", "title_zh": "29 别离与重逢"}, {"cid": "18625", "title": "30「鑰匙」", "title_zh": "30「钥匙」"}, {"cid": "18626", "title": "30.5[番外篇]萬理亞的漫畫之道", "title_zh": "30.5[番外篇]万理亚的漫画之道"}, {"cid": "18628", "title": "31 刃更VS萬理亞", "title_zh": "31 刃更VS万理亚"}, {"cid": "18629", "title": "32 主人", "title_zh": "32 主人"}, {"cid": "18630", "title": "33 全都是為了這一刻", "title_zh": "33 全都是为了这一刻"}, {"cid": "18631", "title": "34 魔劍加姆", "title_zh": "34 魔剑加姆"}, {"cid": "18632", "title": "35 決意的盡頭……", "title_zh": "35 决意的尽头……"}, {"cid": "18633", "title": "36 虛假笑容的另一面", "title_zh": "36 虚假笑容的另一面"}, {"cid": "18636", "title": "37 魔劍", "title_zh": "37 魔剑"}, {"cid": "18637", "title": "38 了斷", "title_zh": "38 了断"}, {"cid": "18638", "title": "39 歸返", "title_zh": "39 归返"}, {"cid": "18639", "title": "39.5[番外篇]萬里亞GO", "title_zh": "39.5[番外篇]万里亚GO"}, {"cid": "18640", "title": "契約Last 家人", "title_zh": "契约Last 家人"}, {"cid": "18641", "title": "契約After 東城家After", "title_zh": "契约After 东城家After"}]};
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>