Compare commits

..

27 Commits

Author SHA1 Message Date
Book Pauk
a4cb3c628e Merge branch 'release/0.11.7-6' 2022-07-14 03:52:44 +07:00
Book Pauk
8492da8a13 Небольшое улучшение 2022-07-14 03:51:59 +07:00
Book Pauk
98d7c64a56 Исправление багов 2022-07-14 03:34:55 +07:00
Book Pauk
25f121e5ed Merge tag '0.11.7-5' into develop
0.11.7-5
2022-07-14 01:57:36 +07:00
Book Pauk
4c8797c99c Merge branch 'release/0.11.7-5' 2022-07-14 01:57:30 +07:00
Book Pauk
1155aa285d Лишние пробелы 2022-07-14 01:57:03 +07:00
Book Pauk
239bbb8263 Добавлено восстановление из архива 2022-07-14 01:55:09 +07:00
Book Pauk
e6b9330108 Добавление работы с архивом 2022-07-14 01:17:09 +07:00
Book Pauk
935b767c2e Поправил поведение buttonActiveClass 2022-07-14 00:31:24 +07:00
Book Pauk
8acf3295b5 Поправил разметку 2022-07-14 00:31:09 +07:00
Book Pauk
48c3a12fa0 Улучшение парсинга плохих fb2 2022-07-14 00:30:27 +07:00
Book Pauk
a1dea514b7 Поправка разметки 2022-07-13 23:47:55 +07:00
Book Pauk
d4788439cb Merge tag '0.11.7-4' into develop
0.11.7-4
2022-07-13 16:38:10 +07:00
Book Pauk
0a60ad354c Merge branch 'release/0.11.7-4' 2022-07-13 16:38:04 +07:00
Book Pauk
c565a20344 Поправки разметки 2022-07-13 16:37:47 +07:00
Book Pauk
735ee88f0b Merge tag '0.11.7-3' into develop
0.11.7-3
2022-07-13 16:34:22 +07:00
Book Pauk
9405ce2cc0 Merge branch 'release/0.11.7-3' 2022-07-13 16:34:16 +07:00
Book Pauk
115277d88a Поправки разметки 2022-07-13 16:34:00 +07:00
Book Pauk
6925c11dbd Merge tag '0.11.7-2' into develop
0.11.7-2
2022-07-13 16:25:11 +07:00
Book Pauk
984d835892 Merge branch 'release/0.11.7-2' 2022-07-13 16:25:05 +07:00
Book Pauk
23353a4960 Улучшен парсинг fb2 2022-07-13 16:23:52 +07:00
Book Pauk
955bcda032 Поправки разметки 2022-07-13 15:01:35 +07:00
Book Pauk
81ad5d7a2c Поправки разметки 2022-07-13 14:47:24 +07:00
Book Pauk
dada7980ec Merge tag '0.11.7-1' into develop
0.11.7-1
2022-07-12 19:23:38 +07:00
Book Pauk
511a308646 Merge branch 'release/0.11.7-1' 2022-07-12 19:23:33 +07:00
Book Pauk
65c8f2cc81 Небольшие поправки на панели, изменена нумерация на обратную 2022-07-12 19:21:26 +07:00
Book Pauk
238c18bc48 Merge tag '0.11.7' into develop
0.11.7
2022-07-12 19:08:35 +07:00
4 changed files with 247 additions and 96 deletions

View File

@@ -998,7 +998,6 @@ class Reader {
classResult = classDisabled; classResult = classDisabled;
break; break;
case 'refresh': case 'refresh':
case 'recentBooks':
if (!this.mostRecentBookReactive) if (!this.mostRecentBookReactive)
classResult = classDisabled; classResult = classDisabled;
break; break;
@@ -1108,6 +1107,7 @@ class Reader {
wasOpened = (wasOpened ? _.cloneDeep(wasOpened) : {}); wasOpened = (wasOpened ? _.cloneDeep(wasOpened) : {});
wasOpened = Object.assign(wasOpened, { wasOpened = Object.assign(wasOpened, {
url: (opts.url !== undefined ? opts.url : wasOpened.url),
path: (opts.path !== undefined ? opts.path : wasOpened.path), path: (opts.path !== undefined ? opts.path : wasOpened.path),
bookPos: (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos), bookPos: (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos),
bookPosSeen: (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen), bookPosSeen: (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen),

View File

@@ -7,6 +7,20 @@
</span> </span>
</template> </template>
<template #buttons>
<div
class="row justify-center items-center"
:class="{'header-button': !archive, 'header-button-pressed': archive}"
@mousedown.stop @click="archiveToggle"
>
<q-icon class="q-mr-xs" name="la la-archive" size="20px" />
<span style="font-size: 90%">Архив</span>
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
{{ (archive ? 'Скрыть архивные' : 'Показать архивные') }}
</q-tooltip>
</div>
</template>
<a ref="download" style="display: none;" target="_blank"></a> <a ref="download" style="display: none;" target="_blank"></a>
<div id="vs-container" ref="vsContainer" class="recent-books-scroll col"> <div id="vs-container" ref="vsContainer" class="recent-books-scroll col">
@@ -39,10 +53,25 @@
</q-tooltip> </q-tooltip>
</q-btn> </q-btn>
<q-input
ref="input"
v-model="search"
class="q-ml-sm q-mt-xs"
outlined dense
style="width: 185px"
bg-color="white"
placeholder="Найти"
@click.stop
>
<template #append>
<q-icon v-if="search !== ''" name="la la-times" class="cursor-pointer" @click.stop="resetSearch" />
</template>
</q-input>
<q-select <q-select
ref="sortMethod" ref="sortMethod"
v-model="sortMethod" v-model="sortMethod"
class="q-ml-md q-mt-xs" class="q-ml-sm q-mt-xs"
:options="sortMethodOptions" :options="sortMethodOptions"
style="width: 180px" style="width: 180px"
bg-color="white" bg-color="white"
@@ -60,21 +89,6 @@
<div style="height: 28px; padding-top: 2px; overflow: hidden" v-html="scope.opt.label" /> <div style="height: 28px; padding-top: 2px; overflow: hidden" v-html="scope.opt.label" />
</template> </template>
</q-select> </q-select>
<q-input
ref="input"
v-model="search"
class="q-ml-sm q-mt-xs"
outlined dense
style="width: 180px"
bg-color="white"
placeholder="Найти"
@click.stop
>
<template #append>
<q-icon v-if="search !== ''" name="la la-times" class="cursor-pointer" @click.stop="resetSearch" />
</template>
</q-input>
</div> </div>
<q-virtual-scroll <q-virtual-scroll
@@ -86,7 +100,7 @@
@virtual-scroll="onScroll" @virtual-scroll="onScroll"
> >
<div class="table-row row" :class="{even: index % 2 > 0, 'active-book': item.active, 'active-parent-book': item.activeParent}"> <div class="table-row row" :class="{even: index % 2 > 0, 'active-book': item.active, 'active-parent-book': item.activeParent}">
<div v-show="item.inGroup" class="row-part column justify-center items-center" style="width: 40px; border-right: 1px solid #cccccc"> <div v-show="item.inGroup" class="row-part column justify-center items-center" style="width: 40px">
<q-icon name="la la-code-branch" size="24px" style="color: green" /> <q-icon name="la la-code-branch" size="24px" style="color: green" />
</div> </div>
@@ -100,58 +114,86 @@
</div> </div>
</div> </div>
<div class="row-part column items-stretch clickable break-word" :style="{ 'width': (350 - 40*(+item.inGroup)) + 'px' }" style="font-size: 75%" @click="loadBook(item)"> <div class="row-part column items-stretch clickable break-word" @click="loadBook(item)">
<div class="row" style="font-size: 80%"> <div
<div class="row justify-center row-info-top" style="width: 30px"> class="col" style="border: 1px solid #cccccc; border-bottom: 0; padding: 4px; line-height: 140%;"
{{ item.num }} :style="{ 'width': (380 - 40*(+item.inGroup)) + 'px' }"
</div> >
<div class="row justify-center row-info-top" style="width: 130px"> <div class="text-green-10" style="font-size: 80%">
Читался: {{ item.touchTime }}
</div>
<div class="row justify-center row-info-top" style="width: 138px">
Загружен: {{ item.loadTime }}
</div>
<div class="row justify-center row-info-top" style="width: 1px">
</div>
</div>
<div class="col q-mt-xs" :style="{ 'width': (340 - 40*(+item.inGroup)) + 'px' }">
<div class="text-green-10" style="font-size: 105%">
{{ item.desc.author }} {{ item.desc.author }}
</div> </div>
<div>{{ item.desc.title }}</div> <div style="font-size: 75%">
<!--div>{{ item.path }}</div--> {{ item.desc.title }}
</div>
</div> </div>
<div class="row q-mt-xs" style="font-size: 80%"> <div class="row" style="font-size: 10px">
<div class="row justify-center row-info-bottom" style="width: 60px"> <div class="row justify-center items-center row-info-top" style="width: 60px">
{{ item.desc.textLen }} {{ item.desc.textLen }}
</div> </div>
<div class="row justify-center row-info-bottom" style="width: 60px">
<div class="row items-center row-info-top" :style="`width: ${(260 - 40*(+item.inGroup))}px; padding: 1px`">
<div class="read-bar" :style="`width: ${100*item.readPart}%`"></div>
</div>
<div class="row justify-center items-center row-info-top" style="width: 59px">
{{ item.desc.perc }} {{ item.desc.perc }}
</div> </div>
<div class="row justify-center row-info-bottom" style="width: 1px"> <div class="row-info-top" style="width: 1px">
</div> </div>
</div> </div>
<div class="read-bar" :style="`width: ${(340 - 40*(+item.inGroup))*item.readPart}px`"></div> <div class="row" style="font-size: 10px" :style="{ 'width': (380 - 40*(+item.inGroup)) + 'px' }">
</div> <div class="row justify-center items-center row-info-bottom" style="width: 30px">
{{ item.num }}
<div class="row-part column justify-center" style="width: 80px; font-size: 75%"> </div>
<div> <div class="col row">
<a v-show="isUrl(item.url)" :href="item.url" target="_blank">Оригинал</a><br><br> <div class="row justify-center items-center row-info-bottom time-info" style="width: 50%">
<a :href="item.path" @click.prevent="downloadBook(item.path, item.fullTitle)">Скачать FB2</a> Загружен: {{ item.loadTime }}
</div>
<div class="row justify-center items-center row-info-bottom time-info" style="width: 50%">
Читался: {{ item.touchTime }}
</div>
</div>
<div class="row-info-bottom" style="width: 1px">
</div>
</div> </div>
</div> </div>
<div class="row-part column justify-center"> <div
<q-btn class="row-part column"
dense style="width: 90px;"
style="width: 30px; height: 30px; padding: 7px 0 7px 0; margin-left: 4px" >
<div
class="col column justify-center"
style="font-size: 75%; padding-left: 6px; border: 1px solid #cccccc; border-left: 0;"
>
<div :style="`margin-top: ${(archive ? 20 : 0)}px`">
<a v-show="isUrl(item.url)" :href="item.url" target="_blank">Оригинал</a><br><br>
<a :href="item.path" @click.prevent="downloadBook(item.path, item.fullTitle)">Скачать FB2</a>
</div>
</div>
<div
class="del-button self-end row justify-center items-center clickable"
@click="handleDel(item.key)" @click="handleDel(item.key)"
> >
<q-icon class="la la-times" size="14px" /> <q-icon class="la la-times" size="12px" />
</q-btn> <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
{{ (archive ? 'Удалить окончательно' : 'Перенести в архив') }}
</q-tooltip>
</div>
<div
v-show="archive"
class="restore-button self-start row justify-center items-center clickable"
@click="handleRestore(item.key)"
>
<q-icon class="la la-arrow-left" size="14px" />
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
Восстановить из архива
</q-tooltip>
</div>
</div> </div>
</div> </div>
</q-virtual-scroll> </q-virtual-scroll>
@@ -196,6 +238,7 @@ class RecentBooksPage {
tableData = []; tableData = [];
sortMethod = ''; sortMethod = '';
showSameBook = false; showSameBook = false;
archive = false;
created() { created() {
this.commit = this.$store.commit; this.commit = this.$store.commit;
@@ -247,7 +290,7 @@ class RecentBooksPage {
//подготовка полей //подготовка полей
for (const book of sorted) { for (const book of sorted) {
if (book.deleted) if ((!this.archive && book.deleted) || (this.archive && book.deleted != 1))
continue; continue;
let d = new Date(); let d = new Date();
@@ -274,6 +317,11 @@ class RecentBooksPage {
const author = (bt.author ? bt.author : (bt.bookTitle ? bt.bookTitle : (book.uploadFileName ? book.uploadFileName : book.url))); const author = (bt.author ? bt.author : (bt.bookTitle ? bt.bookTitle : (book.uploadFileName ? book.uploadFileName : book.url)));
result.push({ result.push({
key: book.key,
url: book.url,
path: book.path,
deleted: book.deleted,
touchTime, touchTime,
loadTime, loadTime,
desc: { desc: {
@@ -283,10 +331,7 @@ class RecentBooksPage {
textLen, textLen,
}, },
readPart, readPart,
url: book.url,
path: book.path,
fullTitle: bt.fullTitle, fullTitle: bt.fullTitle,
key: book.key,
sameBookKey: book.sameBookKey, sameBookKey: book.sameBookKey,
active: (activeBook.key == book.key), active: (activeBook.key == book.key),
activeParent: false, activeParent: false,
@@ -299,12 +344,11 @@ class RecentBooksPage {
} }
//нумерация //нумерация
let num = 0;
result.sort((a, b) => b.loadTimeRaw - a.loadTimeRaw); result.sort((a, b) => b.loadTimeRaw - a.loadTimeRaw);
for (const book of result) { let num = 0;
for (let i = result.length - 1; i >= 0; i--) {
num++; num++;
book.num = num; result[i].num = num;
} }
//фильтрация //фильтрация
@@ -391,6 +435,8 @@ class RecentBooksPage {
//..... //.....
this.tableData = result; this.tableData = result;
this.$refs.virtualScroll.refresh();
} finally { } finally {
this.lock.ret(); this.lock.ret();
} }
@@ -404,7 +450,8 @@ class RecentBooksPage {
wordEnding(num, type = 0) { wordEnding(num, type = 0) {
const endings = [ const endings = [
['ов', '', 'а', 'а', 'а', 'ов', 'ов', 'ов', 'ов', 'ов'], ['ов', '', 'а', 'а', 'а', 'ов', 'ов', 'ов', 'ов', 'ов'],
['й', 'я', 'и', 'и', 'и', 'й', 'й', 'й', 'й', 'й'] ['й', 'я', 'и', 'и', 'и', 'й', 'й', 'й', 'й', 'й'],
['о', '', 'о', 'о', 'о', 'о', 'о', 'о', 'о', 'о']
]; ];
const deci = num % 100; const deci = num % 100;
if (deci > 10 && deci < 20) { if (deci > 10 && deci < 20) {
@@ -416,7 +463,7 @@ class RecentBooksPage {
get header() { get header() {
const len = (this.tableData ? this.tableData.length : 0); 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) { async downloadBook(fb2path, fullTitle) {
@@ -442,15 +489,30 @@ class RecentBooksPage {
} }
async handleDel(key) { async handleDel(key) {
await bookManager.delRecentBook({key}); if (!this.archive) {
//this.updateTableData();//обновление уже происходит Reader.bookManagerEvent await bookManager.delRecentBook({key});
this.$root.notify.info('Перенесено в архив');
if (!bookManager.mostRecentBook()) } else {
this.close(); if (await this.$root.stdDialog.confirm('Подтвердите удаление из архива:', ' ')) {
await bookManager.delRecentBook({key}, 2);
this.$root.notify.info('Удалено безвозвратно');
}
}
} }
loadBook(row) { async handleRestore(key) {
this.$emit('load-book', {url: row.url, path: row.path}); await bookManager.restoreRecentBook({key});
this.$root.notify.info('Восстановлено из архива');
}
async loadBook(item) {
//чтобы не обновлять лишний раз updateTableData
this.inited = false;
if (item.deleted)
await this.handleRestore(item.key);
this.$emit('load-book', {url: item.url, path: item.path});
this.close(); this.close();
} }
@@ -566,6 +628,11 @@ class RecentBooksPage {
]; ];
} }
archiveToggle() {
this.archive = !this.archive;
this.updateTableData();
}
close() { close() {
this.$emit('recent-books-close'); this.$emit('recent-books-close');
} }
@@ -600,11 +667,10 @@ export default vueComponent(RecentBooksPage);
.table-row { .table-row {
min-height: 80px; min-height: 80px;
border-bottom: 1px solid #cccccc;
} }
.row-part { .row-part {
padding: 4px 4px 4px 4px; padding: 4px 0px 4px 0px;
} }
.clickable { .clickable {
@@ -612,18 +678,11 @@ export default vueComponent(RecentBooksPage);
} }
.break-word { .break-word {
line-height: 180%;
overflow-wrap: break-word; overflow-wrap: break-word;
word-wrap: break-word; word-wrap: break-word;
white-space: normal; white-space: normal;
} }
.read-bar {
height: 3px;
background-color: #aaaaaa;
margin-bottom: 2px;
}
.even { .even {
background-color: #f2f2f2; background-color: #f2f2f2;
} }
@@ -644,18 +703,6 @@ export default vueComponent(RecentBooksPage);
transform: rotate(90deg); transform: rotate(90deg);
} }
.row-info-top {
line-height: 110%;
border-left: 1px solid #cccccc;
border-bottom: 1px solid #cccccc;
}
.row-info-bottom {
line-height: 110%;
border: 1px solid #cccccc;
border-right: 0;
}
.tool-button { .tool-button {
min-width: 30px; min-width: 30px;
width: 30px; width: 30px;
@@ -664,4 +711,78 @@ export default vueComponent(RecentBooksPage);
margin: 10px 6px 0px 3px; margin: 10px 6px 0px 3px;
background-color: white; background-color: white;
} }
.row-info-bottom {
line-height: 110%;
border-left: 1px solid #cccccc;
border-bottom: 1px solid #cccccc;
height: 12px;
}
.row-info-top {
line-height: 110%;
border: 1px solid #cccccc;
border-right: 0;
height: 12px;
}
.time-info, .row-info-top {
color: #888888;
}
.read-bar {
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;
}
</style> </style>

View File

@@ -3,6 +3,8 @@ import sax from '../../../../server/core/sax';
import * as utils from '../../../share/utils'; import * as utils from '../../../share/utils';
const maxImageLineCount = 100; const maxImageLineCount = 100;
const maxParaLength = 10000;
const maxParaTextLength = 10000;
// defaults // defaults
const defaultSettings = { const defaultSettings = {
@@ -226,13 +228,26 @@ export default class BookParser {
paraOffset += len; paraOffset += len;
}; };
const growParagraph = (text, len) => { const growParagraph = (text, len, textRaw) => {
//начальный параграф
if (paraIndex < 0) { if (paraIndex < 0) {
newParagraph(); newParagraph();
growParagraph(text, len); growParagraph(text, len);
return; return;
} }
//ограничение на размер куска текста в параграфе
if (textRaw && textRaw.length > maxParaTextLength) {
while (textRaw.length > 0) {
const textPart = textRaw.substring(0, maxParaTextLength);
textRaw = textRaw.substring(maxParaTextLength);
newParagraph();
growParagraph(textPart, textPart.length);
}
return;
}
if (inSubtitle) { if (inSubtitle) {
curSubtitle.title += text; curSubtitle.title += text;
} else if (inTitle) { } else if (inTitle) {
@@ -240,6 +255,14 @@ export default class BookParser {
} }
const p = para[paraIndex]; const p = para[paraIndex];
//ограничение на размер параграфа
if (p.length > maxParaLength) {
newParagraph();
growParagraph(text, len);
return;
}
p.length += len; p.length += len;
p.text += text; p.text += text;
paraOffset += len; paraOffset += len;
@@ -536,7 +559,7 @@ export default class BookParser {
tClose += (center ? '</center>' : ''); tClose += (center ? '</center>' : '');
if (text != ' ') if (text != ' ')
growParagraph(`${tOpen}${text}${tClose}`, text.length); growParagraph(`${tOpen}${text}${tClose}`, text.length, text);
else else
growParagraph(' ', 1); growParagraph(' ', 1);
} }

View File

@@ -433,9 +433,9 @@ class BookManager {
return this.recent[value.key]; return this.recent[value.key];
} }
async delRecentBook(value) { async delRecentBook(value, delFlag = 1) {
const item = this.recent[value.key]; const item = this.recent[value.key];
item.deleted = 1; item.deleted = delFlag;
if (this.recentLastKey == value.key) { if (this.recentLastKey == value.key) {
await this.recentSetLastKey(null); await this.recentSetLastKey(null);
@@ -445,6 +445,13 @@ class BookManager {
this.emit('recent-deleted', value.key); this.emit('recent-deleted', value.key);
} }
async restoreRecentBook(value) {
const item = this.recent[value.key];
item.deleted = 0;
await this.recentSetItem(item);
}
async cleanRecentBooks() { async cleanRecentBooks() {
const sorted = this.getSortedRecent(); const sorted = this.getSortedRecent();