diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 2b718803..e0e59977 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -998,7 +998,6 @@ class Reader { classResult = classDisabled; break; case 'refresh': - case 'recentBooks': if (!this.mostRecentBookReactive) classResult = classDisabled; break; diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index a287a56e..adbba068 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -7,6 +7,20 @@ + +
@@ -100,12 +114,17 @@
-
-
-
+
+
+
{{ item.desc.author }}
-
{{ item.desc.title }}
+
+ {{ item.desc.title }} +
@@ -113,7 +132,7 @@ {{ item.desc.textLen }}
-
+
@@ -124,7 +143,7 @@
-
+
{{ item.num }}
@@ -141,21 +160,40 @@
-
-
- Оригинал

- Скачать FB2 + -
- - - + + + {{ (archive ? 'Удалить окончательно' : 'Перенести в архив') }} + +
+ +
+ + + Восстановить из архива + +
@@ -200,6 +238,7 @@ class RecentBooksPage { tableData = []; sortMethod = ''; showSameBook = false; + archive = false; created() { this.commit = this.$store.commit; @@ -251,7 +290,7 @@ class RecentBooksPage { //подготовка полей for (const book of sorted) { - if (book.deleted) + if ((!this.archive && book.deleted) || (this.archive && book.deleted != 1)) continue; let d = new Date(); @@ -407,7 +446,8 @@ class RecentBooksPage { wordEnding(num, type = 0) { const endings = [ ['ов', '', 'а', 'а', 'а', 'ов', 'ов', 'ов', 'ов', 'ов'], - ['й', 'я', 'и', 'и', 'и', 'й', 'й', 'й', 'й', 'й'] + ['й', 'я', 'и', 'и', 'и', 'й', 'й', 'й', 'й', 'й'], + ['о', '', 'о', 'о', 'о', 'о', 'о', 'о', 'о', 'о'] ]; const deci = num % 100; if (deci > 10 && deci < 20) { @@ -419,7 +459,7 @@ class RecentBooksPage { get header() { const len = (this.tableData ? this.tableData.length : 0); - return `${(this.search ? 'Найдено' : 'Всего')} ${len} файл${this.wordEnding(len)}`; + return `${(this.search ? `Найден${this.wordEnding(len, 2)}` : 'Всего')} ${len} файл${this.wordEnding(len)}${this.archive ? ' в архиве' : ''}`; } async downloadBook(fb2path, fullTitle) { @@ -445,11 +485,20 @@ class RecentBooksPage { } async handleDel(key) { - await bookManager.delRecentBook({key}); - //this.updateTableData();//обновление уже происходит Reader.bookManagerEvent + if (!this.archive) { + await bookManager.delRecentBook({key}); + this.$root.notify.info('Перенесено в архив'); + } else { + if (await this.$root.stdDialog.confirm('Подтвердите удаление из архива:', ' ')) { + await bookManager.delRecentBook({key}, 2); + this.$root.notify.info('Удалено безвозвратно'); + } + } + } - if (!bookManager.mostRecentBook()) - this.close(); + async handleRestore(key) { + await bookManager.restoreRecentBook({key}); + this.$root.notify.info('Восстановлено из архива'); } loadBook(row) { @@ -569,6 +618,11 @@ class RecentBooksPage { ]; } + archiveToggle() { + this.archive = !this.archive; + this.updateTableData(); + } + close() { this.$emit('recent-books-close'); } @@ -606,7 +660,7 @@ export default vueComponent(RecentBooksPage); } .row-part { - padding: 4px 4px 4px 4px; + padding: 4px 0px 4px 0px; } .clickable { @@ -614,7 +668,6 @@ export default vueComponent(RecentBooksPage); } .break-word { - line-height: 180%; overflow-wrap: break-word; word-wrap: break-word; white-space: normal; @@ -671,4 +724,55 @@ export default vueComponent(RecentBooksPage); height: 4px; background-color: #bbbbbb; } + +.del-button { + width: 25px; + height: 20px; + position: absolute; + border-left: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; + border-radius: 0 0 0 10px; + margin: 1px; +} + +.del-button:hover { + color: white; + background-color: #FF3030; +} + +.restore-button { + width: 25px; + height: 20px; + position: absolute; + border-right: 1px solid #cccccc; + border-bottom: 1px solid #cccccc; + border-radius: 0 0 10px 0; + margin: 1px; +} + +.restore-button:hover { + color: white; + background-color: #00bb00; +} + +.header-button, .header-button-pressed { + width: 80px; + height: 30px; + cursor: pointer; + color: #555555; +} + +.header-button:hover { + color: white; + background-color: #39902F; +} + +.header-button-pressed { + color: black; + background-color: yellow; +} + +.header-button-pressed:hover { + color: black; +} diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 259e0d28..2ff421fb 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -3,6 +3,7 @@ import sax from '../../../../server/core/sax'; import * as utils from '../../../share/utils'; const maxImageLineCount = 100; +const maxParaLength = 10000; const maxParaTextLength = 10000; // defaults @@ -228,6 +229,7 @@ export default class BookParser { }; const growParagraph = (text, len, textRaw) => { + //начальный параграф if (paraIndex < 0) { newParagraph(); growParagraph(text, len); @@ -253,6 +255,14 @@ export default class BookParser { } const p = para[paraIndex]; + + //ограничение на размер параграфа + if (p.length > maxParaLength) { + newParagraph(); + growParagraph(text, len); + return; + } + p.length += len; p.text += text; paraOffset += len; diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 1e232d00..cc7d76f9 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -433,9 +433,9 @@ class BookManager { return this.recent[value.key]; } - async delRecentBook(value) { + async delRecentBook(value, delFlag = 1) { const item = this.recent[value.key]; - item.deleted = 1; + item.deleted = delFlag; if (this.recentLastKey == value.key) { await this.recentSetLastKey(null); @@ -445,6 +445,13 @@ class BookManager { this.emit('recent-deleted', value.key); } + async restoreRecentBook(value) { + const item = this.recent[value.key]; + item.deleted = 0; + + await this.recentSetItem(item); + } + async cleanRecentBooks() { const sorted = this.getSortedRecent();