Skip to content

Commit fd445de

Browse files
committed
feat: continuous scroll
1 parent ddf9f33 commit fd445de

3 files changed

Lines changed: 44 additions & 8 deletions

File tree

epub_browser/assets/annotation.css

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@
498498

499499
.color-info-tip,
500500
.color-tip-default,
501-
.color-tip-reorder {
501+
.color-tip-reorder,
502+
.continuous-scroll-tip {
502503
cursor: help;
503504
color: var(--text-secondary);
504505
font-size: 0.8rem;
@@ -511,7 +512,8 @@
511512

512513
.color-info-tip:hover,
513514
.color-tip-default:hover,
514-
.color-tip-reorder:hover {
515+
.color-tip-reorder:hover,
516+
.continuous-scroll-tip:hover {
515517
opacity: 1;
516518
}
517519

@@ -551,6 +553,38 @@
551553
content: 'Drag to reorder.';
552554
}
553555

556+
.continuous-scroll-tip:hover::after {
557+
content: attr(data-tip);
558+
position: absolute;
559+
bottom: calc(100% + 8px);
560+
left: 50%;
561+
transform: translateX(-50%);
562+
background: var(--text);
563+
color: var(--background);
564+
padding: 8px 12px;
565+
border-radius: 6px;
566+
font-size: 0.75rem;
567+
white-space: normal;
568+
word-break: break-word;
569+
width: max-content;
570+
max-width: min(320px, calc(100vw - 40px));
571+
line-height: 1.5;
572+
text-align: left;
573+
z-index: 100;
574+
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
575+
}
576+
577+
.continuous-scroll-tip:hover::before {
578+
content: '';
579+
position: absolute;
580+
bottom: calc(100% + 2px);
581+
left: 50%;
582+
transform: translateX(-50%);
583+
border: 5px solid transparent;
584+
border-top-color: var(--text);
585+
z-index: 100;
586+
}
587+
554588
.color-add-btn {
555589
width: 24px;
556590
height: 24px;

epub_browser/assets/chapter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,20 +1893,20 @@ function initScript() {
18931893

18941894
// 绑定 continuous scroll toggle 开关
18951895
var continuousScrollToggle = document.getElementById('continuousScrollToggle');
1896-
var continuousScrollHint = document.getElementById('continuousScrollHint');
1896+
var continuousScrollTip = document.getElementById('continuousScrollTip');
18971897
if (continuousScrollToggle) {
18981898
// 翻页模式下禁用该开关
18991899
if (isPaginationMode) {
19001900
continuousScrollToggle.disabled = true;
19011901
continuousScrollToggle.checked = false;
1902-
if (continuousScrollHint) {
1903-
continuousScrollHint.textContent = 'Continuous scroll is only available in Scrolling mode. Switch to Scrolling mode first to enable this feature.';
1902+
if (continuousScrollTip) {
1903+
continuousScrollTip.setAttribute('data-tip', 'Continuous scroll is only available in Scrolling mode. Switch to Scrolling mode first to enable this feature.');
19041904
}
19051905
} else {
19061906
continuousScrollToggle.disabled = false;
19071907
continuousScrollToggle.checked = isContinuousScroll;
1908-
if (continuousScrollHint) {
1909-
continuousScrollHint.textContent = 'When enabled, scrolling past the end of a chapter automatically loads the next chapter. Scroll progress save/restore is disabled (chapter position tracked via URL). Tip: in scrolling mode, double-tap Space for similar seamless reading.';
1908+
if (continuousScrollTip) {
1909+
continuousScrollTip.setAttribute('data-tip', 'Automatically loads the next chapter when scrolling past the end. Note: scroll progress save/restore is disabled. Tip: press Space for a similar seamless reading experience when this is off.');
19101910
}
19111911
}
19121912

epub_browser/processor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,8 +1414,10 @@ def create_chapter_template(self, content, style_links, chapter_index, chapter_t
14141414
<input type="checkbox" id="continuousScrollToggle">
14151415
<span class="switch-slider"></span>
14161416
<span class="switch-text">Enable Continuous Scroll</span>
1417+
<span class="continuous-scroll-tip" id="continuousScrollTip" data-tip="">
1418+
<i class="fas fa-info-circle"></i>
1419+
</span>
14171420
</label>
1418-
<small class="setting-hint" id="continuousScrollHint">Only available in Scrolling mode. When enabled, scrolling past the end of a chapter will automatically load the next chapter, creating a seamless reading experience across chapter boundaries.</small>
14191421
</div>
14201422
</div>
14211423
</div>

0 commit comments

Comments
 (0)