Skip to content

Commit 31cc8fd

Browse files
committed
feat: code by Trae: bookshelf
1 parent 05efdb2 commit 31cc8fd

8 files changed

Lines changed: 1756 additions & 6 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ It now supports the following features:
6060

6161
- **Cache management**: Update button in library to clear Service Worker cache and refresh content.
6262

63+
- **Bookshelf**: Personal bookshelf with grouping support (non-Kindle mode only). Features include:
64+
- Add/remove books to shelf from book detail page
65+
- Create nested groups for organization
66+
- Tag-based filtering within shelf and groups
67+
- Drag-and-drop sorting for books and groups
68+
- Export/import shelf data as JSON (supports both file upload and URL import)
69+
- Statistics showing book and group counts
70+
6371

6472
## Usage
6573

epub_browser/assets/book.css

Lines changed: 154 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
--gray: #6c757d;
88
--gray-light: #e9ecef;
99
--success: #4cc9f0;
10+
--danger: #e63946;
1011
--border-radius: 12px;
1112
--shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
1213
--transition: all 0.3s ease;
@@ -171,6 +172,7 @@ body {
171172
font-size: 0.9rem;
172173
text-align: center;
173174
white-space: nowrap;
175+
margin-bottom: 4px;
174176
}
175177

176178
.css-btn.primary {
@@ -193,7 +195,7 @@ body {
193195
border-radius: 6px;
194196
color: white;
195197
font-weight: 600;
196-
z-index: 1000;
198+
z-index: 10003;
197199
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
198200
transition: all 0.3s ease;
199201
}
@@ -584,6 +586,157 @@ body {
584586
#clearReadingProgressBtn {
585587
font-size: 0.5rem;
586588
}
589+
590+
#toggleShelfBtn {
591+
font-size: 0.5rem;
592+
}
593+
}
594+
595+
/* 书架按钮样式 */
596+
#toggleShelfBtn {
597+
margin-right: 10px;
598+
}
599+
600+
#toggleShelfBtn.in-shelf {
601+
background: var(--danger);
602+
}
603+
604+
#toggleShelfBtn.in-shelf:hover {
605+
background: #c0392b;
606+
}
607+
608+
/* 选择分组弹窗样式 */
609+
.select-group-modal {
610+
position: fixed;
611+
top: 0;
612+
left: 0;
613+
width: 100%;
614+
height: 100%;
615+
background-color: rgba(0, 0, 0, 0.5);
616+
display: none;
617+
justify-content: center;
618+
align-items: center;
619+
z-index: 10002;
620+
}
621+
622+
.select-group-modal.active {
623+
display: flex;
624+
}
625+
626+
.select-group-content {
627+
width: 90%;
628+
max-width: 500px;
629+
max-height: 80vh;
630+
background: var(--card-bg);
631+
border-radius: var(--border-radius);
632+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
633+
display: flex;
634+
flex-direction: column;
635+
}
636+
637+
.select-group-header {
638+
display: flex;
639+
justify-content: space-between;
640+
align-items: center;
641+
padding: 15px 20px;
642+
border-bottom: 1px solid var(--border-color);
643+
flex-shrink: 0;
644+
}
645+
646+
.select-group-header h3 {
647+
margin: 0;
648+
color: var(--text-color);
649+
}
650+
651+
.select-group-close-btn {
652+
width: 32px;
653+
height: 32px;
654+
background: var(--border-color);
655+
border: none;
656+
border-radius: 50%;
657+
cursor: pointer;
658+
display: flex;
659+
align-items: center;
660+
justify-content: center;
661+
transition: var(--transition);
662+
color: var(--text-color);
663+
}
664+
665+
.select-group-close-btn:hover {
666+
background: var(--danger);
667+
color: white;
668+
}
669+
670+
.select-group-body {
671+
padding: 20px;
672+
overflow-y: auto;
673+
flex: 1;
674+
}
675+
676+
.select-group-tree {
677+
display: flex;
678+
flex-direction: column;
679+
gap: 8px;
680+
}
681+
682+
.select-group-item {
683+
display: flex;
684+
align-items: center;
685+
padding: 10px 15px;
686+
background: var(--bg-color);
687+
border-radius: 6px;
688+
cursor: pointer;
689+
transition: var(--transition);
690+
border: 2px solid transparent;
691+
color: var(--text-color);
692+
}
693+
694+
.select-group-item:hover {
695+
background: var(--primary-light);
696+
color: white;
697+
}
698+
699+
.select-group-item.selected {
700+
border-color: var(--primary);
701+
background: var(--primary-light);
702+
color: white;
703+
}
704+
705+
.select-group-item-icon {
706+
margin-right: 10px;
707+
font-size: 1rem;
708+
}
709+
710+
.select-group-item-name {
711+
font-size: 0.95rem;
712+
font-weight: 500;
713+
}
714+
715+
.select-group-footer {
716+
padding: 15px 20px;
717+
border-top: 1px solid var(--border-color);
718+
display: flex;
719+
justify-content: flex-end;
720+
flex-shrink: 0;
721+
}
722+
723+
.select-group-confirm-btn {
724+
display: flex;
725+
align-items: center;
726+
justify-content: center;
727+
gap: 8px;
728+
padding: 12px 24px;
729+
background: var(--primary);
730+
color: white;
731+
border: none;
732+
border-radius: 6px;
733+
cursor: pointer;
734+
font-size: 0.95rem;
735+
transition: var(--transition);
736+
}
737+
738+
.select-group-confirm-btn:hover {
739+
background: var(--primary-light);
587740
}
588741

589742
/* 加载动画样式 */

0 commit comments

Comments
 (0)