Мелкий рефакторинг, добавлено удобочитаемое имя при сохраненнии fb2
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
<q-td key="links" :props="props" class="td-mp" auto-width>
|
<q-td key="links" :props="props" class="td-mp" auto-width>
|
||||||
<div class="break-word" style="width: 75px; font-size: 90%">
|
<div class="break-word" style="width: 75px; font-size: 90%">
|
||||||
<a v-show="isUrl(props.row.url)" :href="props.row.url" target="_blank">Оригинал</a><br>
|
<a v-show="isUrl(props.row.url)" :href="props.row.url" target="_blank">Оригинал</a><br>
|
||||||
<a :href="props.row.path" @click.prevent="downloadBook(props.row.path)">Скачать FB2</a>
|
<a :href="props.row.path" @click.prevent="downloadBook(props.row.path, props.row.fullTitle)">Скачать FB2</a>
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
@@ -237,9 +237,10 @@ class RecentBooksPage extends Vue {
|
|||||||
author,
|
author,
|
||||||
title: `${title}${perc}${textLen}`,
|
title: `${title}${perc}${textLen}`,
|
||||||
},
|
},
|
||||||
descString: `${author}${title}${perc}${textLen}`,
|
descString: `${author}${title}${perc}${textLen}`,//для сортировки
|
||||||
url: book.url,
|
url: book.url,
|
||||||
path: book.path,
|
path: book.path,
|
||||||
|
fullTitle: bt.fullTitle,
|
||||||
key: book.key,
|
key: book.key,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -272,13 +273,18 @@ class RecentBooksPage extends Vue {
|
|||||||
return `${(this.search ? 'Найдено' : 'Всего')} ${len} книг${this.wordEnding(len)}`;
|
return `${(this.search ? 'Найдено' : 'Всего')} ${len} книг${this.wordEnding(len)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async downloadBook(fb2path) {
|
async downloadBook(fb2path, fullTitle) {
|
||||||
try {
|
try {
|
||||||
await readerApi.checkCachedBook(fb2path);
|
await readerApi.checkCachedBook(fb2path);
|
||||||
|
|
||||||
const d = this.$refs.download;
|
const d = this.$refs.download;
|
||||||
d.href = fb2path;
|
d.href = fb2path;
|
||||||
d.download = path.basename(fb2path).substr(0, 10) + '.fb2';
|
try {
|
||||||
|
const fn = utils.makeValidFilename(fullTitle);
|
||||||
|
d.download = fn.substring(0, 100) + '.fb2';
|
||||||
|
} catch(e) {
|
||||||
|
d.download = path.basename(fb2path).substr(0, 10) + '.fb2';
|
||||||
|
}
|
||||||
|
|
||||||
d.click();
|
d.click();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -289,14 +295,6 @@ class RecentBooksPage extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openOriginal(url) {
|
|
||||||
window.open(url, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
openFb2(path) {
|
|
||||||
window.open(path, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleDel(key) {
|
async handleDel(key) {
|
||||||
await bookManager.delRecentBook({key});
|
await bookManager.delRecentBook({key});
|
||||||
//this.updateTableData();//обновление уже происходит Reader.bookManagerEvent
|
//this.updateTableData();//обновление уже происходит Reader.bookManagerEvent
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ class TextPage extends Vue {
|
|||||||
this.meta = bookManager.metaOnly(this.book);
|
this.meta = bookManager.metaOnly(this.book);
|
||||||
const bt = utils.getBookTitle(this.meta.fb2);
|
const bt = utils.getBookTitle(this.meta.fb2);
|
||||||
|
|
||||||
this.title = bt.title;
|
this.title = bt.fullTitle;
|
||||||
|
|
||||||
this.$root.$emit('set-app-title', this.title);
|
this.$root.$emit('set-app-title', this.title);
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ export function getBookTitle(fb2) {
|
|||||||
|
|
||||||
result.bookTitle = _.compact([result.sequenceTitle, fb2.bookTitle]).join(' ');
|
result.bookTitle = _.compact([result.sequenceTitle, fb2.bookTitle]).join(' ');
|
||||||
|
|
||||||
result.title = _.compact([
|
result.fullTitle = _.compact([
|
||||||
result.author,
|
result.author,
|
||||||
result.bookTitle
|
result.bookTitle
|
||||||
]).join(' - ');
|
]).join(' - ');
|
||||||
|
|||||||
Reference in New Issue
Block a user