Skip to content

Commit 3f0ced4

Browse files
committed
fix: resources
1 parent a1546db commit 3f0ced4

6 files changed

Lines changed: 68 additions & 16 deletions

File tree

README.md

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ It now supports:
1313

1414
* Simple library management: searching by title, author or tag.
1515
* Dark mode.
16+
* Page turning/scrolling: support keyboards(left arrow & right arrow & space).
17+
* Kindle mode: more style optimizations; Clicking on both sides of the screen is allowed to turn pages.
1618
* Reading progress bar.
1719
* Table of contents in each chapter(not active in `Page turning mode`).
1820
* Font size/family adjustment.
@@ -22,7 +24,6 @@ It now supports:
2224
* Remember position: remember your last reading chapter(support all devices including Kindle) and your last reading position(support all devices except Kindle).
2325
* Custom CSS: you can write your own CSS style to improve your reading experience, such as `.content{margin: 50px;}.content p{ font-size: 2rem; }`(All the main content is under the element with the class `content`).
2426
* Can be directly deployed on any web server such as Apache: use `--no-server` parameter.
25-
* Page turning mode: support keyboards(left arrow & right arrow & space).
2627
* Multi threads.
2728

2829
## Usage
@@ -65,27 +66,60 @@ Then a browser will be opened to view the epub file.
6566

6667
### Desktop
6768

68-
![epub library home](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-13-7Zojnb-JH0qhY.png)
69+
#### library home
6970

70-
![epub book home](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-13-DMXr4g-DG7fei.png)
71+
![home](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-HWZoEf-3pN2vj.png)
7172

72-
![epub chapter example1](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-13-oQzhk1-Z8g6hg.png)
73+
* View All Books
74+
* Switch Kindle Mode
75+
* Search for Books
76+
* Toggle Dark Mode
7377

74-
![epub chapter example2](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-13-B3rpC0-BSaN6R.png)
78+
#### Page-turning mode
79+
80+
![page turning](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-VvMhcs-Y6EeNs.png)
81+
82+
* Previous Chapter
83+
* Next Chapter
84+
* Previous Page: Keyboard Left Arrow
85+
* Next Page: Keyboard Right Arrow, Spacebar
86+
* Jump to a Specific Page
87+
* Set Pagination Page Height to Customize Content Display per Page
88+
89+
#### Book home
90+
91+
![book home](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-IFvr9L-oZR6vO.png)
92+
93+
* View Book Table of Contents
94+
95+
#### Reader
96+
97+
![reader](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-yWbMdb-NPTPJq.png)
98+
99+
* Breadcrumb
100+
* Custom CSS
101+
* Scroll Reading
102+
* Page-Turning Reading
103+
* View Book Table of Contents
104+
* View Chapter Table of Contents
105+
* Return to Library Homepage
106+
* Font Adjustment
75107

76108
### Mobile
77109

78-
![mobile support](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-13-tFUcoE-CKAxJE.png)
110+
![mobile support](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-eQFGMw-4ONeC0.png)
79111

80112
### Kindle
81113

82-
![kindle support1](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-14-wXATw7-screenshot_2025_11_14T00_05_50+0800.png)
114+
![kindle support1](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-BpV0De-screenshot_2025_11_16T20_34_57+0800.png)
115+
116+
![kindle support2](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-wmsmxP-screenshot_2025_11_16T20_36_01+0800.png)
83117

84-
![kindle support2](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-14-JsykYo-screenshot_2025_11_14T00_06_18+0800.png)
118+
![kindle support3](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-VZqKQ4-screenshot_2025_11_16T23_26_59+0800.png)
85119

86-
![kindle support3](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-14-S3hqb9-screenshot_2025_11_14T00_06_51+0800.png)
120+
![kindle support4](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-Ib1pM1-screenshot_2025_11_16T23_28_27+0800.png)
87121

88-
![kindle support4](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-14-l0maxe-screenshot_2025_11_14T00_07_11+0800.png)
122+
![kindle support5](https://fastly.jsdelivr.net/gh/dfface/img0@master/2025/11-16-Fta2oI-screenshot_2025_11_16T23_28_58+0800.png)
89123

90124
## Tips
91125

assets/test1.png

-139 KB
Binary file not shown.

epub_browser/assets/chapter.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ document.addEventListener('DOMContentLoaded', function() {
211211
} else {
212212
loadReadingProgress(); // 刚进去是 scroll,也需要恢复下进度
213213
}
214-
214+
215215
function savePaginationModeAndReload() {
216216
isPaginationMode = !isPaginationMode;
217217

@@ -568,6 +568,23 @@ document.addEventListener('DOMContentLoaded', function() {
568568
location.href = next_href;
569569
}
570570
});
571+
572+
// 监听点击事件
573+
if (isKindleMode()) {
574+
content.addEventListener('click', function(e) {
575+
const screenWidth = window.innerWidth;
576+
const targetArea = screenWidth * 0.3;
577+
578+
// 左侧40px内点击
579+
if (e.clientX < targetArea) {
580+
prevPageBtn.click();
581+
}
582+
// 右侧40px内点击
583+
else if (e.clientX > screenWidth - targetArea) {
584+
nextPageBtn.click();
585+
}
586+
});
587+
}
571588

572589
// 检查当前的基路径
573590
if (!path.startsWith("/book/")) {

epub_browser/library.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ def add_book(self, epub_path):
9494

9595
def add_assets(self):
9696
# 复制 assets
97+
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
98+
ASSETS_DIR = os.path.join(BASE_DIR, 'assets')
9799
assets_path = os.path.join(self.base_directory, "assets")
98-
for root, dirs, files in os.walk("./assets"):
100+
for root, dirs, files in os.walk(ASSETS_DIR):
99101
for file in files:
100102
src_path = os.path.join(root, file)
101103
dst_path = os.path.join(assets_path, file)

epub_browser/processor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def create_chapter_template(self, content, style_links, chapter_index, chapter_t
762762
</a>
763763
764764
<div id="paginationInfo" style="display: none;">
765-
<div class="control-btn" id="prevPage">
765+
<div class="control-btn" id="prevPage" style="padding-right: 40px;">
766766
<i class="fas fa-chevron-left"></i>
767767
<span class="control-name">Prev page</span>
768768
</div>
@@ -785,8 +785,7 @@ def create_chapter_template(self, content, style_links, chapter_index, chapter_t
785785
<span class="control-name">Set page height</span>
786786
</div>
787787
</div>
788-
789-
<div class="control-btn" id="nextPage">
788+
<div class="control-btn" id="nextPage" style="padding-left: 40px;">
790789
<i class="fas fa-chevron-right"></i>
791790
<span class="control-name">Next page</span>
792791
</div>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="epub-browser", # 在PyPI上显示的项目名称
9-
version="1.4.0", # 初始版本号
9+
version="1.4.1", # 初始版本号
1010
author="dfface", # 作者名
1111
author_email="dfface@sina.com", # 作者邮箱
1212
keywords="epub reader html export browser convert calibre-web calibre kindle web server local",

0 commit comments

Comments
 (0)