- updateNavButtons: 改用数组索引查找,而非简单的+1/-1 - updateSidebarHighlight: 使用parseFloat比较章节ID - updateMobileTOCHighlight: 使用parseFloat比较章节ID - 更新版本号强制刷新缓存
561 lines
24 KiB
HTML
561 lines
24 KiB
HTML
<!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 14</div>
|
||
<h1 class="chapter-title">人偶玄关</h1>
|
||
</header>
|
||
|
||
<article class="chapter-content">
|
||
<p>第二天,GSD带着林克和赛丽亚来到人偶玄关。</p>
|
||
<p>与龙人之塔不同,这里是一座巨大的宫殿,到处都是精致的雕像和人偶。但空气中弥漫着一股诡异的气息,让人不寒而栗。</p>
|
||
<p>"这里是……人偶玄关?"赛丽亚紧紧跟在GSD身后,"感觉好阴森……"</p>
|
||
<p>"小心点。"GSD停下脚步,"这里的怪物和龙人不同,它们……曾经是活生生的人。"</p>
|
||
<p>"什么?"林克一惊。</p>
|
||
<p>"被天空之城的魔力侵蚀,变成了人偶。"GSD的声音有些低沉,"很久以前,有一支冒险队来这里探险,结果全军覆没。他们的灵魂被囚禁在人偶里,永远无法解脱。"</p>
|
||
<p>"那我们……"</p>
|
||
<p>"帮他们解脱吧。"GSD抬起拐杖,"这是唯一能做的事。"</p>
|
||
<p>---</p>
|
||
<p>刚走进宫殿大厅,四周的雕像突然动了!</p>
|
||
<p>那些精致的人偶睁开了眼睛,空洞的眼眶中闪烁着幽绿色的光芒。它们缓缓站起身,手中出现了各种各样的武器。</p>
|
||
<p>"来了。"GSD说,"这次你们来试试,我在旁边看着。"</p>
|
||
<p>林克握紧光剑,点点头。</p>
|
||
<p>"好!"</p>
|
||
<p>---</p>
|
||
<p>人偶们的攻击方式比龙人更加诡异。</p>
|
||
<p>它们没有痛觉,不知疲倦,即使被斩断手臂也会继续攻击。而且它们配合默契,像是受过严格训练的士兵。</p>
|
||
<p>"这些家伙……"林克挥舞光剑斩断一只人偶的头颅,但更多的人偶涌了上来。</p>
|
||
<p>"数量太多了!"</p>
|
||
<p>他立刻切换武器,拔出太刀霜刃,身形变得飘忽不定。</p>
|
||
<p>"不错。"GSD在一旁点评,"但你的攻击太单一了。"</p>
|
||
<p>"什么意思?"</p>
|
||
<p>"人偶的核心不止一个。"GSD说,"看好了。"</p>
|
||
<p>他抬起手,一道波动剑气射出,直接贯穿了它们胸口的水晶!</p>
|
||
<p>"那是……核心?"</p>
|
||
<p>"每个人偶的胸口都有一块魔力水晶,那才是它们的真正要害。"GSD说,"你的剑很快,但如果不命中要害,只是浪费体力。"</p>
|
||
<p>林克恍然大悟。</p>
|
||
<p>---</p>
|
||
<p>就在这时,宫殿深处传来一阵低沉的笑声。</p>
|
||
<p>"呵呵呵……有趣的小鬼……"</p>
|
||
<p>一个身穿华丽铠甲的人偶从阴影中走出。它比其他人大得多,手中握着一把巨大的战斧。</p>
|
||
<p>"人偶之王……"GSD的表情变得严肃,"终于出现了。"</p>
|
||
<p>"那个瞎子……"人偶之王看着GSD,声音中带着怨恨,"二十年前,你就是从这里杀出去的……"</p>
|
||
<p>"你记得我?"GSD微微侧头。</p>
|
||
<p>"怎么可能忘记!"人偶之王举起战斧,"当年的那支冒险队,就是我的队伍!是你害死了他们!"</p>
|
||
<p>GSD沉默了一会儿,然后叹了口气。</p>
|
||
<p>"原来如此……你就是当年的那个队长。"</p>
|
||
<p>"闭嘴!"人偶之王怒吼,"我要杀了你,为我的兄弟们报仇!"</p>
|
||
<p>---</p>
|
||
<p>"林克,赛丽亚,退后。"GSD说,"这个家伙,让我来。"</p>
|
||
<p>他第一次拔出了腰间的剑。</p>
|
||
<p>那是一把通体漆黑的长剑,剑身上缠绕着暗红色的纹路,散发着令人心悸的气息。</p>
|
||
<p>"阿修罗之剑。"GSD轻声说,"我已经很久没用过它了。"</p>
|
||
<p>人偶之王的战斧斩下,带着撕裂空气的呼啸声。</p>
|
||
<p>但GSD只是轻轻抬剑,就挡住了这一击!</p>
|
||
<p>"你的力量比二十年前强了不少。"GSD说,"但……还是不够。"</p>
|
||
<p>他的剑身上突然爆发出耀眼的光芒——不,那不是光,而是纯粹的波动之力!</p>
|
||
<p>"觉醒·暗天波动眼。"</p>
|
||
<p>GSD的身后,出现了一个巨大的眼睛虚影。那是一只紧闭的眼睛,但当它缓缓睁开时,整个世界都仿佛陷入了黑暗!</p>
|
||
<p>"这……这是什么?!"人偶之王惊恐地后退。</p>
|
||
<p>"阿修罗的觉醒技能。"GSD说,"用波动之力,创造一个属于我的世界。"</p>
|
||
<p>在那只巨眼的注视下,人偶之王的身体开始崩解。</p>
|
||
<p>"不……不可能……"人偶之王跪倒在地,"我明明已经变得这么强了……"</p>
|
||
<p>"力量本身没有对错。"GSD收起剑,"但你选择了错误的道路。"</p>
|
||
<p>"现在,安息吧。"</p>
|
||
<p>"轰——!!!"</p>
|
||
<p>人偶之王的身体在波动之力中彻底消散。</p>
|
||
<p>---</p>
|
||
<p>当一切恢复平静时,林克和赛丽亚依然愣在原地。</p>
|
||
<p>刚才那一幕……太震撼了。</p>
|
||
<p>GSD身后的那只巨眼,那种仿佛能掌控一切的力量……</p>
|
||
<p>"师父……"林克的声音有些颤抖,"那就是……觉醒?"</p>
|
||
<p>"嗯。"GSD点点头,"阿修罗的觉醒技能——暗天波动眼。"</p>
|
||
<p>"好强……"</p>
|
||
<p>"你也有一天能达到这个境界的。"GSD拍了拍林克的肩膀,"剑魂的觉醒,叫做'极·鬼剑术'。当你真正掌握剑魂的精髓时,就能领悟它。"</p>
|
||
<p>"极·鬼剑术……"</p>
|
||
<p>林克握紧拳头,眼中闪烁着渴望的光芒。</p>
|
||
<p>总有一天,他也要变得像师父一样强!</p>
|
||
<p>---</p>
|
||
<p>离开人偶玄关时,GSD将一块人偶之王的魔力核心交给了林克。</p>
|
||
<p>"这个可以用来强化你的短剑影牙。"他说。</p>
|
||
<p>"谢谢师父!"</p>
|
||
<p>"不用谢。"GSD转身看向天空之城的更高处,"接下来的路,就要靠你们自己了。"</p>
|
||
<p>"您不继续带我们了吗?"赛丽亚问。</p>
|
||
<p>"嗯。"GSD点点头,"石巨人塔以上的区域,对你们来说还太危险。你们先在龙人之塔和人偶玄关修炼,等实力足够了再往上走。"</p>
|
||
<p>"我明白了。"林克郑重地说,"我们不会让您失望的。"</p>
|
||
<p>GSD微微一笑,转身向传送阵走去。</p>
|
||
<p>"我等着你们的好消息。"</p>
|
||
<p>---</p>
|
||
<p>(第十四章完)</p>
|
||
<p><em>未完待续……</em></p>
|
||
</article>
|
||
</div>
|
||
|
||
<!-- 固定底部导航 -->
|
||
<nav class="fixed-nav">
|
||
<div class="fixed-nav-content">
|
||
<a href="chapter-13.html" class="nav-btn ">上一章</a>
|
||
<a href="../chapters.html" class="nav-btn">目录</a>
|
||
<a href="chapter-15.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 current">第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">第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(14)) {
|
||
readChapters.push(14);
|
||
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> |