Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d7c039fd4 | ||
|
|
9971f1d4bf | ||
|
|
59702d3d50 | ||
|
|
736e6ec075 | ||
|
|
abdd6d4142 | ||
|
|
16edc85e39 | ||
|
|
bbeb92a9da | ||
|
|
daaf9ac70b | ||
|
|
0805353a9e | ||
|
|
594ff954b1 | ||
|
|
cf5203687e | ||
|
|
55ad2d664d | ||
|
|
4d1485a61f | ||
|
|
f260378c93 | ||
|
|
08f9175705 | ||
|
|
ca7cc322d7 | ||
|
|
a631befdf9 | ||
|
|
b7875644bc | ||
|
|
9d8507a1e4 | ||
|
|
50042aa36d | ||
|
|
d21cf6286a | ||
|
|
27e2f26d5d |
@@ -8,7 +8,7 @@
|
|||||||
<li>кэширование файлов книг на клиенте и на сервере</li>
|
<li>кэширование файлов книг на клиенте и на сервере</li>
|
||||||
<li>открытие книг с локального диска</li>
|
<li>открытие книг с локального диска</li>
|
||||||
<li>плавный скроллинг текста</li>
|
<li>плавный скроллинг текста</li>
|
||||||
<li>анимация перелистывания (скоро)</li>
|
<li>анимация перелистывания</li>
|
||||||
<li>поиск по тексту и копирование фрагмента</li>
|
<li>поиск по тексту и копирование фрагмента</li>
|
||||||
<li>запоминание недавних книг, скачивание книги из читалки в формате fb2</li>
|
<li>запоминание недавних книг, скачивание книги из читалки в формате fb2</li>
|
||||||
<li>управление кликом и с клавиатуры</li>
|
<li>управление кликом и с клавиатуры</li>
|
||||||
|
|||||||
@@ -133,12 +133,16 @@ export default @Component({
|
|||||||
this.loadBook({url: newValue, bookPos: this.routeParamPos});
|
this.loadBook({url: newValue, bookPos: this.routeParamPos});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
settings: function(newValue) {
|
settings: function() {
|
||||||
this.allowUrlParamBookPos = newValue.allowUrlParamBookPos;
|
this.loadSettings();
|
||||||
this.copyFullText = newValue.copyFullText;
|
|
||||||
this.showClickMapPage = newValue.showClickMapPage;
|
|
||||||
this.updateRoute();
|
this.updateRoute();
|
||||||
},
|
},
|
||||||
|
loaderActive: function(newValue) {
|
||||||
|
const recent = this.mostRecentBook();
|
||||||
|
if (!newValue && !this.loading && recent && !bookManager.hasBookParsed(recent)) {
|
||||||
|
this.loadBook(recent);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
class Reader extends Vue {
|
class Reader extends Vue {
|
||||||
@@ -192,9 +196,7 @@ class Reader extends Vue {
|
|||||||
this.fullScreenActive = (document.fullscreenElement !== null);
|
this.fullScreenActive = (document.fullscreenElement !== null);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.allowUrlParamBookPos = this.settings.allowUrlParamBookPos;
|
this.loadSettings();
|
||||||
this.copyFullText = this.settings.copyFullText;
|
|
||||||
this.showClickMapPage = this.settings.showClickMapPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -205,8 +207,6 @@ class Reader extends Vue {
|
|||||||
if (this.$root.rootRoute == '/reader') {
|
if (this.$root.rootRoute == '/reader') {
|
||||||
if (this.routeParamUrl) {
|
if (this.routeParamUrl) {
|
||||||
this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos});
|
this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos});
|
||||||
} else if (this.mostRecentBook()) {
|
|
||||||
this.loadBook({url: this.mostRecentBook().url});
|
|
||||||
} else {
|
} else {
|
||||||
this.loaderActive = true;
|
this.loaderActive = true;
|
||||||
}
|
}
|
||||||
@@ -215,6 +215,15 @@ class Reader extends Vue {
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadSettings() {
|
||||||
|
const settings = this.settings;
|
||||||
|
this.allowUrlParamBookPos = settings.allowUrlParamBookPos;
|
||||||
|
this.copyFullText = settings.copyFullText;
|
||||||
|
this.showClickMapPage = settings.showClickMapPage;
|
||||||
|
this.clickControl = settings.clickControl;
|
||||||
|
this.blinkCachedLoad = settings.blinkCachedLoad;
|
||||||
|
}
|
||||||
|
|
||||||
get routeParamPos() {
|
get routeParamPos() {
|
||||||
let result = undefined;
|
let result = undefined;
|
||||||
const q = this.$route.query;
|
const q = this.$route.query;
|
||||||
@@ -547,8 +556,8 @@ class Reader extends Vue {
|
|||||||
return classResult;
|
return classResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
async acivateClickMapPage() {
|
async activateClickMapPage() {
|
||||||
if (this.showClickMapPage && !this.clickMapActive) {
|
if (this.clickControl && this.showClickMapPage && !this.clickMapActive) {
|
||||||
this.clickMapActive = true;
|
this.clickMapActive = true;
|
||||||
await this.$refs.clickMapPage.slowDisappear();
|
await this.$refs.clickMapPage.slowDisappear();
|
||||||
this.clickMapActive = false;
|
this.clickMapActive = false;
|
||||||
@@ -653,7 +662,7 @@ class Reader extends Vue {
|
|||||||
progress.hide(); this.progressActive = false;
|
progress.hide(); this.progressActive = false;
|
||||||
this.blinkCachedLoadMessage();
|
this.blinkCachedLoadMessage();
|
||||||
|
|
||||||
await this.acivateClickMapPage();
|
await this.activateClickMapPage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,7 +710,7 @@ class Reader extends Vue {
|
|||||||
} else
|
} else
|
||||||
this.stopBlink = true;
|
this.stopBlink = true;
|
||||||
|
|
||||||
await this.acivateClickMapPage();
|
await this.activateClickMapPage();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
progress.hide(); this.progressActive = false;
|
progress.hide(); this.progressActive = false;
|
||||||
this.loaderActive = true;
|
this.loaderActive = true;
|
||||||
@@ -734,6 +743,9 @@ class Reader extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
blinkCachedLoadMessage() {
|
blinkCachedLoadMessage() {
|
||||||
|
if (!this.blinkCachedLoad)
|
||||||
|
return;
|
||||||
|
|
||||||
this.blinkCount = 30;
|
this.blinkCount = 30;
|
||||||
if (!this.inBlink) {
|
if (!this.inBlink) {
|
||||||
this.inBlink = true;
|
this.inBlink = true;
|
||||||
|
|||||||
@@ -218,11 +218,19 @@
|
|||||||
<div class="partHeader">Анимация</div>
|
<div class="partHeader">Анимация</div>
|
||||||
|
|
||||||
<el-form-item label="Вид">
|
<el-form-item label="Вид">
|
||||||
не готово
|
<el-col :span="11">
|
||||||
|
<el-select v-model="pageChangeAnimation">
|
||||||
|
<el-option label="Нет" value=""></el-option>
|
||||||
|
<el-option label="Снизу вверх" value="downShift"></el-option>
|
||||||
|
<el-option label="Слева направо" value="rightShift"></el-option>
|
||||||
|
<el-option label="Протаивание" value="thaw"></el-option>
|
||||||
|
<el-option label="Мерцание" value="blink"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-col>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="Скорость">
|
<el-form-item label="Скорость">
|
||||||
не готово
|
<el-input-number v-model="pageChangeAnimationSpeed" :min="0" :max="100" :disabled="pageChangeAnimation == ''"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@@ -252,7 +260,16 @@
|
|||||||
<template slot="content">
|
<template slot="content">
|
||||||
Показывать или нет подсказку при каждой загрузке книги
|
Показывать или нет подсказку при каждой загрузке книги
|
||||||
</template>
|
</template>
|
||||||
<el-checkbox v-model="showClickMapPage">Показывать области управления кликом</el-checkbox>
|
<el-checkbox v-model="showClickMapPage" :disabled="!clickControl">Показывать области управления кликом</el-checkbox>
|
||||||
|
</el-tooltip>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="Подсказка">
|
||||||
|
<el-tooltip :open-delay="500" effect="light">
|
||||||
|
<template slot="content">
|
||||||
|
Мерцать сообщением в строке статуса и на кнопке<br>
|
||||||
|
обновления при загрузке книги из кэша
|
||||||
|
</template>
|
||||||
|
<el-checkbox v-model="blinkCachedLoad">Предупреждать о загрузке из кэша</el-checkbox>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="URL">
|
<el-form-item label="URL">
|
||||||
|
|||||||
@@ -1,8 +1,129 @@
|
|||||||
|
import {sleep} from '../../../share/utils';
|
||||||
|
|
||||||
export default class DrawHelper {
|
export default class DrawHelper {
|
||||||
fontBySize(size) {
|
fontBySize(size) {
|
||||||
return `${size}px ${this.fontName}`;
|
return `${size}px ${this.fontName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fontByStyle(style) {
|
||||||
|
return `${style.italic ? 'italic' : this.fontStyle} ${style.bold ? 'bold' : this.fontWeight} ${this.fontSize}px ${this.fontName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
measureText(text, style) {// eslint-disable-line no-unused-vars
|
||||||
|
this.context.font = this.fontByStyle(style);
|
||||||
|
return this.context.measureText(text).width;
|
||||||
|
}
|
||||||
|
|
||||||
|
measureTextFont(text, font) {// eslint-disable-line no-unused-vars
|
||||||
|
this.context.font = font;
|
||||||
|
return this.context.measureText(text).width;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawPage(lines, isScrolling) {
|
||||||
|
if (!this.lastBook || this.pageLineCount < 1 || !this.book || !lines || !this.parsed.textLength)
|
||||||
|
return '';
|
||||||
|
|
||||||
|
const spaceWidth = this.measureText(' ', {});
|
||||||
|
|
||||||
|
let out = `<div class="layout" style="width: ${this.realWidth}px; height: ${this.realHeight}px;` +
|
||||||
|
` color: ${this.textColor}">`;
|
||||||
|
|
||||||
|
let len = lines.length;
|
||||||
|
const lineCount = this.pageLineCount + (isScrolling ? 1 : 0);
|
||||||
|
len = (len > lineCount ? lineCount : len);
|
||||||
|
|
||||||
|
let y = this.fontSize*this.textShift;
|
||||||
|
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
const line = lines[i];
|
||||||
|
/* line:
|
||||||
|
{
|
||||||
|
begin: Number,
|
||||||
|
end: Number,
|
||||||
|
first: Boolean,
|
||||||
|
last: Boolean,
|
||||||
|
parts: array of {
|
||||||
|
style: {bold: Boolean, italic: Boolean, center: Boolean}
|
||||||
|
text: String,
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
let indent = line.first ? this.p : 0;
|
||||||
|
|
||||||
|
let lineText = '';
|
||||||
|
let center = false;
|
||||||
|
let centerStyle = {};
|
||||||
|
for (const part of line.parts) {
|
||||||
|
lineText += part.text;
|
||||||
|
center = center || part.style.center;
|
||||||
|
if (part.style.center)
|
||||||
|
centerStyle = part.style;
|
||||||
|
}
|
||||||
|
|
||||||
|
let filled = false;
|
||||||
|
// если выравнивание по ширине включено
|
||||||
|
if (this.textAlignJustify && !line.last && !center) {
|
||||||
|
const words = lineText.split(' ');
|
||||||
|
|
||||||
|
if (words.length > 1) {
|
||||||
|
const spaceCount = words.length - 1;
|
||||||
|
|
||||||
|
const space = (this.w - line.width + spaceWidth*spaceCount)/spaceCount;
|
||||||
|
|
||||||
|
let x = indent;
|
||||||
|
for (const part of line.parts) {
|
||||||
|
const font = this.fontByStyle(part.style);
|
||||||
|
let partWords = part.text.split(' ');
|
||||||
|
|
||||||
|
for (let j = 0; j < partWords.length; j++) {
|
||||||
|
let f = font;
|
||||||
|
let style = part.style;
|
||||||
|
let word = partWords[j];
|
||||||
|
if (i == 0 && this.searching && word.toLowerCase().indexOf(this.needle) >= 0) {
|
||||||
|
style = Object.assign({}, part.style, {bold: true});
|
||||||
|
f = this.fontByStyle(style);
|
||||||
|
}
|
||||||
|
out += this.fillText(word, x, y, f);
|
||||||
|
x += this.measureText(word, style) + (j < partWords.length - 1 ? space : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// просто выводим текст
|
||||||
|
if (!filled) {
|
||||||
|
let x = indent;
|
||||||
|
x = (center ? (this.w - this.measureText(lineText, centerStyle))/2 : x);
|
||||||
|
for (const part of line.parts) {
|
||||||
|
let font = this.fontByStyle(part.style);
|
||||||
|
|
||||||
|
if (i == 0 && this.searching) {//для поиска, разбивка по словам
|
||||||
|
let partWords = part.text.split(' ');
|
||||||
|
for (let j = 0; j < partWords.length; j++) {
|
||||||
|
let f = font;
|
||||||
|
let style = part.style;
|
||||||
|
let word = partWords[j];
|
||||||
|
if (word.toLowerCase().indexOf(this.needle) >= 0) {
|
||||||
|
style = Object.assign({}, part.style, {bold: true});
|
||||||
|
f = this.fontByStyle(style);
|
||||||
|
}
|
||||||
|
out += this.fillText(word, x, y, f);
|
||||||
|
x += this.measureText(word, style) + (j < partWords.length - 1 ? spaceWidth : 0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
out += this.fillText(part.text, x, y, font);
|
||||||
|
x += this.measureText(part.text, part.style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
y += this.lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
out += '</div>';
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
drawPercentBar(x, y, w, h, font, fontSize, bookPos, textLength) {
|
drawPercentBar(x, y, w, h, font, fontSize, bookPos, textLength) {
|
||||||
const pad = 3;
|
const pad = 3;
|
||||||
const fh = h - 2*pad;
|
const fh = h - 2*pad;
|
||||||
@@ -95,4 +216,75 @@ export default class DrawHelper {
|
|||||||
return `<div style="position: absolute; left: ${x}px; top: ${y}px; ` +
|
return `<div style="position: absolute; left: ${x}px; top: ${y}px; ` +
|
||||||
`width: ${w}px; height: ${h}px; box-sizing: border-box; border: 1px solid ${color}"></div>`;
|
`width: ${w}px; height: ${h}px; box-sizing: border-box; border: 1px solid ${color}"></div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async doPageAnimationThaw(page1, page2, duration, isDown, animation1Finish) {
|
||||||
|
page1.style.animation = `page1-animation-thaw ${duration}ms ease-in 1`;
|
||||||
|
page2.style.animation = `page2-animation-thaw ${duration}ms ease-in 1`;
|
||||||
|
await animation1Finish(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
async doPageAnimationBlink(page1, page2, duration, isDown, animation1Finish, animation2Finish) {
|
||||||
|
page1.style.opacity = '0';
|
||||||
|
page2.style.opacity = '0';
|
||||||
|
page2.style.animation = `page2-animation-thaw ${duration/2}ms ease-out 1`;
|
||||||
|
await animation2Finish(duration/2);
|
||||||
|
|
||||||
|
page1.style.opacity = '1';
|
||||||
|
page1.style.animation = `page1-animation-thaw ${duration/2}ms ease-in 1`;
|
||||||
|
await animation1Finish(duration/2);
|
||||||
|
|
||||||
|
page2.style.opacity = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
async doPageAnimationRightShift(page1, page2, duration, isDown, animation1Finish) {
|
||||||
|
const s = this.w + this.fontSize;
|
||||||
|
|
||||||
|
if (isDown) {
|
||||||
|
page1.style.transform = `translateX(${s}px)`;
|
||||||
|
await sleep(30);
|
||||||
|
|
||||||
|
page1.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page1.style.transform = `translateX(0px)`;
|
||||||
|
|
||||||
|
page2.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page2.style.transform = `translateX(-${s}px)`;
|
||||||
|
await animation1Finish(duration);
|
||||||
|
} else {
|
||||||
|
page1.style.transform = `translateX(-${s}px)`;
|
||||||
|
await sleep(30);
|
||||||
|
|
||||||
|
page1.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page1.style.transform = `translateX(0px)`;
|
||||||
|
|
||||||
|
page2.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page2.style.transform = `translateX(${s}px)`;
|
||||||
|
await animation1Finish(duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async doPageAnimationDownShift(page1, page2, duration, isDown, animation1Finish) {
|
||||||
|
const s = this.h + this.fontSize/2;
|
||||||
|
|
||||||
|
if (isDown) {
|
||||||
|
page1.style.transform = `translateY(${s}px)`;
|
||||||
|
await sleep(30);
|
||||||
|
|
||||||
|
page1.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page1.style.transform = `translateY(0px)`;
|
||||||
|
|
||||||
|
page2.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page2.style.transform = `translateY(-${s}px)`;
|
||||||
|
await animation1Finish(duration);
|
||||||
|
} else {
|
||||||
|
page1.style.transform = `translateY(-${s}px)`;
|
||||||
|
await sleep(30);
|
||||||
|
|
||||||
|
page1.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page1.style.transform = `translateY(0px)`;
|
||||||
|
|
||||||
|
page2.style.transition = `${duration}ms ease-in-out`;
|
||||||
|
page2.style.transform = `translateY(${s}px)`;
|
||||||
|
await animation1Finish(duration);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,15 @@
|
|||||||
<!-- img -->
|
<!-- img -->
|
||||||
</div>
|
</div>
|
||||||
<div ref="scrollBox1" class="layout" style="overflow: hidden" @wheel.prevent.stop="onMouseWheel">
|
<div ref="scrollBox1" class="layout" style="overflow: hidden" @wheel.prevent.stop="onMouseWheel">
|
||||||
<div ref="scrollingPage" class="layout" @transitionend="onScrollingTransitionEnd">
|
<div ref="scrollingPage1" class="layout" @transitionend="onPage1TransitionEnd" @animationend="onPage1AnimationEnd">
|
||||||
<div v-html="page1"></div>
|
<div v-html="page1"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ref="scrollBox2" class="layout" style="overflow: hidden" @wheel.prevent.stop="onMouseWheel">
|
<div ref="scrollBox2" class="layout" style="overflow: hidden" @wheel.prevent.stop="onMouseWheel">
|
||||||
|
<div ref="scrollingPage2" class="layout" @transitionend="onPage2TransitionEnd" @animationend="onPage2AnimationEnd">
|
||||||
<div v-html="page2"></div>
|
<div v-html="page2"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div v-show="showStatusBar" ref="statusBar" class="layout">
|
<div v-show="showStatusBar" ref="statusBar" class="layout">
|
||||||
<div v-html="statusBar"></div>
|
<div v-html="statusBar"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -60,6 +62,9 @@ export default @Component({
|
|||||||
toggleLayout: function() {
|
toggleLayout: function() {
|
||||||
this.updateLayout();
|
this.updateLayout();
|
||||||
},
|
},
|
||||||
|
inAnimation: function() {
|
||||||
|
this.updateLayout();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
class TextPage extends Vue {
|
class TextPage extends Vue {
|
||||||
@@ -81,6 +86,9 @@ class TextPage extends Vue {
|
|||||||
fontStyle = null;
|
fontStyle = null;
|
||||||
fontSize = null;
|
fontSize = null;
|
||||||
fontName = null;
|
fontName = null;
|
||||||
|
fontWeight = null;
|
||||||
|
|
||||||
|
inAnimation = false;
|
||||||
|
|
||||||
meta = null;
|
meta = null;
|
||||||
|
|
||||||
@@ -108,15 +116,20 @@ class TextPage extends Vue {
|
|||||||
this.loadSettings();
|
this.loadSettings();
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
this.debouncedUpdatePage = _.debounce((lines) => {
|
this.debouncedUpdatePage = _.debounce(async(lines) => {
|
||||||
|
if (!this.pageChangeAnimation)
|
||||||
this.toggleLayout = !this.toggleLayout;
|
this.toggleLayout = !this.toggleLayout;
|
||||||
|
else {
|
||||||
|
this.page2 = this.page1;
|
||||||
|
this.toggleLayout = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.toggleLayout)
|
if (this.toggleLayout)
|
||||||
this.page1 = this.drawPage(lines);
|
this.page1 = this.drawHelper.drawPage(lines);
|
||||||
else
|
else
|
||||||
this.page2 = this.drawPage(lines);
|
this.page2 = this.drawHelper.drawPage(lines);
|
||||||
|
|
||||||
this.doPageTransition();
|
await this.doPageAnimation();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
this.$root.$on('resize', () => {this.$nextTick(this.onResize)});
|
this.$root.$on('resize', () => {this.$nextTick(this.onResize)});
|
||||||
@@ -148,16 +161,39 @@ class TextPage extends Vue {
|
|||||||
this.lineHeight = this.fontSize + this.lineInterval;
|
this.lineHeight = this.fontSize + this.lineInterval;
|
||||||
this.pageLineCount = 1 + Math.floor((this.h - this.fontSize)/this.lineHeight);
|
this.pageLineCount = 1 + Math.floor((this.h - this.fontSize)/this.lineHeight);
|
||||||
|
|
||||||
if (this.parsed) {
|
this.$refs.scrollingPage1.style.width = this.w + 'px';
|
||||||
this.parsed.p = this.p;
|
this.$refs.scrollingPage2.style.width = this.w + 'px';
|
||||||
this.parsed.w = this.w;// px, ширина текста
|
|
||||||
this.parsed.font = this.font;
|
//stuff
|
||||||
this.parsed.wordWrap = this.wordWrap;
|
this.currentAnimation = '';
|
||||||
let t = '';
|
this.pageChangeDirectionDown = true;
|
||||||
while (this.measureText(t, {}) < this.w) t += 'Щ';
|
this.fontShift = this.fontVertShift/100;
|
||||||
this.parsed.maxWordLength = t.length - 1;
|
this.textShift = this.textVertShift/100 + this.fontShift;
|
||||||
this.parsed.measureText = this.measureText;
|
|
||||||
}
|
//drawHelper
|
||||||
|
this.drawHelper.realWidth = this.realWidth;
|
||||||
|
this.drawHelper.realHeight = this.realHeight;
|
||||||
|
this.drawHelper.lastBook = this.lastBook;
|
||||||
|
this.drawHelper.book = this.book;
|
||||||
|
this.drawHelper.parsed = this.parsed;
|
||||||
|
this.drawHelper.pageLineCount = this.pageLineCount;
|
||||||
|
|
||||||
|
this.drawHelper.backgroundColor = this.backgroundColor;
|
||||||
|
this.drawHelper.statusBarColor = this.statusBarColor;
|
||||||
|
this.drawHelper.fontStyle = this.fontStyle;
|
||||||
|
this.drawHelper.fontWeight = this.fontWeight;
|
||||||
|
this.drawHelper.fontSize = this.fontSize;
|
||||||
|
this.drawHelper.fontName = this.fontName;
|
||||||
|
this.drawHelper.fontShift = this.fontShift;
|
||||||
|
this.drawHelper.textColor = this.textColor;
|
||||||
|
this.drawHelper.textShift = this.textShift;
|
||||||
|
this.drawHelper.p = this.p;
|
||||||
|
this.drawHelper.w = this.w;
|
||||||
|
this.drawHelper.h = this.h;
|
||||||
|
this.drawHelper.indentLR = this.indentLR;
|
||||||
|
this.drawHelper.textAlignJustify = this.textAlignJustify;
|
||||||
|
this.drawHelper.lineHeight = this.lineHeight;
|
||||||
|
this.drawHelper.context = this.context;
|
||||||
|
|
||||||
//сообщение "Загрузка шрифтов..."
|
//сообщение "Загрузка шрифтов..."
|
||||||
const flText = 'Загрузка шрифта...';
|
const flText = 'Загрузка шрифта...';
|
||||||
@@ -166,29 +202,25 @@ class TextPage extends Vue {
|
|||||||
fontsLoadingStyle.position = 'absolute';
|
fontsLoadingStyle.position = 'absolute';
|
||||||
fontsLoadingStyle.fontSize = this.fontSize + 'px';
|
fontsLoadingStyle.fontSize = this.fontSize + 'px';
|
||||||
fontsLoadingStyle.top = (this.realHeight/2 - 2*this.fontSize) + 'px';
|
fontsLoadingStyle.top = (this.realHeight/2 - 2*this.fontSize) + 'px';
|
||||||
fontsLoadingStyle.left = (this.realWidth - this.measureText(flText, {}))/2 + 'px';
|
fontsLoadingStyle.left = (this.realWidth - this.drawHelper.measureText(flText, {}))/2 + 'px';
|
||||||
|
|
||||||
//stuff
|
//parsed
|
||||||
this.statusBarColor = this.hex2rgba(this.textColor || '#000000', this.statusBarColorAlpha);
|
if (this.parsed) {
|
||||||
this.currentTransition = '';
|
this.parsed.p = this.p;
|
||||||
this.pageChangeDirectionDown = true;
|
this.parsed.w = this.w;// px, ширина текста
|
||||||
this.fontShift = this.fontVertShift/100;
|
this.parsed.font = this.font;
|
||||||
this.textShift = this.textVertShift/100 + this.fontShift;
|
this.parsed.wordWrap = this.wordWrap;
|
||||||
|
let t = '';
|
||||||
//drawHelper
|
while (this.drawHelper.measureText(t, {}) < this.w) t += 'Щ';
|
||||||
this.drawHelper.realWidth = this.realWidth;
|
this.parsed.maxWordLength = t.length - 1;
|
||||||
this.drawHelper.realHeight = this.realHeight;
|
this.parsed.measureText = this.drawHelper.measureText.bind(this.drawHelper);
|
||||||
|
}
|
||||||
this.drawHelper.backgroundColor = this.backgroundColor;
|
|
||||||
this.drawHelper.statusBarColor = this.statusBarColor;
|
|
||||||
this.drawHelper.fontName = this.fontName;
|
|
||||||
this.drawHelper.fontShift = this.fontShift;
|
|
||||||
this.drawHelper.measureText = this.measureText;
|
|
||||||
this.drawHelper.measureTextFont = this.measureTextFont;
|
|
||||||
|
|
||||||
|
//statusBar
|
||||||
this.$refs.statusBar.style.left = '0px';
|
this.$refs.statusBar.style.left = '0px';
|
||||||
this.$refs.statusBar.style.top = (this.statusBarTop ? 1 : this.realHeight - this.statusBarHeight) + 'px';
|
this.$refs.statusBar.style.top = (this.statusBarTop ? 1 : this.realHeight - this.statusBarHeight) + 'px';
|
||||||
|
|
||||||
|
this.statusBarColor = this.hex2rgba(this.textColor || '#000000', this.statusBarColorAlpha);
|
||||||
this.statusBarClickable = this.drawHelper.statusBarClickable(this.statusBarTop, this.statusBarHeight);
|
this.statusBarClickable = this.drawHelper.statusBarClickable(this.statusBarTop, this.statusBarHeight);
|
||||||
|
|
||||||
//scrolling page
|
//scrolling page
|
||||||
@@ -208,16 +240,6 @@ class TextPage extends Vue {
|
|||||||
page2.style.left = this.indentLR + 'px';
|
page2.style.left = this.indentLR + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
measureText(text, style) {// eslint-disable-line no-unused-vars
|
|
||||||
this.context.font = this.fontByStyle(style);
|
|
||||||
return this.context.measureText(text).width;
|
|
||||||
}
|
|
||||||
|
|
||||||
measureTextFont(text, font) {// eslint-disable-line no-unused-vars
|
|
||||||
this.context.font = font;
|
|
||||||
return this.context.measureText(text).width;
|
|
||||||
}
|
|
||||||
|
|
||||||
async checkLoadedFonts() {
|
async checkLoadedFonts() {
|
||||||
let loaded = await Promise.all(this.fontList.map(font => document.fonts.check(font)));
|
let loaded = await Promise.all(this.fontList.map(font => document.fonts.check(font)));
|
||||||
if (loaded.some(r => !r)) {
|
if (loaded.some(r => !r)) {
|
||||||
@@ -287,18 +309,12 @@ class TextPage extends Vue {
|
|||||||
|
|
||||||
this.draw();
|
this.draw();
|
||||||
|
|
||||||
// шрифты хрен знает когда подгружаются, поэтому
|
// шрифты хрен знает когда подгружаются в div, поэтому
|
||||||
const parsed = this.parsed;
|
const parsed = this.parsed;
|
||||||
if (!parsed.force) {
|
await sleep(5000);
|
||||||
let i = 0;
|
if (this.parsed === parsed) {
|
||||||
parsed.force = true;
|
parsed.force = true;
|
||||||
while (i < 10) {
|
|
||||||
await sleep(1000);
|
|
||||||
if (this.parsed != parsed)
|
|
||||||
break;
|
|
||||||
this.draw();
|
this.draw();
|
||||||
i++;
|
|
||||||
}
|
|
||||||
parsed.force = false;
|
parsed.force = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,7 +339,6 @@ class TextPage extends Vue {
|
|||||||
|
|
||||||
this.linesUp = null;
|
this.linesUp = null;
|
||||||
this.linesDown = null;
|
this.linesDown = null;
|
||||||
this.searching = false;
|
|
||||||
|
|
||||||
this.statusBarMessage = '';
|
this.statusBarMessage = '';
|
||||||
|
|
||||||
@@ -375,7 +390,10 @@ class TextPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLayout() {
|
updateLayout() {
|
||||||
if (this.toggleLayout) {
|
if (this.inAnimation) {
|
||||||
|
this.$refs.scrollBox1.style.visibility = 'visible';
|
||||||
|
this.$refs.scrollBox2.style.visibility = 'visible';
|
||||||
|
} else if (this.toggleLayout) {
|
||||||
this.$refs.scrollBox1.style.visibility = 'visible';
|
this.$refs.scrollBox1.style.visibility = 'visible';
|
||||||
this.$refs.scrollBox2.style.visibility = 'hidden';
|
this.$refs.scrollBox2.style.visibility = 'hidden';
|
||||||
} else {
|
} else {
|
||||||
@@ -407,34 +425,50 @@ class TextPage extends Vue {
|
|||||||
return `${this.fontStyle} ${this.fontWeight} ${this.fontSize}px ${this.fontName}`;
|
return `${this.fontStyle} ${this.fontWeight} ${this.fontSize}px ${this.fontName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
fontByStyle(style) {
|
onPage1TransitionEnd() {
|
||||||
return `${style.italic ? 'italic' : this.fontStyle} ${style.bold ? 'bold' : this.fontWeight} ${this.fontSize}px ${this.fontName}`;
|
if (this.resolveTransition1Finish)
|
||||||
|
this.resolveTransition1Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
onScrollingTransitionEnd() {
|
onPage2TransitionEnd() {
|
||||||
if (this.resolveTransitionFinish)
|
if (this.resolveTransition2Finish)
|
||||||
this.resolveTransitionFinish();
|
this.resolveTransition2Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
startSearch(needle) {
|
startSearch(needle) {
|
||||||
this.needle = '';
|
this.drawHelper.needle = '';
|
||||||
const words = needle.split(' ');
|
const words = needle.split(' ');
|
||||||
for (const word of words) {
|
for (const word of words) {
|
||||||
if (word != '') {
|
if (word != '') {
|
||||||
this.needle = word;
|
this.drawHelper.needle = word;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.searching = true;
|
this.drawHelper.searching = true;
|
||||||
this.draw();
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
stopSearch() {
|
stopSearch() {
|
||||||
this.searching = false;
|
this.drawHelper.searching = false;
|
||||||
this.draw();
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generateWaitingFunc(waitingHandlerName, stopPropertyName) {
|
||||||
|
const func = (timeout) => {
|
||||||
|
return new Promise(async(resolve) => {
|
||||||
|
this[waitingHandlerName] = resolve;
|
||||||
|
let wait = (timeout + 201)/100;
|
||||||
|
while (wait > 0 && !this[stopPropertyName]) {
|
||||||
|
wait--;
|
||||||
|
await sleep(100);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return func;
|
||||||
|
}
|
||||||
|
|
||||||
async startTextScrolling() {
|
async startTextScrolling() {
|
||||||
if (this.doingScrolling || !this.book || !this.parsed.textLength || !this.linesDown || this.pageLineCount < 1 ||
|
if (this.doingScrolling || !this.book || !this.parsed.textLength || !this.linesDown || this.pageLineCount < 1 ||
|
||||||
this.linesDown.length <= this.pageLineCount) {
|
this.linesDown.length <= this.pageLineCount) {
|
||||||
@@ -442,20 +476,13 @@ class TextPage extends Vue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ждем анимацию
|
||||||
|
while (this.inAnimation) await sleep(10);
|
||||||
|
|
||||||
this.stopScrolling = false;
|
this.stopScrolling = false;
|
||||||
this.doingScrolling = true;
|
this.doingScrolling = true;
|
||||||
|
|
||||||
const transitionFinish = (timeout) => {
|
const transitionFinish = this.generateWaitingFunc('resolveTransition1Finish', 'stopScrolling');
|
||||||
return new Promise(async(resolve) => {
|
|
||||||
this.resolveTransitionFinish = resolve;
|
|
||||||
let wait = timeout/100;
|
|
||||||
while (wait > 0 && !this.stopScrolling) {
|
|
||||||
wait--;
|
|
||||||
await sleep(100);
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!this.toggleLayout)
|
if (!this.toggleLayout)
|
||||||
this.page1 = this.page2;
|
this.page1 = this.page2;
|
||||||
@@ -464,7 +491,9 @@ class TextPage extends Vue {
|
|||||||
await sleep(50);
|
await sleep(50);
|
||||||
|
|
||||||
this.cachedPos = -1;
|
this.cachedPos = -1;
|
||||||
const page = this.$refs.scrollingPage;
|
this.draw();
|
||||||
|
|
||||||
|
const page = this.$refs.scrollingPage1;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (!this.stopScrolling) {
|
while (!this.stopScrolling) {
|
||||||
page.style.transition = `${this.scrollingDelay}ms ${this.scrollingType}`;
|
page.style.transition = `${this.scrollingDelay}ms ${this.scrollingType}`;
|
||||||
@@ -476,21 +505,22 @@ class TextPage extends Vue {
|
|||||||
this.stopScrolling = true;
|
this.stopScrolling = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await transitionFinish(this.scrollingDelay + 201);
|
await transitionFinish(this.scrollingDelay);
|
||||||
page.style.transition = '';
|
page.style.transition = '';
|
||||||
page.style.transform = 'none';
|
page.style.transform = 'none';
|
||||||
page.offsetHeight;
|
page.offsetHeight;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
this.resolveTransitionFinish = null;
|
this.resolveTransition1Finish = null;
|
||||||
this.doingScrolling = false;
|
this.doingScrolling = false;
|
||||||
this.$emit('stop-scrolling');
|
this.$emit('stop-scrolling');
|
||||||
|
this.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
async stopTextScrolling() {
|
async stopTextScrolling() {
|
||||||
this.stopScrolling = true;
|
this.stopScrolling = true;
|
||||||
|
|
||||||
const page = this.$refs.scrollingPage;
|
const page = this.$refs.scrollingPage1;
|
||||||
page.style.transition = '';
|
page.style.transition = '';
|
||||||
page.style.transform = 'none';
|
page.style.transform = 'none';
|
||||||
page.offsetHeight;
|
page.offsetHeight;
|
||||||
@@ -499,7 +529,10 @@ class TextPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
draw() {
|
draw() {
|
||||||
|
//scrolling
|
||||||
if (this.doingScrolling) {
|
if (this.doingScrolling) {
|
||||||
|
this.currentAnimation = '';
|
||||||
|
|
||||||
if (this.cachedPos == this.bookPos) {
|
if (this.cachedPos == this.bookPos) {
|
||||||
this.linesDown = this.linesCached.linesDown;
|
this.linesDown = this.linesCached.linesDown;
|
||||||
this.linesUp = this.linesCached.linesUp;
|
this.linesUp = this.linesCached.linesUp;
|
||||||
@@ -508,7 +541,7 @@ class TextPage extends Vue {
|
|||||||
const lines = this.getLines(this.bookPos);
|
const lines = this.getLines(this.bookPos);
|
||||||
this.linesDown = lines.linesDown;
|
this.linesDown = lines.linesDown;
|
||||||
this.linesUp = lines.linesUp;
|
this.linesUp = lines.linesUp;
|
||||||
this.page1 = this.drawPage(lines.linesDown);
|
this.page1 = this.drawHelper.drawPage(lines.linesDown, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//caching next
|
//caching next
|
||||||
@@ -518,7 +551,7 @@ class TextPage extends Vue {
|
|||||||
if (this.linesDown && this.linesDown.length > this.pageLineCount && this.pageLineCount > 0) {
|
if (this.linesDown && this.linesDown.length > this.pageLineCount && this.pageLineCount > 0) {
|
||||||
this.cachedPos = this.linesDown[1].begin;
|
this.cachedPos = this.linesDown[1].begin;
|
||||||
this.linesCached = this.getLines(this.cachedPos);
|
this.linesCached = this.getLines(this.cachedPos);
|
||||||
this.pageCached = this.drawPage(this.linesCached.linesDown);
|
this.pageCached = this.drawHelper.drawPage(this.linesCached.linesDown, true);
|
||||||
}
|
}
|
||||||
this.cachedPageTimer = null;
|
this.cachedPageTimer = null;
|
||||||
}, 20);
|
}, 20);
|
||||||
@@ -527,6 +560,7 @@ class TextPage extends Vue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check
|
||||||
if (this.w < minLayoutWidth) {
|
if (this.w < minLayoutWidth) {
|
||||||
this.page1 = null;
|
this.page1 = null;
|
||||||
this.page2 = null;
|
this.page2 = null;
|
||||||
@@ -539,45 +573,93 @@ class TextPage extends Vue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fast draw prepared
|
||||||
if (this.pageChangeDirectionDown && this.pagePrepared && this.bookPos == this.bookPosPrepared) {
|
if (!this.pageChangeAnimation && this.pageChangeDirectionDown && this.pagePrepared && this.bookPos == this.bookPosPrepared) {
|
||||||
this.toggleLayout = !this.toggleLayout;
|
this.toggleLayout = !this.toggleLayout;
|
||||||
this.linesDown = this.linesDownNext;
|
this.linesDown = this.linesDownNext;
|
||||||
this.linesUp = this.linesUpNext;
|
this.linesUp = this.linesUpNext;
|
||||||
this.doPageTransition();
|
} else {//normal debounced draw
|
||||||
} else {
|
|
||||||
const lines = this.getLines(this.bookPos);
|
const lines = this.getLines(this.bookPos);
|
||||||
this.linesDown = lines.linesDown;
|
this.linesDown = lines.linesDown;
|
||||||
this.linesUp = lines.linesUp;
|
this.linesUp = lines.linesUp;
|
||||||
|
|
||||||
/*if (this.toggleLayout)
|
|
||||||
this.page1 = this.drawPage(lines.linesDown);
|
|
||||||
else
|
|
||||||
this.page2 = this.drawPage(lines.linesDown);*/
|
|
||||||
|
|
||||||
this.debouncedUpdatePage(lines.linesDown);
|
this.debouncedUpdatePage(lines.linesDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pagePrepared = false;
|
this.pagePrepared = false;
|
||||||
|
if (!this.pageChangeAnimation)
|
||||||
this.debouncedPrepareNextPage();
|
this.debouncedPrepareNextPage();
|
||||||
this.debouncedDrawStatusBar();
|
this.debouncedDrawStatusBar();
|
||||||
|
|
||||||
if (this.book && this.linesDown && this.linesDown.length < this.pageLineCount)
|
if (this.book && this.linesDown && this.linesDown.length < this.pageLineCount) {
|
||||||
this.doEnd();
|
this.doEnd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doPageTransition() {
|
onPage1AnimationEnd() {
|
||||||
if (this.currentTransition) {
|
if (this.resolveAnimation1Finish)
|
||||||
//this.currentTransition
|
this.resolveAnimation1Finish();
|
||||||
//this.pageChangeTransitionSpeed
|
|
||||||
//this.pageChangeDirectionDown
|
|
||||||
|
|
||||||
//curr to next transition
|
|
||||||
//пока заглушка
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.currentTransition = '';
|
onPage2AnimationEnd() {
|
||||||
|
if (this.resolveAnimation2Finish)
|
||||||
|
this.resolveAnimation2Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
async doPageAnimation() {
|
||||||
|
if (this.currentAnimation && !this.inAnimation) {
|
||||||
|
this.inAnimation = true;
|
||||||
|
|
||||||
|
const animation1Finish = this.generateWaitingFunc('resolveAnimation1Finish', 'stopAnimation');
|
||||||
|
const animation2Finish = this.generateWaitingFunc('resolveAnimation2Finish', 'stopAnimation');
|
||||||
|
const transition1Finish = this.generateWaitingFunc('resolveTransition1Finish', 'stopAnimation');
|
||||||
|
//const transition2Finish = this.generateWaitingFunc('resolveTransition2Finish', 'stopAnimation');
|
||||||
|
|
||||||
|
const duration = Math.round(3000*(1 - this.pageChangeAnimationSpeed/100));
|
||||||
|
let page1 = this.$refs.scrollingPage1;
|
||||||
|
let page2 = this.$refs.scrollingPage2;
|
||||||
|
|
||||||
|
switch (this.currentAnimation) {
|
||||||
|
case 'thaw':
|
||||||
|
await this.drawHelper.doPageAnimationThaw(page1, page2,
|
||||||
|
duration, this.pageChangeDirectionDown, animation1Finish);
|
||||||
|
break;
|
||||||
|
case 'blink':
|
||||||
|
await this.drawHelper.doPageAnimationBlink(page1, page2,
|
||||||
|
duration, this.pageChangeDirectionDown, animation1Finish, animation2Finish);
|
||||||
|
break;
|
||||||
|
case 'rightShift':
|
||||||
|
await this.drawHelper.doPageAnimationRightShift(page1, page2,
|
||||||
|
duration, this.pageChangeDirectionDown, transition1Finish);
|
||||||
|
break;
|
||||||
|
case 'downShift':
|
||||||
|
await this.drawHelper.doPageAnimationDownShift(page1, page2,
|
||||||
|
duration, this.pageChangeDirectionDown, transition1Finish);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.resolveAnimation1Finish = null;
|
||||||
|
this.resolveAnimation2Finish = null;
|
||||||
|
this.resolveTransition1Finish = null;
|
||||||
|
this.resolveTransition2Finish = null;
|
||||||
|
|
||||||
|
page1.style.animation = '';
|
||||||
|
page2.style.animation = '';
|
||||||
|
|
||||||
|
page1.style.transition = '';
|
||||||
|
page1.style.transform = 'none';
|
||||||
|
page1.offsetHeight;
|
||||||
|
|
||||||
|
page2.style.transition = '';
|
||||||
|
page2.style.transform = 'none';
|
||||||
|
page2.offsetHeight;
|
||||||
|
|
||||||
|
this.currentAnimation = '';
|
||||||
this.pageChangeDirectionDown = false;//true только если PgDown
|
this.pageChangeDirectionDown = false;//true только если PgDown
|
||||||
|
|
||||||
|
this.inAnimation = false;
|
||||||
|
this.stopAnimation = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getLines(bookPos) {
|
getLines(bookPos) {
|
||||||
@@ -590,110 +672,6 @@ class TextPage extends Vue {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
drawPage(lines) {
|
|
||||||
if (!this.lastBook || this.pageLineCount < 1 || !this.book || !lines || !this.parsed.textLength)
|
|
||||||
return '';
|
|
||||||
|
|
||||||
const spaceWidth = this.measureText(' ', {});
|
|
||||||
|
|
||||||
let out = `<div class="layout" style="width: ${this.realWidth}px; height: ${this.realHeight}px;` +
|
|
||||||
` color: ${this.textColor}">`;
|
|
||||||
|
|
||||||
let len = lines.length;
|
|
||||||
len = (len > this.pageLineCount + 1 ? this.pageLineCount + 1 : len);
|
|
||||||
|
|
||||||
let y = this.fontSize*this.textShift;
|
|
||||||
|
|
||||||
for (let i = 0; i < len; i++) {
|
|
||||||
const line = lines[i];
|
|
||||||
/* line:
|
|
||||||
{
|
|
||||||
begin: Number,
|
|
||||||
end: Number,
|
|
||||||
first: Boolean,
|
|
||||||
last: Boolean,
|
|
||||||
parts: array of {
|
|
||||||
style: {bold: Boolean, italic: Boolean, center: Boolean}
|
|
||||||
text: String,
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
let indent = line.first ? this.p : 0;
|
|
||||||
|
|
||||||
let lineText = '';
|
|
||||||
let center = false;
|
|
||||||
let centerStyle = {};
|
|
||||||
for (const part of line.parts) {
|
|
||||||
lineText += part.text;
|
|
||||||
center = center || part.style.center;
|
|
||||||
if (part.style.center)
|
|
||||||
centerStyle = part.style;
|
|
||||||
}
|
|
||||||
|
|
||||||
let filled = false;
|
|
||||||
// если выравнивание по ширине включено
|
|
||||||
if (this.textAlignJustify && !line.last && !center) {
|
|
||||||
const words = lineText.split(' ');
|
|
||||||
|
|
||||||
if (words.length > 1) {
|
|
||||||
const spaceCount = words.length - 1;
|
|
||||||
|
|
||||||
const space = (this.w - line.width + spaceWidth*spaceCount)/spaceCount;
|
|
||||||
|
|
||||||
let x = indent;
|
|
||||||
for (const part of line.parts) {
|
|
||||||
const font = this.fontByStyle(part.style);
|
|
||||||
let partWords = part.text.split(' ');
|
|
||||||
|
|
||||||
for (let j = 0; j < partWords.length; j++) {
|
|
||||||
let f = font;
|
|
||||||
let style = part.style;
|
|
||||||
let word = partWords[j];
|
|
||||||
if (i == 0 && this.searching && word.toLowerCase().indexOf(this.needle) >= 0) {
|
|
||||||
style = Object.assign({}, part.style, {bold: true});
|
|
||||||
f = this.fontByStyle(style);
|
|
||||||
}
|
|
||||||
out += this.drawHelper.fillText(word, x, y, f);
|
|
||||||
x += this.measureText(word, style) + (j < partWords.length - 1 ? space : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// просто выводим текст
|
|
||||||
if (!filled) {
|
|
||||||
let x = indent;
|
|
||||||
x = (center ? (this.w - this.measureText(lineText, centerStyle))/2 : x);
|
|
||||||
for (const part of line.parts) {
|
|
||||||
let font = this.fontByStyle(part.style);
|
|
||||||
|
|
||||||
if (i == 0 && this.searching) {//для поиска, разбивка по словам
|
|
||||||
let partWords = part.text.split(' ');
|
|
||||||
for (let j = 0; j < partWords.length; j++) {
|
|
||||||
let f = font;
|
|
||||||
let style = part.style;
|
|
||||||
let word = partWords[j];
|
|
||||||
if (word.toLowerCase().indexOf(this.needle) >= 0) {
|
|
||||||
style = Object.assign({}, part.style, {bold: true});
|
|
||||||
f = this.fontByStyle(style);
|
|
||||||
}
|
|
||||||
out += this.drawHelper.fillText(word, x, y, f);
|
|
||||||
x += this.measureText(word, style) + (j < partWords.length - 1 ? spaceWidth : 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
out += this.drawHelper.fillText(part.text, x, y, font);
|
|
||||||
x += this.measureText(part.text, part.style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
y += this.lineHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
out += '</div>';
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawStatusBar(message) {
|
drawStatusBar(message) {
|
||||||
if (this.w < minLayoutWidth) {
|
if (this.w < minLayoutWidth) {
|
||||||
this.statusBar = null;
|
this.statusBar = null;
|
||||||
@@ -790,9 +768,9 @@ class TextPage extends Vue {
|
|||||||
this.linesUpNext = lines.linesUp;
|
this.linesUpNext = lines.linesUp;
|
||||||
|
|
||||||
if (this.toggleLayout)
|
if (this.toggleLayout)
|
||||||
this.page2 = this.drawPage(lines.linesDown);//наоборот
|
this.page2 = this.drawHelper.drawPage(lines.linesDown);//наоборот
|
||||||
else
|
else
|
||||||
this.page1 = this.drawPage(lines.linesDown);
|
this.page1 = this.drawHelper.drawPage(lines.linesDown);
|
||||||
|
|
||||||
this.pagePrepared = true;
|
this.pagePrepared = true;
|
||||||
}
|
}
|
||||||
@@ -816,7 +794,7 @@ class TextPage extends Vue {
|
|||||||
if (this.keepLastToFirst)
|
if (this.keepLastToFirst)
|
||||||
i--;
|
i--;
|
||||||
if (i >= 0 && this.linesDown.length >= 2*i) {
|
if (i >= 0 && this.linesDown.length >= 2*i) {
|
||||||
this.currentTransition = this.pageChangeTransition;
|
this.currentAnimation = this.pageChangeAnimation;
|
||||||
this.pageChangeDirectionDown = true;
|
this.pageChangeDirectionDown = true;
|
||||||
this.bookPos = this.linesDown[i].begin;
|
this.bookPos = this.linesDown[i].begin;
|
||||||
} else
|
} else
|
||||||
@@ -831,7 +809,7 @@ class TextPage extends Vue {
|
|||||||
i--;
|
i--;
|
||||||
i = (i > this.linesUp.length - 1 ? this.linesUp.length - 1 : i);
|
i = (i > this.linesUp.length - 1 ? this.linesUp.length - 1 : i);
|
||||||
if (i >= 0 && this.linesUp.length > i) {
|
if (i >= 0 && this.linesUp.length > i) {
|
||||||
this.currentTransition = this.pageChangeTransition;
|
this.currentAnimation = this.pageChangeAnimation;
|
||||||
this.pageChangeDirectionDown = false;
|
this.pageChangeDirectionDown = false;
|
||||||
this.bookPos = this.linesUp[i].begin;
|
this.bookPos = this.linesUp[i].begin;
|
||||||
}
|
}
|
||||||
@@ -839,6 +817,8 @@ class TextPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doHome() {
|
doHome() {
|
||||||
|
this.currentAnimation = this.pageChangeAnimation;
|
||||||
|
this.pageChangeDirectionDown = false;
|
||||||
this.bookPos = 0;
|
this.bookPos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -850,6 +830,8 @@ class TextPage extends Vue {
|
|||||||
if (lines) {
|
if (lines) {
|
||||||
i = this.pageLineCount - 1;
|
i = this.pageLineCount - 1;
|
||||||
i = (i > lines.length - 1 ? lines.length - 1 : i);
|
i = (i > lines.length - 1 ? lines.length - 1 : i);
|
||||||
|
this.currentAnimation = this.pageChangeAnimation;
|
||||||
|
this.pageChangeDirectionDown = true;
|
||||||
this.bookPos = lines[i].begin;
|
this.bookPos = lines[i].begin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1170,4 +1152,13 @@ class TextPage extends Vue {
|
|||||||
background: url("images/paper9.jpg");
|
background: url("images/paper9.jpg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes page1-animation-thaw {
|
||||||
|
0% { opacity: 0; }
|
||||||
|
100% { opacity: 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes page2-animation-thaw {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
100% { opacity: 0; }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ export default class BookParser {
|
|||||||
tClose += (center ? '</center>' : '');
|
tClose += (center ? '</center>' : '');
|
||||||
|
|
||||||
if (path.indexOf('/fictionbook/body/title') == 0) {
|
if (path.indexOf('/fictionbook/body/title') == 0) {
|
||||||
growParagraph(`${tOpen}${text}${tClose}`, text.length, true);
|
growParagraph(`${tOpen}${text}${tClose}`, text.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (path.indexOf('/fictionbook/body/section') == 0) {
|
if (path.indexOf('/fictionbook/body/section') == 0) {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<meta name="description" content="браузерная онлайн-читалка книг из интернета и библиотека">
|
||||||
|
<meta name="keywords" content="библиотека,онлайн,читалка,книги,читать,браузер,интернет">
|
||||||
<title></title>
|
<title></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ const settingDefaults = {
|
|||||||
scrollingDelay: 3000,// замедление, ms
|
scrollingDelay: 3000,// замедление, ms
|
||||||
scrollingType: 'ease-in-out', //linear, ease, ease-in, ease-out, ease-in-out
|
scrollingType: 'ease-in-out', //linear, ease, ease-in, ease-out, ease-in-out
|
||||||
|
|
||||||
pageChangeTransition: '',// '' - нет, downShift, rightShift, thaw - протаивание, blink - мерцание
|
pageChangeAnimation: 'blink',// '' - нет, downShift, rightShift, thaw - протаивание, blink - мерцание
|
||||||
pageChangeTransitionSpeed: 50, //0-100%
|
pageChangeAnimationSpeed: 80, //0-100%
|
||||||
|
|
||||||
allowUrlParamBookPos: false,
|
allowUrlParamBookPos: false,
|
||||||
lazyParseEnabled: false,
|
lazyParseEnabled: false,
|
||||||
@@ -162,6 +162,7 @@ const settingDefaults = {
|
|||||||
clickControl: true,
|
clickControl: true,
|
||||||
cutEmptyParagraphs: false,
|
cutEmptyParagraphs: false,
|
||||||
addEmptyParagraphs: 0,
|
addEmptyParagraphs: 0,
|
||||||
|
blinkCachedLoad: true,
|
||||||
|
|
||||||
fontShifts: {},
|
fontShifts: {},
|
||||||
};
|
};
|
||||||
|
|||||||
43
package-lock.json
generated
43
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Liberama",
|
"name": "Liberama",
|
||||||
"version": "0.1.3",
|
"version": "0.2.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -4477,7 +4477,8 @@
|
|||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"aproba": {
|
"aproba": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
@@ -4498,12 +4499,14 @@
|
|||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"balanced-match": "^1.0.0",
|
"balanced-match": "^1.0.0",
|
||||||
"concat-map": "0.0.1"
|
"concat-map": "0.0.1"
|
||||||
@@ -4518,17 +4521,20 @@
|
|||||||
"code-point-at": {
|
"code-point-at": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"concat-map": {
|
"concat-map": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"console-control-strings": {
|
"console-control-strings": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
@@ -4645,7 +4651,8 @@
|
|||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
@@ -4657,6 +4664,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"number-is-nan": "^1.0.0"
|
"number-is-nan": "^1.0.0"
|
||||||
}
|
}
|
||||||
@@ -4671,6 +4679,7 @@
|
|||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
}
|
}
|
||||||
@@ -4678,12 +4687,14 @@
|
|||||||
"minimist": {
|
"minimist": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"minipass": {
|
"minipass": {
|
||||||
"version": "2.2.4",
|
"version": "2.2.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "^5.1.1",
|
"safe-buffer": "^5.1.1",
|
||||||
"yallist": "^3.0.0"
|
"yallist": "^3.0.0"
|
||||||
@@ -4702,6 +4713,7 @@
|
|||||||
"version": "0.5.1",
|
"version": "0.5.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"minimist": "0.0.8"
|
"minimist": "0.0.8"
|
||||||
}
|
}
|
||||||
@@ -4782,7 +4794,8 @@
|
|||||||
"number-is-nan": {
|
"number-is-nan": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"object-assign": {
|
"object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
@@ -4794,6 +4807,7 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@@ -4879,7 +4893,8 @@
|
|||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"safer-buffer": {
|
"safer-buffer": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
@@ -4915,6 +4930,7 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"code-point-at": "^1.0.0",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^1.0.0",
|
||||||
@@ -4934,6 +4950,7 @@
|
|||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^2.0.0"
|
"ansi-regex": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -4977,12 +4994,14 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"yallist": {
|
"yallist": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Liberama",
|
"name": "Liberama",
|
||||||
"version": "0.1.6",
|
"version": "0.2.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ class BookConverter {
|
|||||||
|
|
||||||
const parsedUrl = new URL(url);
|
const parsedUrl = new URL(url);
|
||||||
if (parsedUrl.hostname == 'samlib.ru' ||
|
if (parsedUrl.hostname == 'samlib.ru' ||
|
||||||
parsedUrl.hostname == 'budclub.ru') {
|
parsedUrl.hostname == 'budclub.ru' ||
|
||||||
|
parsedUrl.hostname == 'zhurnal.lib.ru') {
|
||||||
await fs.writeFile(outputFile, this.convertSamlib(data));
|
await fs.writeFile(outputFile, this.convertSamlib(data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -237,6 +238,8 @@ class BookConverter {
|
|||||||
let node = {_a: pars};
|
let node = {_a: pars};
|
||||||
|
|
||||||
let inPara = false;
|
let inPara = false;
|
||||||
|
let italic = false;
|
||||||
|
let bold = false;
|
||||||
|
|
||||||
const openTag = (name) => {
|
const openTag = (name) => {
|
||||||
if (name == 'p')
|
if (name == 'p')
|
||||||
@@ -249,8 +252,11 @@ class BookConverter {
|
|||||||
const closeTag = (name) => {
|
const closeTag = (name) => {
|
||||||
if (name == 'p')
|
if (name == 'p')
|
||||||
inPara = false;
|
inPara = false;
|
||||||
if (node._n == name && node._p) {
|
if (node._p) {
|
||||||
|
const exact = (node._n == name);
|
||||||
node = node._p;
|
node = node._p;
|
||||||
|
if (!exact)
|
||||||
|
closeTag(name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -283,9 +289,11 @@ class BookConverter {
|
|||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
openTag('emphasis');
|
openTag('emphasis');
|
||||||
|
italic = true;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
openTag('strong');
|
openTag('strong');
|
||||||
|
bold = true;
|
||||||
break;
|
break;
|
||||||
case 'div':
|
case 'div':
|
||||||
if (tail.indexOf('align="center"') >= 0) {
|
if (tail.indexOf('align="center"') >= 0) {
|
||||||
@@ -331,9 +339,11 @@ class BookConverter {
|
|||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
closeTag('emphasis');
|
closeTag('emphasis');
|
||||||
|
italic = false;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
closeTag('strong');
|
closeTag('strong');
|
||||||
|
bold = false;
|
||||||
break;
|
break;
|
||||||
case 'div':
|
case 'div':
|
||||||
if (inSubtitle) {
|
if (inSubtitle) {
|
||||||
@@ -381,8 +391,13 @@ class BookConverter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tOpen = (bold ? '<strong>' : '');
|
||||||
|
tOpen += (italic ? '<emphasis>' : '');
|
||||||
|
let tClose = (italic ? '</emphasis>' : '');
|
||||||
|
tClose += (bold ? '</strong>' : '');
|
||||||
|
|
||||||
if (inText)
|
if (inText)
|
||||||
growParagraph(text);
|
growParagraph(`${tOpen}${text}${tClose}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
sax.parseSync(repSpaces(this.decode(data).toString()), {
|
sax.parseSync(repSpaces(this.decode(data).toString()), {
|
||||||
|
|||||||
Reference in New Issue
Block a user