diff --git a/client/components/Reader/ContentsPage/ContentsPage.vue b/client/components/Reader/ContentsPage/ContentsPage.vue
index 6a8baa24..c880ab48 100644
--- a/client/components/Reader/ContentsPage/ContentsPage.vue
+++ b/client/components/Reader/ContentsPage/ContentsPage.vue
@@ -99,7 +99,7 @@ class ContentsPage extends Vue {
const prepareLabel = (title, bolder = false) => {
let titleParts = title.split('
');
- const textParts = titleParts.filter(v => v).map(v => `
${v.replace(/(<([^>]+)>)/ig, '')}
`);
+ const textParts = titleParts.filter(v => v).map(v => `${utils.removeHtmlTags(v)}
`);
if (bolder && textParts.length > 1)
textParts[0] = `${textParts[0]}`;
return textParts.join('');
@@ -109,7 +109,7 @@ class ContentsPage extends Vue {
const pc = parsed.contents;
const newpc = [];
- //преобразуем не первые разделы body в title-subtitle
+ //преобразуем все, кроме первого, разделы body в title-subtitle
let curSubtitles = [];
let prevBodyIndex = -1;
for (let i = 0; i < pc.length; i++) {
@@ -177,7 +177,6 @@ class ContentsPage extends Vue {
async setBookPos(newValue) {
this.$emit('book-pos-changed', {bookPos: newValue});
- await this.$nextTick();
this.close();
}
diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js
index 328f927e..f368b6be 100644
--- a/client/components/Reader/share/BookParser.js
+++ b/client/components/Reader/share/BookParser.js
@@ -1,6 +1,6 @@
import he from 'he';
import sax from '../../../../server/core/sax';
-import {sleep} from '../../../share/utils';
+import * as utils from '../../../share/utils';
const maxImageLineCount = 100;
@@ -90,7 +90,7 @@ export default class BookParser {
i.onerror = reject;
i.src = `data:${binaryType};base64,${data}`;
- await sleep(30*1000);
+ await utils.sleep(30*1000);
if (!resolved)
reject('Не удалось получить размер изображения');
})().catch(reject); });
@@ -112,7 +112,7 @@ export default class BookParser {
i.onerror = reject;
i.src = src;
- await sleep(30*1000);
+ await utils.sleep(30*1000);
if (!resolved)
reject('Не удалось получить размер изображения');
})().catch(reject); });
@@ -224,6 +224,15 @@ export default class BookParser {
if (path.indexOf('/fictionbook/body') == 0) {
if (tag == 'body') {
+ if (isFirstBody && fb2.annotation) {
+ const ann = fb2.annotation.split('').filter(v => v).map(v => utils.removeHtmlTags(v));
+ ann.forEach(a => {
+ newParagraph(`${a}`, a.length);
+ });
+ if (ann.length)
+ newParagraph(' ', 1);
+ }
+
if (!isFirstBody)
newParagraph(' ', 1);
isFirstBody = false;
@@ -419,7 +428,7 @@ export default class BookParser {
};
const onProgress = async(prog) => {
- await sleep(1);
+ await utils.sleep(1);
callback(prog);
};
@@ -441,7 +450,7 @@ export default class BookParser {
this.textLength = paraOffset;
callback(100);
- await sleep(10);
+ await utils.sleep(10);
return {fb2};
}
diff --git a/client/share/utils.js b/client/share/utils.js
index add984a8..c773159b 100644
--- a/client/share/utils.js
+++ b/client/share/utils.js
@@ -304,3 +304,7 @@ export function userHotKeysObjectSwap(userHotKeys) {
}
return result;
}
+
+export function removeHtmlTags(s) {
+ return s.replace(/(<([^>]+)>)/ig, '');
+}