jianzhihuixiang/alacarte-novel-website/chapters/chapter-18.html
小虾米 f8894dd3f3 fix: 修复上一章/下一章导航对小数章节(如107.5)的支持
- updateNavButtons: 改用数组索引查找,而非简单的+1/-1
- updateSidebarHighlight: 使用parseFloat比较章节ID
- updateMobileTOCHighlight: 使用parseFloat比较章节ID
- 更新版本号强制刷新缓存
2026-03-27 17:42:41 +08:00

613 lines
28 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>番外·悬空城 - 阿拉德:剑之回响</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-primary: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
--text-primary: #e0e0e0;
--text-secondary: #888;
--accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--border-color: rgba(255,255,255,0.1);
--btn-bg: rgba(255,255,255,0.1);
--btn-hover: rgba(255,255,255,0.2);
}
[data-theme="light"] {
--bg-primary: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
--text-primary: #333;
--text-secondary: #666;
--border-color: rgba(0,0,0,0.1);
--btn-bg: rgba(0,0,0,0.05);
--btn-hover: rgba(0,0,0,0.1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Noto Serif SC', serif;
background: var(--bg-primary);
color: var(--text-primary);
line-height: 1.8;
min-height: 100vh;
transition: all 0.3s ease;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
padding-bottom: 120px;
}
/* 顶部导航 */
.top-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.3);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--border-color);
z-index: 1000;
padding: 10px 20px;
}
.top-nav-content {
max-width: 800px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-link {
color: var(--text-primary);
text-decoration: none;
font-family: 'Noto Sans SC', sans-serif;
font-size: 14px;
padding: 8px 16px;
background: var(--btn-bg);
border: 1px solid var(--border-color);
border-radius: 8px;
transition: all 0.3s ease;
}
.nav-link:hover {
background: var(--btn-hover);
}
.chapter-header {
text-align: center;
padding: 80px 0 40px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 40px;
}
.chapter-number {
font-size: 14px;
color: var(--text-secondary);
letter-spacing: 4px;
text-transform: uppercase;
margin-bottom: 10px;
}
.chapter-title {
font-size: 32px;
font-weight: 700;
background: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 20px;
}
.chapter-meta {
font-size: 14px;
color: var(--text-secondary);
}
.chapter-content {
font-size: 18px;
line-height: 2;
text-align: justify;
}
.chapter-content p {
margin-bottom: 1.5em;
text-indent: 2em;
}
.chapter-content p:first-of-type::first-letter {
font-size: 3em;
float: left;
line-height: 1;
margin-right: 8px;
margin-top: -5px;
background: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
font-weight: 700;
}
/* 固定底部导航 */
.fixed-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: rgba(0,0,0,0.3);
backdrop-filter: blur(10px);
border-top: 1px solid var(--border-color);
z-index: 1000;
padding: 15px 20px;
}
.fixed-nav-content {
max-width: 800px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-btn {
padding: 12px 24px;
background: var(--btn-bg);
border: 1px solid var(--border-color);
border-radius: 8px;
color: var(--text-primary);
text-decoration: none;
transition: all 0.3s ease;
font-family: 'Noto Sans SC', sans-serif;
font-size: 14px;
cursor: pointer;
}
.nav-btn:hover {
background: var(--btn-hover);
transform: translateY(-2px);
}
.nav-btn.disabled {
opacity: 0.3;
cursor: not-allowed;
pointer-events: none;
}
/* 右侧滚动按钮 */
.scroll-buttons {
position: fixed;
right: 20px;
bottom: 90px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 1001;
}
.scroll-btn {
width: 40px;
height: 40px;
border-radius: 8px;
background: var(--btn-bg);
border: 1px solid var(--border-color);
color: var(--text-primary);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
transition: all 0.3s ease;
font-family: 'Noto Sans SC', sans-serif;
}
.scroll-btn:hover {
background: var(--btn-hover);
}
/* 侧边栏 - 标题固定,内容滚动 */
.sidebar {
position: fixed;
right: 20px;
top: 50%;
transform: translateY(-50%);
background: rgba(0,0,0,0.5);
backdrop-filter: blur(10px);
border-radius: 12px;
border: 1px solid var(--border-color);
width: 200px;
max-height: 70vh;
z-index: 999;
display: flex;
flex-direction: column;
}
.sidebar-title {
font-size: 14px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 2px;
padding: 15px 20px;
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.sidebar-content {
overflow-y: auto;
padding: 10px 20px 20px;
flex: 1;
scrollbar-width: thin;
scrollbar-color: transparent transparent;
transition: scrollbar-color 0.3s ease;
}
.sidebar-content:hover {
scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.sidebar-content::-webkit-scrollbar {
width: 6px;
}
.sidebar-content::-webkit-scrollbar-track {
background: transparent;
}
.sidebar-content::-webkit-scrollbar-thumb {
background: transparent;
border-radius: 3px;
transition: background 0.3s ease;
}
.sidebar-content:hover::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.3);
}
.sidebar-content:hover::-webkit-scrollbar-thumb:hover {
background: rgba(255,255,255,0.5);
}
[data-theme="light"] .sidebar-content:hover {
scrollbar-color: rgba(0,0,0,0.3) transparent;
}
[data-theme="light"] .sidebar-content:hover::-webkit-scrollbar-thumb {
background: rgba(0,0,0,0.3);
}
[data-theme="light"] .sidebar-content:hover::-webkit-scrollbar-thumb:hover {
background: rgba(0,0,0,0.5);
}
.sidebar-chapter {
display: block;
padding: 8px 0;
color: #aaa;
text-decoration: none;
font-size: 13px;
border-bottom: 1px solid rgba(255,255,255,0.05);
transition: all 0.3s ease;
line-height: 1.5;
}
.sidebar-chapter:hover {
color: #667eea;
}
.sidebar-chapter.current {
color: #667eea;
font-weight: 600;
}
@media (max-width: 1200px) {
.sidebar {
display: none;
}
}
@media (max-width: 600px) {
.chapter-title {
font-size: 24px;
}
.chapter-content {
font-size: 16px;
}
.fixed-nav-content {
gap: 10px;
}
.nav-btn {
padding: 10px 15px;
font-size: 12px;
}
.scroll-buttons {
right: 10px;
bottom: 80px;
}
.scroll-btn {
width: 36px;
height: 36px;
}
}
/* 滚动条样式 */
.sidebar::-webkit-scrollbar {
width: 4px;
}
.sidebar::-webkit-scrollbar-track {
background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 2px;
}
</style>
</head>
<body>
<!-- 顶部导航 -->
<nav class="top-nav">
<div class="top-nav-content">
<a href="../index.html" class="nav-link">返回首页</a>
<button class="nav-link" id="themeToggle">切换主题</button>
</div>
</nav>
<div class="container">
<header class="chapter-header">
<div class="chapter-number">Chapter 18</div>
<h1 class="chapter-title">番外·悬空城</h1>
</header>
<article class="chapter-content">
<p>天空之城重新开放的消息,很快传遍了整个阿拉德大陆。</p>
<p>冒险家们从各地涌来,想要探索这座传说中的浮空城市。而林克和赛丽亚,作为"晨曦的继承者",自然成为了众人关注的焦点。</p>
<p>但林克的心情并不轻松。</p>
<p>晨曦失去了光芒,变成了一把普通的铁剑。虽然他依然可以使用其他武器,但总感觉少了些什么。</p>
<p>"还在想晨曦的事?"赛丽亚走到他身边。</p>
<p>林克点点头:"赛格哈特说它会重新发光,但……我不知道要等多久。"</p>
<p>"会好起来的。"赛丽亚安慰道,"对了,凯丽让我转告你,她有些东西要给你看。"</p>
<p>"凯丽?"</p>
<p>"赫顿玛尔的强化师。"赛丽亚解释道,"她说和晨曦有关。"</p>
<p>---</p>
<p>赫顿玛尔,凯丽的工坊。</p>
<p>这位天界来的强化师,正站在工作台前,手中拿着一块发光的碎片。</p>
<p>"来得正好。"凯丽看到林克,露出一个意味深长的笑容,"我有个消息要告诉你。"</p>
<p>"关于晨曦?"</p>
<p>"不完全是。"凯丽将碎片放在桌上,"这是从天空之城深处找到的。你猜猜看,它来自哪里?"</p>
<p>林克仔细观察那块碎片。它散发着微弱的光芒,质地和晨曦有些相似,但又有些不同。</p>
<p>"光之核心的碎片?"</p>
<p>"聪明。"凯丽点点头,"但这块碎片来自一个更古老的地方——悬空城。"</p>
<p>"悬空城?"</p>
<p>"天空之城的最深处,连赛格哈特都没有完全探索过的区域。"凯丽调出一张古老的地图,"传说那里是天空之城最初建造时的核心区域,藏着比光之核心更古老的秘密。"</p>
<p>林克的心跳加速了:"你是说……那里可能有恢复晨曦的方法?"</p>
<p>"不确定。"凯丽坦诚地说,"但那里肯定有与光之核心同源的力量。如果你的晨曦能够吸收那种力量……"</p>
<p>她没有说完,但林克明白了。</p>
<p>"怎么去悬空城?"</p>
<p>凯丽指着地图上的一个标记:"从城主宫殿的地下通道可以到达。但要注意的是……"</p>
<p>她的表情变得严肃:"那里的怪物比城主宫殿还要强大。而且,据说有某种'古老的存在'在守护着最核心的秘密。"</p>
<p>---</p>
<p>通过城主宫殿的地下通道,林克和赛丽亚来到了悬空城。</p>
<p>与上方的宫殿不同,这里给人一种更加古老、更加神秘的感觉。建筑风格与天空之城其他区域完全不同,墙壁上刻满了他们看不懂的符文。</p>
<p>"这些符文……"赛丽亚伸手触摸墙壁,"比光之核心的年代还要久远。"</p>
<p>林克举起已经失去光芒的晨曦。奇怪的是,在这里,剑身似乎有了一丝反应——虽然很微弱,但确实存在。</p>
<p>"有效果。"林克的眼中闪过一丝希望,"这里的力量确实与晨曦同源。"</p>
<p>他们继续前进。</p>
<p>悬空城的怪物与之前遇到的完全不同。这里游荡着一种半透明的生物,凯丽称它们为"元素精灵"——是光之核心形成之前就存在的古老生命。</p>
<p>"它们没有实体,普通攻击无效!"赛丽亚提醒道。</p>
<p>林克尝试用太刀霜刃攻击,但刀刃直接穿过了元素精灵的身体,没有造成任何伤害。</p>
<p>"要用属性攻击!"他想起了诺顿的教导。</p>
<p>但晨曦已经失去了光芒,他无法使用光属性攻击。</p>
<p>"试试这个!"赛丽亚抛给他一个小瓶。</p>
<p>那是凯丽给的光属性药剂,可以暂时让武器附带光属性。</p>
<p>林克将药剂涂抹在短剑影牙上。黑色的剑身立刻被一层淡淡的光芒包裹。</p>
<p>"影牙·光袭!"</p>
<p>这一次,攻击奏效了。光属性的斩击让元素精灵发出刺耳的尖叫,身体开始崩解。</p>
<p>---</p>
<p>随着深入悬空城,林克发现这里的结构越来越奇怪。</p>
<p>回廊似乎是环绕着一个中心点建造的,而那个中心点散发着越来越强烈的光芒。</p>
<p>"前面有东西。"赛丽亚指着远处。</p>
<p>那是一个巨大的圆形大厅,大厅的中央悬浮着一颗小型的光球。那颗光球比光之核心小得多,但散发出的能量却更加古老、更加纯粹。</p>
<p>"那是……"林克瞪大了眼睛。</p>
<p>"光之核心的原型。"一个声音从身后传来。</p>
<p>林克和赛丽亚猛地转身,看到一个身穿白袍的老者正站在入口处。</p>
<p>老者的面容模糊不清,仿佛被光芒笼罩。他的身影有些透明,不像是实体。</p>
<p>"你是……"</p>
<p>"我是这座城市的建造者之一。"老者的声音温和而古老,"或者说,是我的意志残留。"</p>
<p>他看向林克手中的晨曦:"那把剑……我认得出它的气息。它是从核心中分离出的碎片,承载着我们的希望。"</p>
<p>"您知道如何恢复它的光芒吗?"林克急切地问道。</p>
<p>老者点点头:"知道。但首先,你必须证明自己配得上那份力量。"</p>
<p>他挥了挥手,大厅中的光球开始剧烈颤动。</p>
<p>"那颗原型核心会释放它的守护者。只有战胜守护者,你才能获得恢复晨曦的力量。"</p>
<p>"小心,年轻人。"老者的身影开始消散,"守护者……是我那个时代最强的战士。"</p>
<p>---</p>
<p>光球爆裂,一个巨大的身影从光芒中走出。</p>
<p>那是一个身穿古老铠甲的战士,他的身躯半透明,显然也是意志残留的形态。但即使如此,他身上散发出的威压依然让人窒息。</p>
<p>"挑战者……"守护者的声音如同雷鸣,"想要获得原型的力量,就先战胜我!"</p>
<p>战斗开始。</p>
<p>守护者的速度极快,而且能够随意操控周围的光元素。他的攻击带着纯粹的光属性,即使只是擦到也会让林克感到剧痛。</p>
<p>"光属性的敌人……"林克咬牙,"用影牙的光属性药剂!"</p>
<p>他再次涂抹药剂,与守护者展开激战。</p>
<p>里·鬼剑术的二连斩、破军升龙击的上挑、太刀霜刃的灵活迂回——林克用尽了所有技巧,但在守护者面前,依然处于下风。</p>
<p>"太弱了!"守护者一拳击退林克,"凭这种程度,配不上原型的力量!"</p>
<p>林克半跪在地上,大口喘着气。</p>
<p>药剂的效果正在消退,影牙上的光芒越来越暗淡。</p>
<p>"难道……真的没有办法吗?"</p>
<p>他看向手中的晨曦。那把失去光芒的剑,此刻显得如此平凡。</p>
<p>但就在这时,他感觉到了什么。</p>
<p>晨曦……在颤动。</p>
<p>不是因为外部的力量,而是来自内部——来自林克自己。</p>
<p>"对了……"林克想起了赛格哈特的话,"晨曦承载着希望与守护的意志。那种力量……不是来自核心,而是来自持剑者的心!"</p>
<p>他重新站起身,握紧晨曦。</p>
<p>即使没有光芒,即使变成普通的铁剑,它依然是他最重要的伙伴。</p>
<p>"再来!"</p>
<p>这一次,林克没有依赖任何药剂或外部力量。他只是单纯地挥舞着晨曦,将自己全部的信念注入其中。</p>
<p>"里·鬼剑术·心斩!"</p>
<p>奇迹发生了。</p>
<p>晨曦的剑身上,重新亮起了微弱的光芒。</p>
<p>那光芒虽然不强,但无比纯净——那是林克自己的意志,是他对伙伴的信任,对守护的坚持。</p>
<p>守护者的动作停住了。</p>
<p>"这是……"他的声音中带着震惊,"持剑者自身的光芒?"</p>
<p>林克没有给他反应的时间。他带着晨曦,冲向守护者。</p>
<p>这一次,他的每一剑都带着真正的光属性——不是来自核心,而是来自他自己。</p>
<p>"原来如此……"守护者笑了,"我明白了。你……确实配得上那份力量。"</p>
<p>他收起防御,任由晨曦刺入自己的胸口。</p>
<p>"去吧,年轻人。"守护者的身体开始化作光点,"原型核心的力量……是你的了。"</p>
<p>---</p>
<p>战斗结束后,原型核心缓缓飘向林克。</p>
<p>它散发出的古老力量,开始流入晨曦的剑身。失去的光芒一点一点恢复,虽然还不如以前那么强烈,但已经能够正常使用。</p>
<p>更重要的是,林克感觉到自己和晨曦之间的联系更加紧密了。</p>
<p>那种联系不再依赖于光之核心,而是来自于他们共同经历的战斗,来自于彼此的信任。</p>
<p>"晨曦……"林克轻声说,"欢迎回来。"</p>
<p>剑身上的光芒微微闪烁,仿佛在回应他。</p>
<p>建造者的意志再次出现,他的表情中带着欣慰。</p>
<p>"你通过了试炼。"他说,"从现在开始,你不再只是光之核心的继承者,而是真正的'光之骑士'。"</p>
<p>"晨曦的力量会随着时间的流逝完全恢复。而在那之前……"</p>
<p>他看向远方:"更大的挑战正在等着你。天帷巨兽的苏醒,将使徒的气息带到了阿拉德大陆。"</p>
<p>"使徒?"赛丽亚皱眉。</p>
<p>"古老的邪恶存在。"建造者的声音变得沉重,"光之核心的创造,原本就是为了对抗它们。"</p>
<p>他的身影开始消散:"去吧,年轻的骑士。属于你的传奇……才刚刚开始。"</p>
<p>---</p>
<p>离开悬空城时,晨曦已经恢复了大约三成的光芒。</p>
<p>虽然还达不到以前的强度,但林克已经非常满意。更重要的是,他找到了让晨曦完全恢复的方法——不是依赖外部的力量,而是通过与伙伴共同成长。</p>
<p>"接下来去哪?"赛丽亚问。</p>
<p>林克看向东方。那里,天帷巨兽的巨大身影正在云层中若隐若现。</p>
<p>"天帷巨兽。"他说,"建造者提到了使徒。如果那种存在真的苏醒了……我们必须去阻止它。"</p>
<p>赛丽亚微笑着握住他的手:"不管去哪里,我都陪着你。"</p>
<p>两人相视而笑,然后向着新的冒险出发。</p>
<p>悬空城的秘密已经揭开,但更大的挑战——使徒的威胁,正在前方等待着他们。</p>
<p>天空之城篇,至此真正完结。</p>
<p>---</p>
<p>(第十八章:番外·悬空城 完)</p>
<p>(天空之城篇 正式完结)</p>
</article>
</div>
<!-- 固定底部导航 -->
<nav class="fixed-nav">
<div class="fixed-nav-content">
<a href="chapter-17.html" class="nav-btn ">上一章</a>
<a href="../chapters.html" class="nav-btn">目录</a>
<a href="chapter-19.html" class="nav-btn ">下一章</a>
</div>
</nav>
<!-- 右侧滚动按钮 -->
<div class="scroll-buttons">
<button class="scroll-btn" id="scrollTop" title="回到顶部"></button>
<button class="scroll-btn" id="scrollBottom" title="回到底部"></button>
</div>
<!-- 侧边栏章节导航 -->
<aside class="sidebar">
<div class="sidebar-title">章节导航</div>
<div class="sidebar-content" id="sidebarContent">
<a href="chapter-1.html" class="sidebar-chapter">第1章洛兰的风</a>
<a href="chapter-2.html" class="sidebar-chapter">第2章洛兰深处</a>
<a href="chapter-3.html" class="sidebar-chapter">第3章幽暗密林</a>
<a href="chapter-4.html" class="sidebar-chapter">第4章幽暗密林深处</a>
<a href="chapter-5.html" class="sidebar-chapter">第5章雷鸣废墟</a>
<a href="chapter-6.html" class="sidebar-chapter">第6章格拉卡</a>
<a href="chapter-7.html" class="sidebar-chapter">第7章烈焰格拉卡</a>
<a href="chapter-8.html" class="sidebar-chapter">第8章冰霜幽暗密林</a>
<a href="chapter-9.html" class="sidebar-chapter">第9章转职之路</a>
<a href="chapter-10.html" class="sidebar-chapter">第10章暗黑雷鸣废墟</a>
<a href="chapter-11.html" class="sidebar-chapter">第11章剑魂转职仪式</a>
<a href="chapter-12.html" class="sidebar-chapter">第12章西海岸</a>
<a href="chapter-13.html" class="sidebar-chapter">第13章龙人之塔</a>
<a href="chapter-14.html" class="sidebar-chapter">第14章人偶玄关</a>
<a href="chapter-15.html" class="sidebar-chapter">第15章石巨人塔</a>
<a href="chapter-16.html" class="sidebar-chapter">第16章黑暗玄廊</a>
<a href="chapter-17.html" class="sidebar-chapter">第17章城主宫殿</a>
<a href="chapter-18.html" class="sidebar-chapter current">第18章番外·悬空城</a>
<a href="chapter-19.html" class="sidebar-chapter">第19章天帷巨兽·神殿外围</a>
<a href="chapter-20.html" class="sidebar-chapter">第20章树精丛林</a>
<a href="chapter-21.html" class="sidebar-chapter">第21章炼狱</a>
<a href="chapter-22.html" class="sidebar-chapter">第22章西海岸的闲暇</a>
<a href="chapter-23.html" class="sidebar-chapter">第23章极昼</a>
<a href="chapter-24.html" class="sidebar-chapter">第24章第一脊椎</a>
<a href="chapter-25.html" class="sidebar-chapter">第25章赫顿玛尔的准备</a>
<a href="chapter-26.html" class="sidebar-chapter">第26章第二脊椎</a>
<a href="chapter-27.html" class="sidebar-chapter">第27章重逢的温柔</a>
<a href="chapter-28.html" class="sidebar-chapter">第28章暗精灵的委托</a>
<a href="chapter-29.html" class="sidebar-chapter">第29章阿法利亚营地</a>
<a href="chapter-30.html" class="sidebar-chapter">第30章浅栖之地</a>
<a href="chapter-31.html" class="sidebar-chapter">第31章蜘蛛洞穴</a>
<a href="chapter-32.html" class="sidebar-chapter">第32章克伦特的委托</a>
<a href="chapter-33.html" class="sidebar-chapter">第33章暗精灵墓地·左翼守卫</a>
<a href="chapter-34.html" class="sidebar-chapter">第34章暗精灵墓地·剩余三将军</a>
</div>
</aside>
<script>
// 记录阅读进度
let readChapters = JSON.parse(localStorage.getItem('readChapters') || '[]');
if (!readChapters.includes(18)) {
readChapters.push(18);
localStorage.setItem('readChapters', JSON.stringify(readChapters));
}
// 主题切换
const themeToggle = document.getElementById('themeToggle');
const savedTheme = localStorage.getItem('theme') || 'dark';
document.documentElement.setAttribute('data-theme', savedTheme);
themeToggle.textContent = savedTheme === 'dark' ? '浅色' : '深色';
themeToggle.addEventListener('click', () => {
const currentTheme = document.documentElement.getAttribute('data-theme');
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
themeToggle.textContent = newTheme === 'dark' ? '浅色' : '深色';
});
// 滚动到顶部
document.getElementById('scrollTop').addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
// 滚动到底部
document.getElementById('scrollBottom').addEventListener('click', () => {
window.scrollTo({ top: document.body.scrollHeight, behavior: 'smooth' });
});
// 页面加载时,侧边栏自动滚动到当前章节
window.addEventListener('load', () => {
const sidebarContent = document.getElementById('sidebarContent');
const currentChapter = sidebarContent.querySelector('.current');
if (currentChapter) {
currentChapter.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
});
</script>
</body>
</html>