mirror of
https://github.com/gotson/komga.git
synced 2025-12-27 02:46:04 +01:00
feat(webui): display book number in webreader tab title and toolbar
Closes: #1543
This commit is contained in:
parent
dd31f5b062
commit
38fa3ccaa7
4 changed files with 10 additions and 7 deletions
|
|
@ -1,7 +1,10 @@
|
|||
export function getBookTitleCompact (bookTitle: string, seriesTitle: string): string {
|
||||
export function getBookTitleCompact(bookTitle: string, seriesTitle: string, number?: string): string {
|
||||
if (bookTitle?.toLowerCase().includes(seriesTitle?.toLowerCase())) {
|
||||
return bookTitle
|
||||
} else {
|
||||
return `${seriesTitle} - ${bookTitle}`
|
||||
if (number != undefined)
|
||||
return `${seriesTitle} - ${number} - ${bookTitle}`
|
||||
else
|
||||
return `${seriesTitle} - ${bookTitle}`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -660,7 +660,7 @@ export default Vue.extend({
|
|||
.then(v => this.readLists = v)
|
||||
|
||||
if (this.$_.has(this.book, 'metadata.title')) {
|
||||
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.book.seriesTitle)}`
|
||||
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.book.seriesTitle, this.book.oneshot ? undefined : this.book.metadata.number)}`
|
||||
}
|
||||
|
||||
if (this?.context.origin === ContextOrigin.READLIST) {
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ export default Vue.extend({
|
|||
return this.pages.length
|
||||
},
|
||||
bookTitle(): string {
|
||||
return getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)
|
||||
return getBookTitleCompact(this.book.metadata.title, this.series.metadata.title, this.book.oneshot ? undefined : this.book.metadata.number)
|
||||
},
|
||||
readingDirectionText(): string {
|
||||
return this.$t(`enums.reading_direction.${this.readingDirection}`).toString()
|
||||
|
|
@ -673,7 +673,7 @@ export default Vue.extend({
|
|||
this.contextName = (await (this.$komgaReadLists.getOneReadList(this.context.id))).name
|
||||
document.title = `Komga - ${this.contextName} - ${this.book.metadata.title}`
|
||||
} else {
|
||||
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
|
||||
document.title = `Komga - ${this.bookTitle}`
|
||||
}
|
||||
|
||||
// parse query params to get incognito mode
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ export default Vue.extend({
|
|||
},
|
||||
bookTitle(): string {
|
||||
if (!!this.book && !!this.series)
|
||||
return getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)
|
||||
return getBookTitleCompact(this.book.metadata.title, this.series.metadata.title, this.book.oneshot ? undefined : this.book.metadata.number)
|
||||
return this.book?.metadata?.title
|
||||
},
|
||||
appearance: {
|
||||
|
|
@ -715,7 +715,7 @@ export default Vue.extend({
|
|||
document.title = `Komga - ${this.contextName} - ${this.book.metadata.title}`
|
||||
}
|
||||
} else {
|
||||
document.title = `Komga - ${getBookTitleCompact(this.book.metadata.title, this.series.metadata.title)}`
|
||||
document.title = `Komga - ${this.bookTitle}`
|
||||
}
|
||||
|
||||
// parse query params to get incognito mode
|
||||
|
|
|
|||
Loading…
Reference in a new issue