-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
178 lines (168 loc) · 7.59 KB
/
index.html
File metadata and controls
178 lines (168 loc) · 7.59 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenLibrary</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📚</text></svg>">
<!-- Apply saved theme before first paint to prevent flash -->
<script>(function(){try{var t=localStorage.getItem('ol-theme');if(t&&t!=='auto')document.documentElement.dataset.theme=t;}catch(e){}}());</script>
<link rel="stylesheet" href="css/themes.css">
<link rel="stylesheet" href="css/layout.css">
<link rel="stylesheet" href="css/sources.css">
<link rel="stylesheet" href="css/modals.css">
</head>
<body>
<header>
<div class="header-row">
<div class="logo-group">
<span class="logo-icon">📚</span>
<h1 class="logo-text">OpenLibrary</h1>
</div>
<div class="header-actions">
<select class="theme-select" id="themeSelect" title="Theme">
<option value="auto">🌗 Auto</option>
<option value="light">☀️ Light</option>
<option value="dark">🌙 Dark</option>
<option value="sepia">📜 Sepia</option>
</select>
<button class="btn-sources btn-sources--cta" id="btnSources">
<span id="srcBtnLabel">+ Add Source</span>
</button>
</div>
</div>
</header>
<main>
<div class="toolbar" id="toolbar" style="display:none">
<div class="search-wrap">
<input id="searchInput" placeholder="Search title, author, series…" autocomplete="off">
</div>
<select id="sortSelect">
<option value="series">Sort: Series Order</option>
<option value="title">Title A–Z</option>
<option value="author">Author A–Z</option>
<option value="title_desc">Title Z–A</option>
</select>
<span class="book-count" id="bookCount"></span>
</div>
<div class="status-banner" id="statusBanner"></div>
<div class="book-grid" id="bookGrid"></div>
<div class="pagination" id="pagination"></div>
<div class="empty-state show" id="emptyState">
<div class="empty-icon">📖</div>
<div class="empty-title">No library sources loaded</div>
<div class="empty-sub">Click <strong>+ Add Source</strong> and enter a library URL to get started.</div>
</div>
</main>
<!-- ── Book detail modal ── -->
<div class="overlay" id="bookOverlay">
<div class="modal-box book-modal-box">
<button class="bm-close" id="bmClose">✕</button>
<div class="bm-inner">
<div class="bm-cover" id="bmCover">
<div class="bm-cover-ph" id="bmCoverPh">?</div>
</div>
<div class="bm-meta">
<div class="bm-source-tag" id="bmSource"></div>
<div class="bm-title" id="bmTitle"></div>
<div class="bm-author" id="bmAuthor"></div>
<div class="meta-row" id="bmSeriesRow" style="display:none">
<span class="meta-label">Series</span>
<span class="meta-value" id="bmSeries"></span>
</div>
<div class="meta-row">
<span class="meta-label">Formats</span>
<span class="meta-value" id="bmFormats"></span>
</div>
<div class="meta-row" id="bmIdRow">
<span class="meta-label">ID</span>
<span class="meta-value" id="bmId" style="font-size:.75rem;opacity:.45;word-break:break-all"></span>
</div>
<div class="bm-formats" id="bmDlButtons"></div>
</div>
</div>
</div>
</div>
<!-- ── Add-source dialog ── -->
<div class="overlay" id="addOverlay">
<div class="modal-box dlg-box">
<div class="dlg-title">🔗 Add Library Source</div>
<label class="dlg-label">Library base URL</label>
<input class="dlg-input" id="addUrl" placeholder="github:user/repo · github:user/repo/subdir · https://raw.githubusercontent.com/…">
<p class="hint">Use <code>github:user/repo</code> or <code>github:user/repo/subdir</code> as a shorthand, or paste the full URL to the folder containing <strong>lib.json</strong>.</p>
<p class="hint hint-tip">💡 New here? Add <a class="hint-fill-btn" href="#">github:Auchrio/OpenLibrary</a> to get started with a curated library index.</p>
<div class="error-msg" id="addError"></div>
<div class="preview-box" id="addPreview">
<div class="preview-name" id="prevName"></div>
<div class="preview-count" id="prevCount"></div>
<div id="linkedContainer" style="display:none">
<div style="margin-top:10px;font-size:.8rem;font-weight:600;color:var(--muted)">LINKED LIBRARIES</div>
<div class="linked-list" id="linkedList"></div>
</div>
</div>
<div class="dlg-actions">
<button class="btn-secondary" id="addCancel">Cancel</button>
<button class="btn-primary" id="addPreviewBtn">Preview</button>
<button class="btn-primary" id="addConfirmBtn" style="display:none">Import</button>
</div>
</div>
</div>
<!-- ── Key prompt dialog ── -->
<div class="overlay" id="keyOverlay">
<div class="modal-box dlg-box">
<div class="dlg-title">🔐 Password Required</div>
<p id="keyDlgDesc" class="key-dlg-desc"></p>
<label class="dlg-label">Decryption password</label>
<input class="dlg-input" id="keyInput" type="password" placeholder="Enter the library password" autocomplete="off">
<div class="error-msg" id="keyError"></div>
<div class="dlg-actions">
<button class="btn-secondary" id="keyCancel">Cancel</button>
<button class="btn-primary" id="keyUnlockBtn">Unlock</button>
</div>
</div>
</div>
<!-- ── Sources manager overlay ── -->
<div class="overlay" id="sourcesOverlay">
<div class="modal-box sources-modal-box">
<div class="sources-modal-header">
<div class="sources-modal-title">📚 Library Sources</div>
<button class="bm-close" id="srcMgrClose">✕</button>
</div>
<div class="sources-modal-toolbar">
<button class="btn-secondary" id="srcRefreshBtn">↺ Refresh</button>
<button class="btn-secondary" id="srcExportBtn">⎘ Copy as JSON</button>
<button class="btn-secondary" id="srcImportBtn">↑ Import JSON</button>
<button class="btn-primary" id="btnAdd">+ Add New</button>
</div>
<div class="src-import-panel" id="srcImportPanel">
<label class="dlg-label">Paste a JSON array of source objects:</label>
<textarea class="dlg-input src-import-ta" id="srcImportTa"
placeholder='[{"url":"https://...","name":"My Library"}]'></textarea>
<div class="error-msg" id="srcImportError"></div>
<div class="dlg-actions">
<button class="btn-secondary" id="srcImportCancel">Cancel</button>
<button class="btn-primary" id="srcImportConfirm">Import</button>
</div>
</div>
<div id="srcList"></div>
<!-- Discovery panel: shown after refresh finds new linked libraries -->
<div class="src-discover-panel" id="srcDiscoverPanel">
<div class="src-panel-header">🔗 New Libraries Discovered</div>
<p class="src-discover-desc">These libraries were found via links in your current sources. Select which to add:</p>
<div class="linked-list" id="srcDiscoverList" style="padding:4px 16px 0"></div>
<div class="dlg-actions" style="padding:10px 16px 14px">
<button class="btn-secondary" id="srcDiscoverDismiss">Dismiss</button>
<button class="btn-primary" id="srcDiscoverAddBtn">Add Selected</button>
</div>
</div>
</div>
</div>
<script src="js/crypto.js"></script>
<script src="js/state.js"></script>
<script src="js/library.js"></script>
<script src="js/render.js"></script>
<script src="js/modal.js"></script>
<script src="js/sources.js"></script>
<script src="js/main.js"></script>
</body>
</html>