Revert "Use correct naming in the section jumper Fixes #3819"

This reverts commit db0f1dae86.
This commit is contained in:
Joseph Milazzo 2025-06-01 07:39:45 -05:00
parent 6d44f13af7
commit 3d097fbc33
3 changed files with 15 additions and 11 deletions

View file

@ -44,11 +44,11 @@
</div>
<div class="d-flex align-items-center justify-content-between text-center row g-0">
<button class="btn btn-small btn-icon col-1" [disabled]="prevChapterDisabled" (click)="loadPrevChapter()" [title]="t('prev-chapter')"><i class="fa fa-fast-backward" aria-hidden="true"></i></button>
<div class="col-1" (click)="goToSection(0)">{{pageNum}}</div>
<div class="col-1" (click)="goToPage(0)">{{pageNum}}</div>
<div class="col-8">
<ngb-progressbar class="clickable" [title]="t('go-to-page')" (click)="goToSection()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
<ngb-progressbar class="clickable" [title]="t('go-to-page')" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
</div>
<div class="col-1 btn-icon" (click)="goToSection(maxPages - 1)" [title]="t('go-to-last-page')">{{maxPages - 1}}</div>
<div class="col-1 btn-icon" (click)="goToPage(maxPages - 1)" [title]="t('go-to-last-page')">{{maxPages - 1}}</div>
<button class="btn btn-small btn-icon col-1" [disabled]="nextChapterDisabled" (click)="loadNextChapter()" [title]="t('next-chapter')"><i class="fa fa-fast-forward" aria-hidden="true"></i></button>
</div>
</div>

View file

@ -748,7 +748,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
event.stopPropagation();
event.preventDefault();
} else if (event.key === KEY_CODES.G) {
this.goToSection();
this.goToPage();
} else if (event.key === KEY_CODES.F) {
this.toggleFullscreen()
}
@ -905,29 +905,33 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
promptForSection() {
const question = translate('book-reader.go-to-section-prompt', {totalSections: this.maxPages - 1});
promptForPage() {
const question = translate('book-reader.go-to-page-prompt', {totalPages: this.maxPages - 1});
const goToPageNum = window.prompt(question, '');
if (goToPageNum === null || goToPageNum.trim().length === 0) { return null; }
return goToPageNum;
}
goToSection(pageNum?: number) {
goToPage(pageNum?: number) {
let page = pageNum;
if (pageNum === null || pageNum === undefined) {
const goToPageNum = this.promptForSection();
const goToPageNum = this.promptForPage();
if (goToPageNum === null) { return; }
page = parseInt(goToPageNum.trim(), 10);
}
if (page === undefined || this.pageNum === page) { return; }
if (page > this.maxPages-1) {
page = this.maxPages-1;
if (page > this.maxPages) {
page = this.maxPages;
} else if (page < 0) {
page = 0;
}
if (!(page === 0 || page === this.maxPages - 1)) {
page -= 1;
}
this.pageNum = page;
this.loadPage();
}

View file

@ -882,7 +882,7 @@
"incognito-mode-label": "Incognito Mode",
"next": "Next",
"previous": "Previous",
"go-to-section-prompt": "There are {{totalSections}} sections. What section do you want to go to?"
"go-to-page-prompt": "There are {{totalPages}} pages. What page do you want to go to?"
},
"personal-table-of-contents": {