New PDF Reader (#1324)
* Refactored all the code that opens the reader to use a unified function. Added new library and setup basic pdf reader route. * Progress saving is implemented. Targeting ES6 now. * Customized the toolbar to remove things we don't want, made the download button download with correct filename. Adjusted zoom setting to work well on first load regardless of device. * Stream the pdf file to the UI rather than handling the download ourselves. * Started implementing a custom toolbar. * Fixed up the jump bar calculations * Fixed filtering being broken * Pushing up for Robbie to cleanup the toolbar layout * Added an additional button. Working on logic while robbie takes styling * Tried to fix the code for robbie * Tweaks for fonts * Added button for book mode, but doesn't seem to work after renderer is built * Removed book mode * Removed the old image caching code for pdfs as it's not needed with new reader * Removed the interfaces to extract images from pdf. * Fixed original pagination area not scaling correctly * Integrated series remove events to library detail * Cleaned up the getter naming convention * Cleaned up some of the manga reader code to reduce cluter and improve re-use * Implemented Japanese parser support for volume and chapters. * Fixed a bug where resetting scroll in manga reader wasn't working * Fixed a bug where word count grew on each scan. * Removed unused variable * Ensure we calculate word count on files with their own cache timestamp * Adjusted size of reel headers * Put some code in for moving on original image with keyboard, but it's not in use. * Cleaned up the css for the pdf reader * Cleaned up the code * Tweaked the list item so we show scrollbar now when fully read
This commit is contained in:
parent
384fac68c4
commit
3ab3a10ae7
45 changed files with 2309 additions and 208 deletions
|
|
@ -5,10 +5,14 @@ import { ChapterInfo } from '../manga-reader/_models/chapter-info';
|
|||
import { UtilityService } from '../shared/_services/utility.service';
|
||||
import { Chapter } from '../_models/chapter';
|
||||
import { HourEstimateRange } from '../_models/hour-estimate-range';
|
||||
import { MangaFormat } from '../_models/manga-format';
|
||||
import { BookmarkInfo } from '../_models/manga-reader/bookmark-info';
|
||||
import { PageBookmark } from '../_models/page-bookmark';
|
||||
import { ProgressBookmark } from '../_models/progress-bookmark';
|
||||
|
||||
export const CHAPTER_ID_DOESNT_EXIST = -1;
|
||||
export const CHAPTER_ID_NOT_FETCHED = -2;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
|
@ -21,6 +25,22 @@ export class ReaderService {
|
|||
|
||||
constructor(private httpClient: HttpClient, private utilityService: UtilityService) { }
|
||||
|
||||
getNavigationArray(libraryId: number, seriesId: number, chapterId: number, format: MangaFormat) {
|
||||
if (format === undefined) format = MangaFormat.ARCHIVE;
|
||||
|
||||
if (format === MangaFormat.EPUB) {
|
||||
return ['library', libraryId, 'series', seriesId, 'book', chapterId];
|
||||
} else if (format === MangaFormat.PDF) {
|
||||
return ['library', libraryId, 'series', seriesId, 'pdf', chapterId];
|
||||
} else {
|
||||
return ['library', libraryId, 'series', seriesId, 'manga', chapterId];
|
||||
}
|
||||
}
|
||||
|
||||
downloadPdf(chapterId: number) {
|
||||
return this.baseUrl + 'reader/pdf?chapterId=' + chapterId;
|
||||
}
|
||||
|
||||
bookmark(seriesId: number, volumeId: number, chapterId: number, page: number) {
|
||||
return this.httpClient.post(this.baseUrl + 'reader/bookmark', {seriesId, volumeId, chapterId, page});
|
||||
}
|
||||
|
|
@ -51,7 +71,7 @@ export class ReaderService {
|
|||
|
||||
/**
|
||||
* Used exclusively for reading multiple bookmarks from a series
|
||||
* @param seriesId
|
||||
* @param seriesId
|
||||
*/
|
||||
getBookmarkInfo(seriesId: number) {
|
||||
return this.httpClient.get<BookmarkInfo>(this.baseUrl + 'reader/bookmark-info?seriesId=' + seriesId);
|
||||
|
|
@ -100,7 +120,7 @@ export class ReaderService {
|
|||
markVolumeUnread(seriesId: number, volumeId: number) {
|
||||
return this.httpClient.post(this.baseUrl + 'reader/mark-volume-unread', {seriesId, volumeId});
|
||||
}
|
||||
|
||||
|
||||
|
||||
getNextChapter(seriesId: number, volumeId: number, currentChapterId: number, readingListId: number = -1) {
|
||||
if (readingListId > 0) {
|
||||
|
|
@ -150,7 +170,7 @@ export class ReaderService {
|
|||
/**
|
||||
* Parses out the page number from a Image src url
|
||||
* @param imageSrc Src attribute of Image
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
imageUrlToPageNum(imageSrc: string) {
|
||||
if (imageSrc === undefined || imageSrc === '') { return -1; }
|
||||
|
|
@ -192,7 +212,7 @@ export class ReaderService {
|
|||
}
|
||||
|
||||
enterFullscreen(el: Element, callback?: VoidFunction) {
|
||||
if (!document.fullscreenElement) {
|
||||
if (!document.fullscreenElement) {
|
||||
if (el.requestFullscreen) {
|
||||
el.requestFullscreen().then(() => {
|
||||
if (callback) {
|
||||
|
|
@ -214,7 +234,7 @@ export class ReaderService {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @returns If document is in fullscreen mode
|
||||
*/
|
||||
checkFullscreenMode() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue