mirror of
https://github.com/gotson/komga.git
synced 2026-05-09 05:10:19 +02:00
parent
c2a4d1713d
commit
809a794cf8
7 changed files with 22 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import {BookFormat} from '@/types/komga-books'
|
import {BookFormat, MediaDto} from '@/types/komga-books'
|
||||||
import {lowerCase} from 'lodash'
|
import {lowerCase} from 'lodash'
|
||||||
|
|
||||||
export function getBookFormatFromMediaType(mediaType: string): BookFormat {
|
export function getBookFormatFromMediaType(mediaType: string): BookFormat {
|
||||||
|
|
@ -19,10 +19,10 @@ export function getBookFormatFromMediaType(mediaType: string): BookFormat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBookReadRouteFromMediaProfile(mediaProfile: string): string {
|
export function getBookReadRouteFromMedia(media: MediaDto): string {
|
||||||
switch (lowerCase(mediaProfile)) {
|
switch (lowerCase(media.mediaProfile)) {
|
||||||
case 'epub':
|
case 'epub':
|
||||||
return 'read-epub'
|
return media.epubDivinaCompatible ? 'read-book' : 'read-epub'
|
||||||
default:
|
default:
|
||||||
return 'read-book'
|
return 'read-book'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import i18n from '@/i18n'
|
||||||
import {MediaStatus} from '@/types/enum-books'
|
import {MediaStatus} from '@/types/enum-books'
|
||||||
import {getFileSize} from '@/functions/file'
|
import {getFileSize} from '@/functions/file'
|
||||||
import {ReadListDto} from '@/types/komga-readlists'
|
import {ReadListDto} from '@/types/komga-readlists'
|
||||||
import {getBookReadRouteFromMediaProfile} from '@/functions/book-format'
|
import {getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||||
|
|
||||||
export enum ItemTypes {
|
export enum ItemTypes {
|
||||||
BOOK, SERIES, COLLECTION, READLIST
|
BOOK, SERIES, COLLECTION, READLIST
|
||||||
|
|
@ -170,7 +170,7 @@ export class BookItem extends Item<BookDto> {
|
||||||
|
|
||||||
fabTo(): RawLocation {
|
fabTo(): RawLocation {
|
||||||
return {
|
return {
|
||||||
name: getBookReadRouteFromMediaProfile(this.item?.media?.mediaProfile),
|
name: getBookReadRouteFromMedia(this.item?.media),
|
||||||
params: {bookId: this.item.id},
|
params: {bookId: this.item.id},
|
||||||
query: {context: this.item?.context?.origin, contextId: this.item?.context?.id},
|
query: {context: this.item?.context?.origin, contextId: this.item?.context?.id},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export interface MediaDto {
|
||||||
pagesCount: number,
|
pagesCount: number,
|
||||||
comment: string,
|
comment: string,
|
||||||
mediaProfile: string,
|
mediaProfile: string,
|
||||||
|
epubDivinaCompatible: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PageDto {
|
export interface PageDto {
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@ import BookActionsMenu from '@/components/menus/BookActionsMenu.vue'
|
||||||
import ItemCard from '@/components/ItemCard.vue'
|
import ItemCard from '@/components/ItemCard.vue'
|
||||||
import ToolbarSticky from '@/components/bars/ToolbarSticky.vue'
|
import ToolbarSticky from '@/components/bars/ToolbarSticky.vue'
|
||||||
import {groupAuthorsByRole} from '@/functions/authors'
|
import {groupAuthorsByRole} from '@/functions/authors'
|
||||||
import {getBookFormatFromMediaType, getBookReadRouteFromMediaProfile} from '@/functions/book-format'
|
import {getBookFormatFromMediaType, getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||||
import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress'
|
import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress'
|
||||||
import {getBookTitleCompact} from '@/functions/book-title'
|
import {getBookTitleCompact} from '@/functions/book-title'
|
||||||
import {bookFileUrl, bookThumbnailUrl} from '@/functions/urls'
|
import {bookFileUrl, bookThumbnailUrl} from '@/functions/urls'
|
||||||
|
|
@ -488,7 +488,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
readRouteName(): string {
|
readRouteName(): string {
|
||||||
return getBookReadRouteFromMediaProfile(this.book.media.mediaProfile)
|
return getBookReadRouteFromMedia(this.book.media)
|
||||||
},
|
},
|
||||||
isAdmin(): boolean {
|
isAdmin(): boolean {
|
||||||
return this.$store.getters.meAdmin
|
return this.$store.getters.meAdmin
|
||||||
|
|
|
||||||
|
|
@ -484,7 +484,7 @@ import BookActionsMenu from '@/components/menus/BookActionsMenu.vue'
|
||||||
import ItemCard from '@/components/ItemCard.vue'
|
import ItemCard from '@/components/ItemCard.vue'
|
||||||
import ToolbarSticky from '@/components/bars/ToolbarSticky.vue'
|
import ToolbarSticky from '@/components/bars/ToolbarSticky.vue'
|
||||||
import {groupAuthorsByRole} from '@/functions/authors'
|
import {groupAuthorsByRole} from '@/functions/authors'
|
||||||
import {getBookFormatFromMediaType, getBookReadRouteFromMediaProfile} from '@/functions/book-format'
|
import {getBookFormatFromMediaType, getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||||
import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress'
|
import {getPagesLeft, getReadProgress, getReadProgressPercentage} from '@/functions/book-progress'
|
||||||
import {getBookTitleCompact} from '@/functions/book-title'
|
import {getBookTitleCompact} from '@/functions/book-title'
|
||||||
import {bookFileUrl, seriesThumbnailUrl} from '@/functions/urls'
|
import {bookFileUrl, seriesThumbnailUrl} from '@/functions/urls'
|
||||||
|
|
@ -597,7 +597,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
readRouteName(): string {
|
readRouteName(): string {
|
||||||
return getBookReadRouteFromMediaProfile(this.book.media.mediaProfile)
|
return getBookReadRouteFromMedia(this.book.media)
|
||||||
},
|
},
|
||||||
isAdmin(): boolean {
|
isAdmin(): boolean {
|
||||||
return this.$store.getters.meAdmin
|
return this.$store.getters.meAdmin
|
||||||
|
|
|
||||||
|
|
@ -339,7 +339,7 @@ import {SeriesDto} from '@/types/komga-series'
|
||||||
import jsFileDownloader from 'js-file-downloader'
|
import jsFileDownloader from 'js-file-downloader'
|
||||||
import screenfull from 'screenfull'
|
import screenfull from 'screenfull'
|
||||||
import {ItemTypes} from '@/types/items'
|
import {ItemTypes} from '@/types/items'
|
||||||
import {getBookReadRouteFromMediaProfile} from '@/functions/book-format'
|
import {getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: 'DivinaReader',
|
name: 'DivinaReader',
|
||||||
|
|
@ -742,7 +742,7 @@ export default Vue.extend({
|
||||||
if (!this.$_.isEmpty(this.siblingPrevious)) {
|
if (!this.$_.isEmpty(this.siblingPrevious)) {
|
||||||
this.jumpToPreviousBook = false
|
this.jumpToPreviousBook = false
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: getBookReadRouteFromMediaProfile(this.siblingPrevious.media.mediaProfile),
|
name: getBookReadRouteFromMedia(this.siblingPrevious.media),
|
||||||
params: {bookId: this.siblingPrevious.id.toString()},
|
params: {bookId: this.siblingPrevious.id.toString()},
|
||||||
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
||||||
})
|
})
|
||||||
|
|
@ -754,7 +754,7 @@ export default Vue.extend({
|
||||||
} else {
|
} else {
|
||||||
this.jumpToNextBook = false
|
this.jumpToNextBook = false
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: getBookReadRouteFromMediaProfile(this.siblingNext.media.mediaProfile),
|
name: getBookReadRouteFromMedia(this.siblingNext.media),
|
||||||
params: {bookId: this.siblingNext.id.toString()},
|
params: {bookId: this.siblingNext.id.toString()},
|
||||||
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ import {
|
||||||
import {flattenToc} from '@/functions/toc'
|
import {flattenToc} from '@/functions/toc'
|
||||||
import ShortcutHelpDialog from '@/components/dialogs/ShortcutHelpDialog.vue'
|
import ShortcutHelpDialog from '@/components/dialogs/ShortcutHelpDialog.vue'
|
||||||
import screenfull from 'screenfull'
|
import screenfull from 'screenfull'
|
||||||
import {getBookReadRouteFromMediaProfile} from '@/functions/book-format'
|
import {getBookReadRouteFromMedia} from '@/functions/book-format'
|
||||||
import SettingsSelect from '@/components/SettingsSelect.vue'
|
import SettingsSelect from '@/components/SettingsSelect.vue'
|
||||||
import {createR2Progression, r2ProgressionToReadingPosition} from '@/functions/readium'
|
import {createR2Progression, r2ProgressionToReadingPosition} from '@/functions/readium'
|
||||||
import {debounce} from 'lodash'
|
import {debounce} from 'lodash'
|
||||||
|
|
@ -462,6 +462,9 @@ export default Vue.extend({
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
isRtl(): boolean {
|
||||||
|
return this.effectiveDirection === 'rtl'
|
||||||
|
},
|
||||||
shortcuts(): any {
|
shortcuts(): any {
|
||||||
const shortcuts = [...epubShortcutsSettings, ...epubShortcutsMenus]
|
const shortcuts = [...epubShortcutsSettings, ...epubShortcutsMenus]
|
||||||
if (!this.fixedLayout) shortcuts.push(...epubShortcutsSettingsScroll)
|
if (!this.fixedLayout) shortcuts.push(...epubShortcutsSettingsScroll)
|
||||||
|
|
@ -614,7 +617,7 @@ export default Vue.extend({
|
||||||
if (!this.$_.isEmpty(this.siblingPrevious)) {
|
if (!this.$_.isEmpty(this.siblingPrevious)) {
|
||||||
this.jumpToPreviousBook = false
|
this.jumpToPreviousBook = false
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: getBookReadRouteFromMediaProfile(this.siblingPrevious.media.mediaProfile),
|
name: getBookReadRouteFromMedia(this.siblingPrevious.media),
|
||||||
params: {bookId: this.siblingPrevious.id.toString()},
|
params: {bookId: this.siblingPrevious.id.toString()},
|
||||||
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
||||||
})
|
})
|
||||||
|
|
@ -626,7 +629,7 @@ export default Vue.extend({
|
||||||
} else {
|
} else {
|
||||||
this.jumpToNextBook = false
|
this.jumpToNextBook = false
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: getBookReadRouteFromMediaProfile(this.siblingNext.media.mediaProfile),
|
name: getBookReadRouteFromMedia(this.siblingNext.media),
|
||||||
params: {bookId: this.siblingNext.id.toString()},
|
params: {bookId: this.siblingNext.id.toString()},
|
||||||
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
query: {context: this.context.origin, contextId: this.context.id, incognito: this.incognito.toString()},
|
||||||
})
|
})
|
||||||
|
|
@ -686,8 +689,8 @@ export default Vue.extend({
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.settings.navigationClick) {
|
if (this.settings.navigationClick) {
|
||||||
if (x < this.$vuetify.breakpoint.width / 4) return this.d2Reader.previousPage()
|
if (x < this.$vuetify.breakpoint.width / 4) return this.isRtl ? this.d2Reader.nextPage() : this.d2Reader.previousPage()
|
||||||
if (x > this.$vuetify.breakpoint.width * .75) return this.d2Reader.nextPage()
|
if (x > this.$vuetify.breakpoint.width * .75) return this.isRtl ? this.d2Reader.previousPage() : this.d2Reader.nextPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.toggleToolbars()
|
this.toggleToolbars()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue