Use correct naming in the section jumper Fixes #3819
This commit is contained in:
parent
5b4ae73401
commit
db0f1dae86
3 changed files with 11 additions and 15 deletions
|
|
@ -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)="goToPage(0)">{{pageNum}}</div>
|
||||
<div class="col-1" (click)="goToSection(0)">{{pageNum}}</div>
|
||||
<div class="col-8">
|
||||
<ngb-progressbar class="clickable" [title]="t('go-to-page')" (click)="goToPage()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
|
||||
<ngb-progressbar class="clickable" [title]="t('go-to-page')" (click)="goToSection()" type="primary" height="5px" [value]="pageNum" [max]="maxPages - 1"></ngb-progressbar>
|
||||
</div>
|
||||
<div class="col-1 btn-icon" (click)="goToPage(maxPages - 1)" [title]="t('go-to-last-page')">{{maxPages - 1}}</div>
|
||||
<div class="col-1 btn-icon" (click)="goToSection(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>
|
||||
|
|
|
|||
|
|
@ -748,7 +748,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
} else if (event.key === KEY_CODES.G) {
|
||||
this.goToPage();
|
||||
this.goToSection();
|
||||
} else if (event.key === KEY_CODES.F) {
|
||||
this.toggleFullscreen()
|
||||
}
|
||||
|
|
@ -905,33 +905,29 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||
}
|
||||
|
||||
|
||||
promptForPage() {
|
||||
const question = translate('book-reader.go-to-page-prompt', {totalPages: this.maxPages - 1});
|
||||
promptForSection() {
|
||||
const question = translate('book-reader.go-to-section-prompt', {totalSections: this.maxPages - 1});
|
||||
const goToPageNum = window.prompt(question, '');
|
||||
if (goToPageNum === null || goToPageNum.trim().length === 0) { return null; }
|
||||
return goToPageNum;
|
||||
}
|
||||
|
||||
goToPage(pageNum?: number) {
|
||||
goToSection(pageNum?: number) {
|
||||
let page = pageNum;
|
||||
if (pageNum === null || pageNum === undefined) {
|
||||
const goToPageNum = this.promptForPage();
|
||||
const goToPageNum = this.promptForSection();
|
||||
if (goToPageNum === null) { return; }
|
||||
page = parseInt(goToPageNum.trim(), 10);
|
||||
}
|
||||
|
||||
if (page === undefined || this.pageNum === page) { return; }
|
||||
|
||||
if (page > this.maxPages) {
|
||||
page = this.maxPages;
|
||||
if (page > this.maxPages-1) {
|
||||
page = this.maxPages-1;
|
||||
} else if (page < 0) {
|
||||
page = 0;
|
||||
}
|
||||
|
||||
if (!(page === 0 || page === this.maxPages - 1)) {
|
||||
page -= 1;
|
||||
}
|
||||
|
||||
this.pageNum = page;
|
||||
this.loadPage();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -882,7 +882,7 @@
|
|||
"incognito-mode-label": "Incognito Mode",
|
||||
"next": "Next",
|
||||
"previous": "Previous",
|
||||
"go-to-page-prompt": "There are {{totalPages}} pages. What page do you want to go to?"
|
||||
"go-to-section-prompt": "There are {{totalSections}} sections. What section do you want to go to?"
|
||||
},
|
||||
|
||||
"personal-table-of-contents": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue