-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
197 lines (181 loc) · 8.06 KB
/
Copy pathindex.html
File metadata and controls
197 lines (181 loc) · 8.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title>我的书架 - 本地阅读</title>
<!-- 禁用字体平滑以提高清晰度 -->
<style>
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
<link rel="stylesheet" href="src/css/qidian.css">
<link rel="stylesheet" href="src/css/components.css">
<link rel="stylesheet" href="src/css/titlebar.css">
</head>
<body>
<!-- 自定义标题栏(Electron 环境下显示) -->
<div id="titlebar" class="titlebar" style="display:none">
<div class="titlebar-drag">
<svg class="titlebar-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
<span class="titlebar-title">本地阅读</span>
</div>
<div class="titlebar-controls">
<button id="titlebar-min" class="titlebar-btn" title="最小化">
<svg viewBox="0 0 10 10"><line x1="1" y1="5" x2="9" y2="5" stroke="currentColor"/></svg>
</button>
<button id="titlebar-max" class="titlebar-btn" title="最大化">
<svg viewBox="0 0 10 10"><rect x="1" y="1" width="8" height="8" stroke="currentColor" fill="none"/></svg>
</button>
<button id="titlebar-close" class="titlebar-btn titlebar-close-btn" title="关闭">
<svg viewBox="0 0 10 10"><line x1="1" y1="1" x2="9" y2="9" stroke="currentColor"/><line x1="9" y1="1" x2="1" y2="9" stroke="currentColor"/></svg>
</button>
</div>
</div>
<script>
if (window.electronAPI && window.electronAPI.isElectron) {
document.documentElement.classList.add('electron-app', 'bookshelf-page');
document.body.classList.add('electron-app', 'bookshelf-page');
const tb = document.getElementById('titlebar');
tb.style.display = '';
document.getElementById('titlebar-min').onclick = () => window.electronAPI.windowMinimize();
document.getElementById('titlebar-max').onclick = () => window.electronAPI.windowMaximize();
document.getElementById('titlebar-close').onclick = () => window.electronAPI.windowClose();
window.electronAPI.onMaximizeChange(isMax => {
const btn = document.getElementById('titlebar-max');
btn.title = isMax ? '还原' : '最大化';
btn.innerHTML = isMax
? '<svg viewBox="0 0 10 10"><rect x="2.5" y="0" width="7" height="7" stroke="currentColor" fill="none"/><rect x="0" y="2.5" width="7" height="7" stroke="currentColor" fill="var(--qd-white, #fff)"/></svg>'
: '<svg viewBox="0 0 10 10"><rect x="1" y="1" width="8" height="8" stroke="currentColor" fill="none"/></svg>';
});
}
</script>
<header class="qd-header">
<div class="qd-header-inner">
<a href="#" class="qd-logo">
<span>📚</span>
<span>本地阅读</span>
</a>
<div class="qd-search-box">
<input type="text" id="bookSearchInput" class="qd-search-input" placeholder="搜索书架..." />
<button class="qd-search-btn">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</svg>
</button>
</div>
<div class="qd-actions">
<button id="themeToggle" class="qd-btn qd-btn-outline">夜间模式</button>
<button id="addBookBtn" class="qd-btn qd-btn-primary">添加书籍</button>
</div>
</div>
</header>
<div class="qd-container">
<div class="qd-shelf-header">
<div>
<span class="qd-shelf-title">我的书架</span>
<span id="bookshelfSummary" class="qd-shelf-stats"></span>
</div>
<div class="qd-controls">
<select id="sortSelect" class="qd-select">
<option value="recent">最近阅读</option>
<option value="title">书名</option>
<option value="added">添加时间</option>
</select>
</div>
</div>
<main id="bookshelfGrid" class="qd-book-grid">
<!-- Books will be inserted here -->
</main>
<div id="bookshelfEmpty" class="qd-empty" hidden>
<div class="qd-empty-icon">📂</div>
<h3>书架空空如也</h3>
<p>拖拽文件到此处,或点击右上角“添加书籍”</p>
</div>
</div>
<footer class="qd-footer">
<p>支持 EPUB / TXT / PDF · 本地存储 · 安全私密</p>
<div style="margin-top: 10px;">
<a href="reader.html">阅读器</a>
<a href="user-data/" target="_blank">数据目录</a>
</div>
</footer>
<input id="bookFileInput" type="file" accept=".epub,.txt,.pdf" multiple hidden />
<div id="dragOverlay" class="drag-overlay"></div>
<div id="toast" class="toast"></div>
<!-- 添加书籍弹窗 -->
<div id="addBooksMask" class="add-books-mask">
<div class="add-books-modal">
<div class="add-books-header">
<h3 class="add-books-title">添加书籍</h3>
<button id="addBooksClose" class="add-books-close" title="关闭">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="add-books-body">
<div id="dropZone" class="drop-zone">
<div class="drop-zone-icon">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17 8 12 3 7 8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
</div>
<p class="drop-zone-text">拖拽文件到此处</p>
<p class="drop-zone-hint">或点击选择文件</p>
<button id="selectFilesBtn" class="select-files-btn">选择文件</button>
<p class="drop-zone-formats">支持 EPUB / TXT / PDF 格式</p>
</div>
<div class="files-section">
<div class="files-header">
<span class="files-title">待添加文件</span>
<button id="clearFilesBtn" class="clear-files-btn">清空列表</button>
</div>
<div id="filesList" class="files-list">
<div class="files-empty">
<p>还没有选择任何文件</p>
</div>
</div>
</div>
</div>
<div class="add-books-footer">
<button id="cancelAddBtn" class="add-books-btn cancel">取消</button>
<button id="confirmAddBtn" class="add-books-btn confirm" disabled>
<span class="btn-text">添加书籍</span>
<span class="btn-loading" style="display:none;">
<svg class="spinner" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10" stroke-dasharray="60" stroke-dashoffset="20"></circle>
</svg>
上传中...
</span>
</button>
</div>
</div>
</div>
<input id="fileInputModal" type="file" accept=".epub,.txt,.pdf" multiple hidden />
<template id="bookCardTemplate">
<article class="qd-book-card">
<div class="qd-cover-wrapper">
<img src="" alt="" class="qd-cover-img" loading="lazy" />
<div class="qd-cover-placeholder" aria-hidden="true"></div>
<button class="qd-delete-btn" title="删除">×</button>
</div>
<div class="qd-book-info">
<div class="qd-book-title"></div>
<div class="qd-book-meta">
<span class="meta-info"></span>
<span class="meta-tag"></span>
</div>
</div>
</article>
</template>
<script type="module" src="src/js/bookshelfApp.js"></script>
</body>
</html>