Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e057b130e9 | ||
|
|
19a0765a1a | ||
|
|
b81cd3240b | ||
|
|
1e6105b076 | ||
|
|
d8d89b3463 | ||
|
|
459564cb2d | ||
|
|
084df35184 | ||
|
|
81912babeb | ||
|
|
3943fc7d95 | ||
|
|
3999dc930c | ||
|
|
d4dea16456 | ||
|
|
ed38cb33a5 | ||
|
|
4cf5a0f4c8 | ||
|
|
8f0d526af2 | ||
|
|
6ca3881841 | ||
|
|
d8e765a04f | ||
|
|
40ff572f94 | ||
|
|
cc4275dc03 | ||
|
|
b387f4a0db | ||
|
|
1a096031c4 | ||
|
|
83a60b4091 | ||
|
|
b292407ec2 | ||
|
|
952c337b76 | ||
|
|
e947b887fe | ||
|
|
bd1e5485d7 | ||
|
|
e095c3318b | ||
|
|
d75a08b519 | ||
|
|
d55a616fe0 | ||
|
|
2146cb3576 | ||
|
|
ae260e74f6 | ||
|
|
355410c03c | ||
|
|
718ad51fac | ||
|
|
4242a8679f | ||
|
|
4ff9ff699b | ||
|
|
7a76673274 | ||
|
|
bd03ca5136 | ||
|
|
b3e1e4b909 | ||
|
|
4bb22183df | ||
|
|
e72f8f4245 | ||
|
|
5b52f48bce | ||
|
|
f07a157a2a | ||
|
|
ca40854106 | ||
|
|
d6a8209b31 | ||
|
|
731e1f1f15 | ||
|
|
b4a2a8fb98 |
@@ -285,7 +285,9 @@ class BookmarkSettings extends BookmarkSettingsProps {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (result && result.value && result.value.toLowerCase() == 'да') {
|
if (result && result.value && result.value.toLowerCase() == 'да') {
|
||||||
this.$emit('do-action', {action: 'setLibs', data: _.cloneDeep(rstore.libsDefaults)});
|
this.$emit('do-action', {action: 'setLibs', data: _.cloneDeep(
|
||||||
|
Object.assign({helpShowed: true}, rstore.libsDefaults)
|
||||||
|
)});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,22 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template slot="buttons">
|
<template slot="buttons">
|
||||||
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="showHelp">
|
|
||||||
<q-icon name="la la-question-circle" size="16px"/>
|
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Справка</q-tooltip>
|
|
||||||
</span>
|
|
||||||
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="fullScreenToggle">
|
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="fullScreenToggle">
|
||||||
<q-icon :name="(fullScreenActive ? 'la la-compress-arrows-alt': 'la la-expand-arrows-alt')" size="16px"/>
|
<q-icon :name="(fullScreenActive ? 'la la-compress-arrows-alt': 'la la-expand-arrows-alt')" size="16px"/>
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">На весь экран</q-tooltip>
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">На весь экран</q-tooltip>
|
||||||
</span>
|
</span>
|
||||||
|
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="changeScale(0.1)">
|
||||||
|
<q-icon name="la la-plus" size="16px"/>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Увеличить масштаб</q-tooltip>
|
||||||
|
</span>
|
||||||
|
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="changeScale(-0.1)">
|
||||||
|
<q-icon name="la la-minus" size="16px"/>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Уменьшить масштаб</q-tooltip>
|
||||||
|
</span>
|
||||||
|
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="showHelp">
|
||||||
|
<q-icon name="la la-question-circle" size="16px"/>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Справка</q-tooltip>
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div v-show="ready" class="col column" style="min-width: 600px">
|
<div v-show="ready" class="col column" style="min-width: 600px">
|
||||||
@@ -68,8 +76,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
<div class="col fit" style="position: relative;">
|
<div class="col fit" ref="frameBox" style="position: relative;">
|
||||||
<iframe v-if="frameVisible" class="fit" ref="frame" :src="frameSrc" frameborder="0"></iframe>
|
<div ref="frameWrap" class="overflow-hidden">
|
||||||
|
<iframe v-if="frameVisible" ref="frame" :src="frameSrc" frameborder="0"></iframe>
|
||||||
|
</div>
|
||||||
<div v-show="transparentLayoutVisible" ref="transparentLayout" class="fit transparent-layout" @click="transparentLayoutClick"></div>
|
<div v-show="transparentLayoutVisible" ref="transparentLayout" class="fit transparent-layout" @click="transparentLayoutClick"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -149,6 +159,7 @@ import * as lu from './linkUtils';
|
|||||||
|
|
||||||
const proxySubst = {
|
const proxySubst = {
|
||||||
'http://flibusta.is': 'http://b.liberama.top:23480',
|
'http://flibusta.is': 'http://b.liberama.top:23480',
|
||||||
|
'http://fantasy-worlds.org': 'http://b.liberama.top:23580',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default @Component({
|
export default @Component({
|
||||||
@@ -217,12 +228,18 @@ class ExternalLibs extends Vue {
|
|||||||
closeAfterSubmit = false;
|
closeAfterSubmit = false;
|
||||||
openInFrameOnEnter = false;
|
openInFrameOnEnter = false;
|
||||||
openInFrameOnAdd = false;
|
openInFrameOnAdd = false;
|
||||||
|
frameScale = 1;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.oldStartLink = '';
|
this.oldStartLink = '';
|
||||||
this.justOpened = true;
|
this.justOpened = true;
|
||||||
this.$root.addKeyHook(this.keyHook);
|
this.$root.addKeyHook(this.keyHook);
|
||||||
|
|
||||||
|
this.$root.$on('resize', async() => {
|
||||||
|
await utils.sleep(200);
|
||||||
|
this.frameResize();
|
||||||
|
});
|
||||||
|
|
||||||
document.addEventListener('fullscreenchange', () => {
|
document.addEventListener('fullscreenchange', () => {
|
||||||
this.fullScreenActive = (document.fullscreenElement !== null);
|
this.fullScreenActive = (document.fullscreenElement !== null);
|
||||||
});
|
});
|
||||||
@@ -355,11 +372,24 @@ class ExternalLibs extends Vue {
|
|||||||
loadLibs() {
|
loadLibs() {
|
||||||
const libs = this.libs;
|
const libs = this.libs;
|
||||||
|
|
||||||
|
if (!libs.helpShowed) {
|
||||||
|
this.showHelp();
|
||||||
|
(async() => {
|
||||||
|
await utils.sleep(1000);
|
||||||
|
this.commitProp('helpShowed', true);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
this.selectedLink = libs.startLink;
|
this.selectedLink = libs.startLink;
|
||||||
this.closeAfterSubmit = libs.closeAfterSubmit || false;
|
this.closeAfterSubmit = libs.closeAfterSubmit || false;
|
||||||
this.openInFrameOnEnter = libs.openInFrameOnEnter || false;
|
this.openInFrameOnEnter = libs.openInFrameOnEnter || false;
|
||||||
this.openInFrameOnAdd = libs.openInFrameOnAdd || false;
|
this.openInFrameOnAdd = libs.openInFrameOnAdd || false;
|
||||||
|
|
||||||
|
this.frameScale = 1;
|
||||||
|
const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.selectedLink);
|
||||||
|
if (index >= 0)
|
||||||
|
this.frameScale = this.libs.groups[index].frameScale || 1;
|
||||||
|
|
||||||
this.updateStartLink();
|
this.updateStartLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,12 +524,48 @@ class ExternalLibs extends Vue {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.frameVisible = true;
|
this.frameVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.$refs.frame)
|
if (this.$refs.frame) {
|
||||||
this.$refs.frame.contentWindow.focus();
|
this.$refs.frame.contentWindow.focus();
|
||||||
|
this.frameResize();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frameResize() {
|
||||||
|
this.$refs.frameWrap.style = 'width: 1px; height: 1px;';
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.frame) {
|
||||||
|
const w = this.$refs.frameBox.offsetWidth;
|
||||||
|
const h = this.$refs.frameBox.offsetHeight;
|
||||||
|
const normalSize = `width: ${w}px; height: ${h}px;`;
|
||||||
|
this.$refs.frameWrap.style = normalSize;
|
||||||
|
if (this.frameScale != 1) {
|
||||||
|
const s = this.frameScale;
|
||||||
|
this.$refs.frame.style = `width: ${w/s}px; height: ${h/s}px; transform: scale(${s}); transform-origin: 0 0;`;
|
||||||
|
} else {
|
||||||
|
this.$refs.frame.style = normalSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
changeScale(delta) {
|
||||||
|
if ((this.frameScale > 0.1 && delta <= 0) || (this.frameScale < 5 && delta >= 0)) {
|
||||||
|
this.frameScale = _.round(this.frameScale + delta, 1);
|
||||||
|
|
||||||
|
const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.selectedLink);
|
||||||
|
if (index >= 0) {
|
||||||
|
let libs = _.cloneDeep(this.libs);
|
||||||
|
libs.groups[index].frameScale = this.frameScale;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.frameResize();
|
||||||
|
this.$root.notify.success(`Масштаб изменен: ${(this.frameScale*100).toFixed(0)}%`, '', {position: 'bottom-right'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getCommentByLink(list, link) {
|
getCommentByLink(list, link) {
|
||||||
const item = lu.getListItemByLink(list, link);
|
const item = lu.getListItemByLink(list, link);
|
||||||
return (item ? item.c : '');
|
return (item ? item.c : '');
|
||||||
@@ -725,7 +791,7 @@ class ExternalLibs extends Vue {
|
|||||||
что особенно актуально для мобильных устройств.</p>
|
что особенно актуально для мобильных устройств.</p>
|
||||||
|
|
||||||
<p>'Библиотека' разрешает свободный доступ к сайту flibusta.is. Имеется возможность управлять закладками
|
<p>'Библиотека' разрешает свободный доступ к сайту flibusta.is. Имеется возможность управлять закладками
|
||||||
на понравившиеся ресурсы, книги или страницы авторов. Открытие ссылок и навигация осуществляется во фрейме, но,
|
на понравившиеся ресурсы, книги или страницы авторов. Открытие ссылок и навигация происходят во фрейме, но,
|
||||||
к сожалению, в нем открываются не все страницы.
|
к сожалению, в нем открываются не все страницы.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
244
client/components/Reader/ContentsPage/ContentsPage.vue
Normal file
244
client/components/Reader/ContentsPage/ContentsPage.vue
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
<template>
|
||||||
|
<Window width="600px" ref="window" @close="close">
|
||||||
|
<template slot="header">
|
||||||
|
Оглавление/закладки
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="bg-grey-3 row">
|
||||||
|
<q-tabs
|
||||||
|
v-model="selectedTab"
|
||||||
|
active-color="black"
|
||||||
|
active-bg-color="white"
|
||||||
|
indicator-color="white"
|
||||||
|
dense
|
||||||
|
no-caps
|
||||||
|
inline-label
|
||||||
|
class="no-mp bg-grey-4 text-grey-7"
|
||||||
|
>
|
||||||
|
<q-tab name="contents" icon="la la-list" label="Оглавление" />
|
||||||
|
<q-tab name="bookmarks" icon="la la-bookmark" label="Закладки" />
|
||||||
|
</q-tabs>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="q-mb-sm"/>
|
||||||
|
|
||||||
|
<div class="tab-panel" v-show="selectedTab == 'contents'">
|
||||||
|
<div>
|
||||||
|
<div v-for="item in contents" :key="item.key" class="column" style="width: 540px">
|
||||||
|
<div class="row item q-px-sm no-wrap">
|
||||||
|
<div v-if="item.list.length" class="row justify-center items-center expand-button clickable" @click="expandClick(item.key)">
|
||||||
|
<q-icon name="la la-caret-right" class="icon" :class="{'expanded-icon': item.expanded}" color="green-8" size="20px"/>
|
||||||
|
</div>
|
||||||
|
<div v-else class="no-expand-button clickable" @click="setBookPos(item.offset)">
|
||||||
|
<q-icon name="la la-stop" class="icon" style="visibility: hidden" size="20px"/>
|
||||||
|
</div>
|
||||||
|
<div class="col row clickable" @click="setBookPos(item.offset)">
|
||||||
|
<div :style="item.indentStyle"></div>
|
||||||
|
<div class="q-mr-sm col overflow-hidden column justify-center" :style="item.labelStyle" v-html="item.label"></div>
|
||||||
|
<div class="column justify-center">{{ item.perc }}%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="item.expanded" :ref="`subitem${item.key}`" class="subitems-transition">
|
||||||
|
<div v-for="subitem in item.list" :key="subitem.key" class="row subitem q-px-sm no-wrap">
|
||||||
|
<div class="col row clickable" @click="setBookPos(subitem.offset)">
|
||||||
|
<div class="no-expand-button"></div>
|
||||||
|
<div :style="subitem.indentStyle"></div>
|
||||||
|
<div class="q-mr-sm col overflow-hidden column justify-center" :style="item.labelStyle" v-html="subitem.label"></div>
|
||||||
|
<div class="column justify-center">{{ subitem.perc }}%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-panel" v-show="selectedTab == 'bookmarks'">
|
||||||
|
<div class="column justify-center items-center" style="height: 100px">
|
||||||
|
Раздел находится в разработке
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</Window>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
import Vue from 'vue';
|
||||||
|
import Component from 'vue-class-component';
|
||||||
|
//import _ from 'lodash';
|
||||||
|
|
||||||
|
import Window from '../../share/Window.vue';
|
||||||
|
import * as utils from '../../../share/utils';
|
||||||
|
|
||||||
|
export default @Component({
|
||||||
|
components: {
|
||||||
|
Window,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
},
|
||||||
|
})
|
||||||
|
class ContentsPage extends Vue {
|
||||||
|
selectedTab = 'contents';
|
||||||
|
contents = [];
|
||||||
|
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(currentBook, parsed) {
|
||||||
|
this.$refs.window.init();
|
||||||
|
|
||||||
|
//закладки
|
||||||
|
|
||||||
|
//далее формаирование оглавления
|
||||||
|
if (this.parsed == parsed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.parsed = parsed;
|
||||||
|
this.contents = [];
|
||||||
|
await this.$nextTick();
|
||||||
|
|
||||||
|
const pc = parsed.contents;
|
||||||
|
const newpc = [];
|
||||||
|
//преобразуем все, кроме первого, разделы body в title-subtitle
|
||||||
|
let curSubtitles = [];
|
||||||
|
let prevBodyIndex = -1;
|
||||||
|
for (let i = 0; i < pc.length; i++) {
|
||||||
|
const cont = pc[i];
|
||||||
|
if (prevBodyIndex != cont.bodyIndex)
|
||||||
|
curSubtitles = [];
|
||||||
|
|
||||||
|
prevBodyIndex = cont.bodyIndex;
|
||||||
|
|
||||||
|
if (cont.bodyIndex > 1) {
|
||||||
|
if (cont.inset < 1) {
|
||||||
|
newpc.push(Object.assign({}, cont, {subtitles: curSubtitles}));
|
||||||
|
} else {
|
||||||
|
curSubtitles.push(Object.assign({}, cont, {inset: cont.inset - 1}));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newpc.push(cont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const prepareLabel = (title, bolder = false) => {
|
||||||
|
let titleParts = title.split('<p>');
|
||||||
|
const textParts = titleParts.filter(v => v).map(v => `<div>${utils.removeHtmlTags(v)}</div>`);
|
||||||
|
if (bolder && textParts.length > 1)
|
||||||
|
textParts[0] = `<b>${textParts[0]}</b>`;
|
||||||
|
return textParts.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const getIndentStyle = inset => `width: ${inset*20}px`;
|
||||||
|
|
||||||
|
const getLabelStyle = (inset) => {
|
||||||
|
const fontSizes = ['110%', '100%', '90%', '85%'];
|
||||||
|
inset = (inset > 3 ? 3 : inset);
|
||||||
|
return `font-size: ${fontSizes[inset]}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
//формируем newContents
|
||||||
|
let i = 0;
|
||||||
|
const newContents = [];
|
||||||
|
newpc.forEach((cont) => {
|
||||||
|
const label = prepareLabel(cont.title, true);
|
||||||
|
const indentStyle = getIndentStyle(cont.inset);
|
||||||
|
const labelStyle = getLabelStyle(cont.inset);
|
||||||
|
|
||||||
|
let j = 0;
|
||||||
|
const list = [];
|
||||||
|
cont.subtitles.forEach((sub) => {
|
||||||
|
const l = prepareLabel(sub.title);
|
||||||
|
const s = getIndentStyle(sub.inset + 1);
|
||||||
|
const ls = getLabelStyle(cont.inset + 1);
|
||||||
|
const p = parsed.para[sub.paraIndex];
|
||||||
|
list[j] = {perc: (p.offset/parsed.textLength*100).toFixed(2), label: l, key: j, offset: p.offset, indentStyle: s, labelStyle: ls};
|
||||||
|
j++;
|
||||||
|
});
|
||||||
|
|
||||||
|
const p = parsed.para[cont.paraIndex];
|
||||||
|
newContents[i] = {perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, indentStyle, labelStyle, expanded: false, list};
|
||||||
|
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.contents = newContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
async expandClick(key) {
|
||||||
|
const item = this.contents[key];
|
||||||
|
const expanded = !item.expanded;
|
||||||
|
|
||||||
|
if (!expanded) {
|
||||||
|
const subitems = this.$refs[`subitem${key}`][0];
|
||||||
|
subitems.style.height = '0';
|
||||||
|
await utils.sleep(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$set(this.contents, key, Object.assign({}, item, {expanded}));
|
||||||
|
|
||||||
|
if (expanded) {
|
||||||
|
await this.$nextTick();
|
||||||
|
const subitems = this.$refs[`subitem${key}`][0];
|
||||||
|
subitems.style.height = subitems.scrollHeight + 'px';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async setBookPos(newValue) {
|
||||||
|
this.$emit('book-pos-changed', {bookPos: newValue});
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.$emit('do-action', {action: 'contents'});
|
||||||
|
}
|
||||||
|
|
||||||
|
keyHook(event) {
|
||||||
|
if (!this.$root.stdDialog.active && event.type == 'keydown' && event.key == 'Escape') {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tab-panel {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
font-size: 90%;
|
||||||
|
padding: 0 10px 0px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 10px 0 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item, .subitem {
|
||||||
|
border-bottom: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:hover, .subitem:hover {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expand-button, .no-expand-button {
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subitems-transition {
|
||||||
|
height: 0;
|
||||||
|
transition: height 0.2s linear;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expanded-icon {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -48,6 +48,10 @@
|
|||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">{{ rstore.readerActions['refresh'] }}</q-tooltip>
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">{{ rstore.readerActions['refresh'] }}</q-tooltip>
|
||||||
</button>
|
</button>
|
||||||
<div class="space"></div>
|
<div class="space"></div>
|
||||||
|
<button ref="contents" v-show="showToolButton['contents']" class="tool-button" :class="buttonActiveClass('contents')" @click="buttonClick('contents')" v-ripple>
|
||||||
|
<q-icon name="la la-list" size="32px"/>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">{{ rstore.readerActions['contents'] }}</q-tooltip>
|
||||||
|
</button>
|
||||||
<button ref="libs" v-show="mode == 'liberama.top' && showToolButton['libs']" class="tool-button" :class="buttonActiveClass('libs')" @click="buttonClick('libs')" v-ripple>
|
<button ref="libs" v-show="mode == 'liberama.top' && showToolButton['libs']" class="tool-button" :class="buttonActiveClass('libs')" @click="buttonClick('libs')" v-ripple>
|
||||||
<q-icon name="la la-sitemap" size="32px"/>
|
<q-icon name="la la-sitemap" size="32px"/>
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">{{ rstore.readerActions['libs'] }}</q-tooltip>
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">{{ rstore.readerActions['libs'] }}</q-tooltip>
|
||||||
@@ -89,71 +93,15 @@
|
|||||||
@stop-text-search="stopTextSearch">
|
@stop-text-search="stopTextSearch">
|
||||||
</SearchPage>
|
</SearchPage>
|
||||||
<CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
|
<CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
|
||||||
<LibsPage v-show="libsActive" ref="libsPage" @load-book="loadBook" @libs-close="libsClose" @do-action="doAction"></LibsPage>
|
<LibsPage v-show="hidden" ref="libsPage" @load-book="loadBook" @libs-close="libsClose" @do-action="doAction"></LibsPage>
|
||||||
<RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
|
<RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
|
||||||
<SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
|
<SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
|
||||||
<HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
|
<HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
|
||||||
<ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
|
<ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
|
||||||
<ServerStorage v-show="hidden" ref="serverStorage"></ServerStorage>
|
<ServerStorage v-show="hidden" ref="serverStorage"></ServerStorage>
|
||||||
|
<ContentsPage v-show="contentsActive" ref="contentsPage" @do-action="doAction" @book-pos-changed="bookPosChanged"></ContentsPage>
|
||||||
|
|
||||||
<Dialog ref="dialog1" v-model="whatsNewVisible">
|
<ReaderDialogs ref="dialogs" @donate-toggle="donateToggle" @version-history-toggle="versionHistoryToggle"></ReaderDialogs>
|
||||||
<template slot="header">
|
|
||||||
Что нового:
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div style="line-height: 20px" v-html="whatsNewContent"></div>
|
|
||||||
|
|
||||||
<span class="clickable" @click="openVersionHistory">Посмотреть историю версий</span>
|
|
||||||
<span slot="footer">
|
|
||||||
<q-btn class="q-px-md" dense no-caps @click="whatsNewDisable">Больше не показывать</q-btn>
|
|
||||||
</span>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog ref="dialog2" v-model="donationVisible">
|
|
||||||
<template slot="header">
|
|
||||||
Здравствуйте, уважаемые читатели!
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div style="word-break: normal">
|
|
||||||
Стартовала ежегодная акция "Оплатим хостинг вместе".<br><br>
|
|
||||||
|
|
||||||
Для оплаты годового хостинга читалки, необходимо собрать около 2000 рублей.
|
|
||||||
В настоящий момент у автора эта сумма есть в наличии. Однако будет справедливо, если каждый
|
|
||||||
сможет проголосовать рублем за то, чтобы читалка так и оставалась:
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>непрерывно улучшаемой</li>
|
|
||||||
<li>без рекламы</li>
|
|
||||||
<li>без регистрации</li>
|
|
||||||
<li>Open Source</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
Автор также обращается с просьбой о помощи в распространении
|
|
||||||
<a href="https://omnireader.ru" target="_blank">ссылки</a>
|
|
||||||
<q-icon class="copy-icon" name="la la-copy" @click="copyLink('https://omnireader.ru')">
|
|
||||||
<q-tooltip :delay="1000" anchor="top middle" self="center middle" content-style="font-size: 80%">Скопировать</q-tooltip>
|
|
||||||
</q-icon>
|
|
||||||
на читалку через тематические форумы, соцсети, мессенджеры и пр.
|
|
||||||
Чем нас больше, тем легче оставаться на плаву и тем больше мотивации у разработчика, чтобы продолжать работать над проектом.
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
Если соберется бóльшая сумма, то разработка децентрализованной библиотеки для свободного обмена книгами будет по возможности ускорена.
|
|
||||||
<br><br>
|
|
||||||
P.S. При необходимости можно воспользоваться подходящим обменником на <a href="https://www.bestchange.ru" target="_blank">bestchange.ru</a>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
<div class="row justify-center">
|
|
||||||
<q-btn class="q-px-sm" color="primary" dense no-caps rounded @click="openDonate">Помочь проекту</q-btn>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<span slot="footer">
|
|
||||||
<span class="clickable row justify-end" style="font-size: 60%; color: grey" @click="donationDialogDisable">Больше не показывать</span>
|
|
||||||
<br>
|
|
||||||
<q-btn class="q-px-sm" dense no-caps @click="donationDialogRemind">Напомнить позже</q-btn>
|
|
||||||
</span>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -178,13 +126,14 @@ import SettingsPage from './SettingsPage/SettingsPage.vue';
|
|||||||
import HelpPage from './HelpPage/HelpPage.vue';
|
import HelpPage from './HelpPage/HelpPage.vue';
|
||||||
import ClickMapPage from './ClickMapPage/ClickMapPage.vue';
|
import ClickMapPage from './ClickMapPage/ClickMapPage.vue';
|
||||||
import ServerStorage from './ServerStorage/ServerStorage.vue';
|
import ServerStorage from './ServerStorage/ServerStorage.vue';
|
||||||
import Dialog from '../share/Dialog.vue';
|
import ContentsPage from './ContentsPage/ContentsPage.vue';
|
||||||
|
|
||||||
|
import ReaderDialogs from './ReaderDialogs/ReaderDialogs.vue';
|
||||||
|
|
||||||
import bookManager from './share/bookManager';
|
import bookManager from './share/bookManager';
|
||||||
import rstore from '../../store/modules/reader';
|
import rstore from '../../store/modules/reader';
|
||||||
import readerApi from '../../api/reader';
|
import readerApi from '../../api/reader';
|
||||||
import * as utils from '../../share/utils';
|
import * as utils from '../../share/utils';
|
||||||
import {versionHistory} from './versionHistory';
|
|
||||||
|
|
||||||
export default @Component({
|
export default @Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -201,7 +150,9 @@ export default @Component({
|
|||||||
HelpPage,
|
HelpPage,
|
||||||
ClickMapPage,
|
ClickMapPage,
|
||||||
ServerStorage,
|
ServerStorage,
|
||||||
Dialog,
|
ContentsPage,
|
||||||
|
|
||||||
|
ReaderDialogs,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
bookPos: function(newValue) {
|
bookPos: function(newValue) {
|
||||||
@@ -258,6 +209,7 @@ class Reader extends Vue {
|
|||||||
settingsActive = false;
|
settingsActive = false;
|
||||||
helpActive = false;
|
helpActive = false;
|
||||||
clickMapActive = false;
|
clickMapActive = false;
|
||||||
|
contentsActive = false;
|
||||||
|
|
||||||
bookPos = null;
|
bookPos = null;
|
||||||
allowUrlParamBookPos = false;
|
allowUrlParamBookPos = false;
|
||||||
@@ -339,8 +291,7 @@ class Reader extends Vue {
|
|||||||
|
|
||||||
this.updateRoute();
|
this.updateRoute();
|
||||||
|
|
||||||
await this.showWhatsNew();
|
await this.$refs.dialogs.init();
|
||||||
await this.showDonation();
|
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,8 +302,6 @@ class Reader extends Vue {
|
|||||||
this.showClickMapPage = settings.showClickMapPage;
|
this.showClickMapPage = settings.showClickMapPage;
|
||||||
this.clickControl = settings.clickControl;
|
this.clickControl = settings.clickControl;
|
||||||
this.blinkCachedLoad = settings.blinkCachedLoad;
|
this.blinkCachedLoad = settings.blinkCachedLoad;
|
||||||
this.showWhatsNewDialog = settings.showWhatsNewDialog;
|
|
||||||
this.showDonationDialog2020 = settings.showDonationDialog2020;
|
|
||||||
this.showToolButton = settings.showToolButton;
|
this.showToolButton = settings.showToolButton;
|
||||||
this.enableSitesFilter = settings.enableSitesFilter;
|
this.enableSitesFilter = settings.enableSitesFilter;
|
||||||
|
|
||||||
@@ -416,64 +365,6 @@ class Reader extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async showWhatsNew() {
|
|
||||||
await utils.sleep(2000);
|
|
||||||
|
|
||||||
const whatsNew = versionHistory[0];
|
|
||||||
if (this.showWhatsNewDialog &&
|
|
||||||
whatsNew.showUntil >= utils.formatDate(new Date(), 'coDate') &&
|
|
||||||
whatsNew.header != this.whatsNewContentHash) {
|
|
||||||
this.whatsNewContent = 'Версия ' + whatsNew.header + whatsNew.content;
|
|
||||||
this.whatsNewVisible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async showDonation() {
|
|
||||||
await utils.sleep(3000);
|
|
||||||
const today = utils.formatDate(new Date(), 'coDate');
|
|
||||||
|
|
||||||
if ((this.mode == 'omnireader' || this.mode == 'liberama.top') && today < '2020-03-01' && this.showDonationDialog2020 && this.donationRemindDate != today) {
|
|
||||||
this.donationVisible = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
donationDialogDisable() {
|
|
||||||
this.donationVisible = false;
|
|
||||||
if (this.showDonationDialog2020) {
|
|
||||||
const newSettings = Object.assign({}, this.settings, { showDonationDialog2020: false });
|
|
||||||
this.commit('reader/setSettings', newSettings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
donationDialogRemind() {
|
|
||||||
this.donationVisible = false;
|
|
||||||
this.commit('reader/setDonationRemindDate', utils.formatDate(new Date(), 'coDate'));
|
|
||||||
}
|
|
||||||
|
|
||||||
openDonate() {
|
|
||||||
this.donationVisible = false;
|
|
||||||
this.donateToggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
async copyLink(link) {
|
|
||||||
const result = await utils.copyTextToClipboard(link);
|
|
||||||
if (result)
|
|
||||||
this.$root.notify.success(`Ссылка ${link} успешно скопирована в буфер обмена`);
|
|
||||||
else
|
|
||||||
this.$root.notify.error('Копирование не удалось');
|
|
||||||
}
|
|
||||||
|
|
||||||
openVersionHistory() {
|
|
||||||
this.whatsNewVisible = false;
|
|
||||||
this.versionHistoryToggle();
|
|
||||||
}
|
|
||||||
|
|
||||||
whatsNewDisable() {
|
|
||||||
this.whatsNewVisible = false;
|
|
||||||
const whatsNew = versionHistory[0];
|
|
||||||
this.commit('reader/setWhatsNewContentHash', whatsNew.header);
|
|
||||||
}
|
|
||||||
|
|
||||||
get routeParamPos() {
|
get routeParamPos() {
|
||||||
let result = undefined;
|
let result = undefined;
|
||||||
const q = this.$route.query;
|
const q = this.$route.query;
|
||||||
@@ -577,14 +468,6 @@ class Reader extends Vue {
|
|||||||
return this.$store.state.reader.settings;
|
return this.$store.state.reader.settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
get whatsNewContentHash() {
|
|
||||||
return this.$store.state.reader.whatsNewContentHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
get donationRemindDate() {
|
|
||||||
return this.$store.state.reader.donationRemindDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
addAction(pos) {
|
addAction(pos) {
|
||||||
let a = this.actionList;
|
let a = this.actionList;
|
||||||
if (!a.length || a[a.length - 1] != pos) {
|
if (!a.length || a[a.length - 1] != pos) {
|
||||||
@@ -617,6 +500,7 @@ class Reader extends Vue {
|
|||||||
this.stopScrolling();
|
this.stopScrolling();
|
||||||
this.stopSearch();
|
this.stopSearch();
|
||||||
this.helpActive = false;
|
this.helpActive = false;
|
||||||
|
this.contentsActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
loaderToggle() {
|
loaderToggle() {
|
||||||
@@ -730,6 +614,21 @@ class Reader extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contentsPageToggle() {
|
||||||
|
this.contentsActive = !this.contentsActive;
|
||||||
|
const page = this.$refs.page;
|
||||||
|
if (this.contentsActive && this.activePage == 'TextPage' && page.parsed) {
|
||||||
|
this.closeAllWindows();
|
||||||
|
this.contentsActive = true;
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.contentsPage.init(this.mostRecentBook(), page.parsed);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.contentsActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
libsClose() {
|
libsClose() {
|
||||||
if (this.libsActive)
|
if (this.libsActive)
|
||||||
this.libsToogle();
|
this.libsToogle();
|
||||||
@@ -834,6 +733,7 @@ class Reader extends Vue {
|
|||||||
case 'copyText':
|
case 'copyText':
|
||||||
case 'splitToPara':
|
case 'splitToPara':
|
||||||
case 'refresh':
|
case 'refresh':
|
||||||
|
case 'contents':
|
||||||
case 'libs':
|
case 'libs':
|
||||||
case 'recentBooks':
|
case 'recentBooks':
|
||||||
case 'offlineMode':
|
case 'offlineMode':
|
||||||
@@ -862,6 +762,7 @@ class Reader extends Vue {
|
|||||||
case 'scrolling':
|
case 'scrolling':
|
||||||
case 'search':
|
case 'search':
|
||||||
case 'copyText':
|
case 'copyText':
|
||||||
|
case 'contents':
|
||||||
classResult = classDisabled;
|
classResult = classDisabled;
|
||||||
break;
|
break;
|
||||||
case 'splitToPara':
|
case 'splitToPara':
|
||||||
@@ -1153,6 +1054,9 @@ class Reader extends Vue {
|
|||||||
case 'refresh':
|
case 'refresh':
|
||||||
this.refreshBook();
|
this.refreshBook();
|
||||||
break;
|
break;
|
||||||
|
case 'contents':
|
||||||
|
this.contentsPageToggle();
|
||||||
|
break;
|
||||||
case 'libs':
|
case 'libs':
|
||||||
this.libsToogle();
|
this.libsToogle();
|
||||||
break;
|
break;
|
||||||
@@ -1228,9 +1132,12 @@ class Reader extends Vue {
|
|||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
let result = false;
|
let result = false;
|
||||||
if (this.$root.rootRoute() == '/reader') {
|
if (this.$root.rootRoute() == '/reader') {
|
||||||
if (this.$root.stdDialog.active || this.$refs.dialog1.active || this.$refs.dialog2.active)
|
if (this.$root.stdDialog.active)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
result = this.$refs.dialogs.keyHook(event);
|
||||||
|
|
||||||
if (!result && this.helpActive)
|
if (!result && this.helpActive)
|
||||||
result = this.$refs.helpPage.keyHook(event);
|
result = this.$refs.helpPage.keyHook(event);
|
||||||
|
|
||||||
@@ -1249,6 +1156,9 @@ class Reader extends Vue {
|
|||||||
if (!result && this.copyTextActive)
|
if (!result && this.copyTextActive)
|
||||||
result = this.$refs.copyTextPage.keyHook(event);
|
result = this.$refs.copyTextPage.keyHook(event);
|
||||||
|
|
||||||
|
if (!result && this.contentsActive)
|
||||||
|
result = this.$refs.contentsPage.keyHook(event);
|
||||||
|
|
||||||
if (!result && this.$refs.page && this.$refs.page.keyHook)
|
if (!result && this.$refs.page && this.$refs.page.keyHook)
|
||||||
result = this.$refs.page.keyHook(event);
|
result = this.$refs.page.keyHook(event);
|
||||||
|
|
||||||
@@ -1339,16 +1249,4 @@ class Reader extends Vue {
|
|||||||
.clear {
|
.clear {
|
||||||
color: rgba(0,0,0,0);
|
color: rgba(0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.clickable {
|
|
||||||
color: blue;
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.copy-icon {
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 120%;
|
|
||||||
color: blue;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
250
client/components/Reader/ReaderDialogs/ReaderDialogs.vue
Normal file
250
client/components/Reader/ReaderDialogs/ReaderDialogs.vue
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Dialog ref="dialog1" v-model="whatsNewVisible">
|
||||||
|
<template slot="header">
|
||||||
|
Что нового:
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div style="line-height: 20px" v-html="whatsNewContent"></div>
|
||||||
|
|
||||||
|
<span class="clickable" @click="openVersionHistory">Посмотреть историю версий</span>
|
||||||
|
<span slot="footer">
|
||||||
|
<q-btn class="q-px-md" dense no-caps @click="whatsNewDisable">Больше не показывать</q-btn>
|
||||||
|
</span>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog ref="dialog2" v-model="donationVisible">
|
||||||
|
<template slot="header">
|
||||||
|
Здравствуйте, уважаемые читатели!
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div style="word-break: normal">
|
||||||
|
Стартовала ежегодная акция "Оплатим хостинг вместе".<br><br>
|
||||||
|
|
||||||
|
Для оплаты годового хостинга читалки, необходимо собрать около 2000 рублей.
|
||||||
|
В настоящий момент у автора эта сумма есть в наличии. Однако будет справедливо, если каждый
|
||||||
|
сможет проголосовать рублем за то, чтобы читалка так и оставалась:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>непрерывно улучшаемой</li>
|
||||||
|
<li>без рекламы</li>
|
||||||
|
<li>без регистрации</li>
|
||||||
|
<li>Open Source</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Автор также обращается с просьбой о помощи в распространении
|
||||||
|
<a href="https://omnireader.ru" target="_blank">ссылки</a>
|
||||||
|
<q-icon class="copy-icon" name="la la-copy" @click="copyLink('https://omnireader.ru')">
|
||||||
|
<q-tooltip :delay="1000" anchor="top middle" self="center middle" content-style="font-size: 80%">Скопировать</q-tooltip>
|
||||||
|
</q-icon>
|
||||||
|
на читалку через тематические форумы, соцсети, мессенджеры и пр.
|
||||||
|
Чем нас больше, тем легче оставаться на плаву и тем больше мотивации у разработчика, чтобы продолжать работать над проектом.
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
Если соберется бóльшая сумма, то разработка децентрализованной библиотеки для свободного обмена книгами будет по возможности ускорена.
|
||||||
|
<br><br>
|
||||||
|
P.S. При необходимости можно воспользоваться подходящим обменником на <a href="https://www.bestchange.ru" target="_blank">bestchange.ru</a>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<div class="row justify-center">
|
||||||
|
<q-btn class="q-px-sm" color="primary" dense no-caps rounded @click="openDonate">Помочь проекту</q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span slot="footer">
|
||||||
|
<span class="clickable row justify-end" style="font-size: 60%; color: grey" @click="donationDialogDisable">Больше не показывать</span>
|
||||||
|
<br>
|
||||||
|
<q-btn class="q-px-sm" dense no-caps @click="donationDialogRemind">Напомнить позже</q-btn>
|
||||||
|
</span>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog ref="dialog3" v-model="liberamaTopVisible">
|
||||||
|
<template slot="header">
|
||||||
|
Здравствуйте, уважаемые читатели!
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div style="word-break: normal">
|
||||||
|
Создан новый ресурс:<br><br>
|
||||||
|
|
||||||
|
<a href="https://liberama.top" target="_blank">https://liberama.top</a>
|
||||||
|
<br><br>
|
||||||
|
Это клон читалки Omni Reader, но с некоторыми дополнениями, ориентированными в сторону более свободного обмена книгами:
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>добавлено новое окно "Библиотека" для свободного доступа к Флибусте и другим ресурсам по желанию читателя</li>
|
||||||
|
<li>планируется добавить возможность создания подборок книг и обмена ими между пользователями</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Легко мигрировать на новый сайт можно с помощью синхронизации с сервером.
|
||||||
|
О багах и предложениях просьба сообщать на почту <a href="mailto:bookpauk@gmail.com">bookpauk@gmail.com</a><br><br>
|
||||||
|
Спасибо, что вы с нами!
|
||||||
|
<br><br>
|
||||||
|
<div class="row justify-center">
|
||||||
|
<q-btn class="q-px-sm" color="primary" dense no-caps rounded @click="openDonate">Помочь проекту</q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span slot="footer">
|
||||||
|
<q-btn class="q-px-sm" dense no-caps @click="liberamaTopDialogDisable">Больше не показывать</q-btn>
|
||||||
|
</span>
|
||||||
|
</Dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
import Vue from 'vue';
|
||||||
|
import Component from 'vue-class-component';
|
||||||
|
|
||||||
|
import Dialog from '../../share/Dialog.vue';
|
||||||
|
import * as utils from '../../../share/utils';
|
||||||
|
import {versionHistory} from '../versionHistory';
|
||||||
|
|
||||||
|
export default @Component({
|
||||||
|
components: {
|
||||||
|
Dialog
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
settings: function() {
|
||||||
|
this.loadSettings();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
class ReaderDialogs extends Vue {
|
||||||
|
whatsNewVisible = false;
|
||||||
|
whatsNewContent = '';
|
||||||
|
donationVisible = false;
|
||||||
|
liberamaTopVisible = false;
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.commit = this.$store.commit;
|
||||||
|
this.loadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
await this.showWhatsNew();
|
||||||
|
await this.showDonation();
|
||||||
|
await this.showLiberamaTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadSettings() {
|
||||||
|
const settings = this.settings;
|
||||||
|
this.showWhatsNewDialog = settings.showWhatsNewDialog;
|
||||||
|
this.showDonationDialog2020 = settings.showDonationDialog2020;
|
||||||
|
this.showLiberamaTopDialog2020 = settings.showLiberamaTopDialog2020;
|
||||||
|
}
|
||||||
|
|
||||||
|
async showWhatsNew() {
|
||||||
|
const whatsNew = versionHistory[0];
|
||||||
|
if (this.showWhatsNewDialog &&
|
||||||
|
whatsNew.showUntil >= utils.formatDate(new Date(), 'coDate') &&
|
||||||
|
whatsNew.header != this.whatsNewContentHash) {
|
||||||
|
await utils.sleep(2000);
|
||||||
|
this.whatsNewContent = 'Версия ' + whatsNew.header + whatsNew.content;
|
||||||
|
this.whatsNewVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async showDonation() {
|
||||||
|
const today = utils.formatDate(new Date(), 'coDate');
|
||||||
|
|
||||||
|
if ((this.mode == 'omnireader' || this.mode == 'liberama.top') && today < '2020-03-01' && this.showDonationDialog2020 && this.donationRemindDate != today) {
|
||||||
|
await utils.sleep(3000);
|
||||||
|
this.donationVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
donationDialogDisable() {
|
||||||
|
this.donationVisible = false;
|
||||||
|
if (this.showDonationDialog2020) {
|
||||||
|
this.commit('reader/setSettings', { showDonationDialog2020: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
donationDialogRemind() {
|
||||||
|
this.donationVisible = false;
|
||||||
|
this.commit('reader/setDonationRemindDate', utils.formatDate(new Date(), 'coDate'));
|
||||||
|
}
|
||||||
|
|
||||||
|
openDonate() {
|
||||||
|
this.donationVisible = false;
|
||||||
|
this.liberamaTopVisible = false;
|
||||||
|
this.$emit('donate-toggle');
|
||||||
|
}
|
||||||
|
|
||||||
|
async copyLink(link) {
|
||||||
|
const result = await utils.copyTextToClipboard(link);
|
||||||
|
if (result)
|
||||||
|
this.$root.notify.success(`Ссылка ${link} успешно скопирована в буфер обмена`);
|
||||||
|
else
|
||||||
|
this.$root.notify.error('Копирование не удалось');
|
||||||
|
}
|
||||||
|
|
||||||
|
openVersionHistory() {
|
||||||
|
this.whatsNewVisible = false;
|
||||||
|
this.$emit('version-history-toggle');
|
||||||
|
}
|
||||||
|
|
||||||
|
whatsNewDisable() {
|
||||||
|
this.whatsNewVisible = false;
|
||||||
|
const whatsNew = versionHistory[0];
|
||||||
|
this.commit('reader/setWhatsNewContentHash', whatsNew.header);
|
||||||
|
}
|
||||||
|
|
||||||
|
get mode() {
|
||||||
|
return this.$store.state.config.mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
get settings() {
|
||||||
|
return this.$store.state.reader.settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
get whatsNewContentHash() {
|
||||||
|
return this.$store.state.reader.whatsNewContentHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
get donationRemindDate() {
|
||||||
|
return this.$store.state.reader.donationRemindDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
async showLiberamaTop() {
|
||||||
|
const today = utils.formatDate(new Date(), 'coDate');
|
||||||
|
|
||||||
|
if (this.mode == 'omnireader' && today < '2020-12-01' && this.showLiberamaTopDialog2020) {
|
||||||
|
await utils.sleep(3000);
|
||||||
|
this.liberamaTopVisible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
liberamaTopDialogDisable() {
|
||||||
|
this.liberamaTopVisible = false;
|
||||||
|
if (this.showLiberamaTopDialog2020) {
|
||||||
|
this.commit('reader/setSettings', { showLiberamaTopDialog2020: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keyHook() {
|
||||||
|
if (this.$refs.dialog1.active || this.$refs.dialog2.active || this.$refs.dialog3.active)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.clickable {
|
||||||
|
color: blue;
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-icon {
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 120%;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -104,8 +104,12 @@ class UserHotKeys extends UserHotKeysProps {
|
|||||||
this.updateTableData();
|
this.updateTableData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get mode() {
|
||||||
|
return this.$store.state.config.mode;
|
||||||
|
}
|
||||||
|
|
||||||
updateTableData() {
|
updateTableData() {
|
||||||
let result = rstore.hotKeys.map(hk => hk.name);
|
let result = rstore.hotKeys.map(hk => hk.name).filter(name => (this.mode == 'liberama.top' || name != 'libs'));
|
||||||
|
|
||||||
const search = this.search.toLowerCase();
|
const search = this.search.toLowerCase();
|
||||||
const codesIncludeSearch = (action) => {
|
const codesIncludeSearch = (action) => {
|
||||||
|
|||||||
@@ -904,8 +904,7 @@ class TextPage extends Vue {
|
|||||||
if (!this.settingsChanging) {
|
if (!this.settingsChanging) {
|
||||||
this.settingsChanging = true;
|
this.settingsChanging = true;
|
||||||
const newSize = (this.settings.fontSize + 1 < 200 ? this.settings.fontSize + 1 : 100);
|
const newSize = (this.settings.fontSize + 1 < 200 ? this.settings.fontSize + 1 : 100);
|
||||||
const newSettings = Object.assign({}, this.settings, {fontSize: newSize});
|
this.commit('reader/setSettings', {fontSize: newSize});
|
||||||
this.commit('reader/setSettings', newSettings);
|
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
this.settingsChanging = false;
|
this.settingsChanging = false;
|
||||||
}
|
}
|
||||||
@@ -915,8 +914,7 @@ class TextPage extends Vue {
|
|||||||
if (!this.settingsChanging) {
|
if (!this.settingsChanging) {
|
||||||
this.settingsChanging = true;
|
this.settingsChanging = true;
|
||||||
const newSize = (this.settings.fontSize - 1 > 5 ? this.settings.fontSize - 1 : 5);
|
const newSize = (this.settings.fontSize - 1 > 5 ? this.settings.fontSize - 1 : 5);
|
||||||
const newSettings = Object.assign({}, this.settings, {fontSize: newSize});
|
this.commit('reader/setSettings', {fontSize: newSize});
|
||||||
this.commit('reader/setSettings', newSettings);
|
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
this.settingsChanging = false;
|
this.settingsChanging = false;
|
||||||
}
|
}
|
||||||
@@ -926,8 +924,7 @@ class TextPage extends Vue {
|
|||||||
if (!this.settingsChanging) {
|
if (!this.settingsChanging) {
|
||||||
this.settingsChanging = true;
|
this.settingsChanging = true;
|
||||||
const newDelay = (this.settings.scrollingDelay - 50 > 1 ? this.settings.scrollingDelay - 50 : 1);
|
const newDelay = (this.settings.scrollingDelay - 50 > 1 ? this.settings.scrollingDelay - 50 : 1);
|
||||||
const newSettings = Object.assign({}, this.settings, {scrollingDelay: newDelay});
|
this.commit('reader/setSettings', {scrollingDelay: newDelay});
|
||||||
this.commit('reader/setSettings', newSettings);
|
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
this.settingsChanging = false;
|
this.settingsChanging = false;
|
||||||
}
|
}
|
||||||
@@ -937,8 +934,7 @@ class TextPage extends Vue {
|
|||||||
if (!this.settingsChanging) {
|
if (!this.settingsChanging) {
|
||||||
this.settingsChanging = true;
|
this.settingsChanging = true;
|
||||||
const newDelay = (this.settings.scrollingDelay + 50 < 10000 ? this.settings.scrollingDelay + 50 : 10000);
|
const newDelay = (this.settings.scrollingDelay + 50 < 10000 ? this.settings.scrollingDelay + 50 : 10000);
|
||||||
const newSettings = Object.assign({}, this.settings, {scrollingDelay: newDelay});
|
this.commit('reader/setSettings', {scrollingDelay: newDelay});
|
||||||
this.commit('reader/setSettings', newSettings);
|
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
this.settingsChanging = false;
|
this.settingsChanging = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import he from 'he';
|
import he from 'he';
|
||||||
import sax from '../../../../server/core/sax';
|
import sax from '../../../../server/core/sax';
|
||||||
import {sleep} from '../../../share/utils';
|
import * as utils from '../../../share/utils';
|
||||||
|
|
||||||
const maxImageLineCount = 100;
|
const maxImageLineCount = 100;
|
||||||
|
|
||||||
@@ -46,11 +46,21 @@ export default class BookParser {
|
|||||||
let isFirstSection = true;
|
let isFirstSection = true;
|
||||||
let isFirstTitlePara = false;
|
let isFirstTitlePara = false;
|
||||||
|
|
||||||
|
//изображения
|
||||||
this.binary = {};
|
this.binary = {};
|
||||||
let binaryId = '';
|
let binaryId = '';
|
||||||
let binaryType = '';
|
let binaryType = '';
|
||||||
let dimPromises = [];
|
let dimPromises = [];
|
||||||
|
|
||||||
|
//оглавление
|
||||||
|
this.contents = [];
|
||||||
|
let curTitle = {paraIndex: -1, title: '', subtitles: []};
|
||||||
|
let curSubtitle = {paraIndex: -1, title: ''};
|
||||||
|
let inTitle = false;
|
||||||
|
let inSubtitle = false;
|
||||||
|
let sectionLevel = 0;
|
||||||
|
let bodyIndex = 0;
|
||||||
|
|
||||||
let paraIndex = -1;
|
let paraIndex = -1;
|
||||||
let paraOffset = 0;
|
let paraOffset = 0;
|
||||||
let para = []; /*array of
|
let para = []; /*array of
|
||||||
@@ -80,7 +90,7 @@ export default class BookParser {
|
|||||||
i.onerror = reject;
|
i.onerror = reject;
|
||||||
|
|
||||||
i.src = `data:${binaryType};base64,${data}`;
|
i.src = `data:${binaryType};base64,${data}`;
|
||||||
await sleep(30*1000);
|
await utils.sleep(30*1000);
|
||||||
if (!resolved)
|
if (!resolved)
|
||||||
reject('Не удалось получить размер изображения');
|
reject('Не удалось получить размер изображения');
|
||||||
})().catch(reject); });
|
})().catch(reject); });
|
||||||
@@ -102,7 +112,7 @@ export default class BookParser {
|
|||||||
i.onerror = reject;
|
i.onerror = reject;
|
||||||
|
|
||||||
i.src = src;
|
i.src = src;
|
||||||
await sleep(30*1000);
|
await utils.sleep(30*1000);
|
||||||
if (!resolved)
|
if (!resolved)
|
||||||
reject('Не удалось получить размер изображения');
|
reject('Не удалось получить размер изображения');
|
||||||
})().catch(reject); });
|
})().catch(reject); });
|
||||||
@@ -118,6 +128,12 @@ export default class BookParser {
|
|||||||
addIndex: (addIndex ? addIndex : 0),
|
addIndex: (addIndex ? addIndex : 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (inSubtitle) {
|
||||||
|
curSubtitle.title += '<p>';
|
||||||
|
} else if (inTitle) {
|
||||||
|
curTitle.title += '<p>';
|
||||||
|
}
|
||||||
|
|
||||||
para[paraIndex] = p;
|
para[paraIndex] = p;
|
||||||
paraOffset += p.length;
|
paraOffset += p.length;
|
||||||
};
|
};
|
||||||
@@ -129,6 +145,7 @@ export default class BookParser {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const prevParaIndex = paraIndex;
|
||||||
let p = para[paraIndex];
|
let p = para[paraIndex];
|
||||||
paraOffset -= p.length;
|
paraOffset -= p.length;
|
||||||
//добавление пустых (addEmptyParagraphs) параграфов перед текущим
|
//добавление пустых (addEmptyParagraphs) параграфов перед текущим
|
||||||
@@ -143,6 +160,11 @@ export default class BookParser {
|
|||||||
p.offset = paraOffset;
|
p.offset = paraOffset;
|
||||||
para[paraIndex] = p;
|
para[paraIndex] = p;
|
||||||
|
|
||||||
|
if (curTitle.paraIndex == prevParaIndex)
|
||||||
|
curTitle.paraIndex = paraIndex;
|
||||||
|
if (curSubtitle.paraIndex == prevParaIndex)
|
||||||
|
curSubtitle.paraIndex = paraIndex;
|
||||||
|
|
||||||
//уберем начальный пробел
|
//уберем начальный пробел
|
||||||
p.length = 0;
|
p.length = 0;
|
||||||
p.text = p.text.substr(1);
|
p.text = p.text.substr(1);
|
||||||
@@ -151,6 +173,13 @@ export default class BookParser {
|
|||||||
p.length += len;
|
p.length += len;
|
||||||
p.text += text;
|
p.text += text;
|
||||||
|
|
||||||
|
|
||||||
|
if (inSubtitle) {
|
||||||
|
curSubtitle.title += text;
|
||||||
|
} else if (inTitle) {
|
||||||
|
curTitle.title += text;
|
||||||
|
}
|
||||||
|
|
||||||
para[paraIndex] = p;
|
para[paraIndex] = p;
|
||||||
paraOffset += p.length;
|
paraOffset += p.length;
|
||||||
};
|
};
|
||||||
@@ -160,7 +189,7 @@ export default class BookParser {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
tag = elemName;
|
tag = elemName;
|
||||||
path += '/' + elemName;
|
path += '/' + tag;
|
||||||
|
|
||||||
if (tag == 'binary') {
|
if (tag == 'binary') {
|
||||||
let attrs = sax.getAttrsSync(tail);
|
let attrs = sax.getAttrsSync(tail);
|
||||||
@@ -187,7 +216,7 @@ export default class BookParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elemName == 'author' && path.indexOf('/fictionbook/description/title-info/author') == 0) {
|
if (tag == 'author' && path.indexOf('/fictionbook/description/title-info/author') == 0) {
|
||||||
if (!fb2.author)
|
if (!fb2.author)
|
||||||
fb2.author = [];
|
fb2.author = [];
|
||||||
fb2.author.push({});
|
fb2.author.push({});
|
||||||
@@ -195,9 +224,19 @@ export default class BookParser {
|
|||||||
|
|
||||||
if (path.indexOf('/fictionbook/body') == 0) {
|
if (path.indexOf('/fictionbook/body') == 0) {
|
||||||
if (tag == 'body') {
|
if (tag == 'body') {
|
||||||
|
if (isFirstBody && fb2.annotation) {
|
||||||
|
const ann = fb2.annotation.split('<p>').filter(v => v).map(v => utils.removeHtmlTags(v));
|
||||||
|
ann.forEach(a => {
|
||||||
|
newParagraph(`<emphasis><space w="1">${a}</space></emphasis>`, a.length);
|
||||||
|
});
|
||||||
|
if (ann.length)
|
||||||
|
newParagraph(' ', 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isFirstBody)
|
if (!isFirstBody)
|
||||||
newParagraph(' ', 1);
|
newParagraph(' ', 1);
|
||||||
isFirstBody = false;
|
isFirstBody = false;
|
||||||
|
bodyIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'title') {
|
if (tag == 'title') {
|
||||||
@@ -205,12 +244,17 @@ export default class BookParser {
|
|||||||
isFirstTitlePara = true;
|
isFirstTitlePara = true;
|
||||||
bold = true;
|
bold = true;
|
||||||
center = true;
|
center = true;
|
||||||
|
|
||||||
|
inTitle = true;
|
||||||
|
curTitle = {paraIndex, title: '', inset: sectionLevel, bodyIndex, subtitles: []};
|
||||||
|
this.contents.push(curTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'section') {
|
if (tag == 'section') {
|
||||||
if (!isFirstSection)
|
if (!isFirstSection)
|
||||||
newParagraph(' ', 1);
|
newParagraph(' ', 1);
|
||||||
isFirstSection = false;
|
isFirstSection = false;
|
||||||
|
sectionLevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'emphasis' || tag == 'strong') {
|
if (tag == 'emphasis' || tag == 'strong') {
|
||||||
@@ -231,9 +275,13 @@ export default class BookParser {
|
|||||||
isFirstTitlePara = true;
|
isFirstTitlePara = true;
|
||||||
bold = true;
|
bold = true;
|
||||||
center = true;
|
center = true;
|
||||||
|
|
||||||
|
inSubtitle = true;
|
||||||
|
curSubtitle = {paraIndex, inset: sectionLevel, title: ''};
|
||||||
|
curTitle.subtitles.push(curSubtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'epigraph') {
|
if (tag == 'epigraph' || tag == 'annotation') {
|
||||||
italic = true;
|
italic = true;
|
||||||
space += 1;
|
space += 1;
|
||||||
}
|
}
|
||||||
@@ -260,6 +308,11 @@ export default class BookParser {
|
|||||||
isFirstTitlePara = false;
|
isFirstTitlePara = false;
|
||||||
bold = false;
|
bold = false;
|
||||||
center = false;
|
center = false;
|
||||||
|
inTitle = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tag == 'section') {
|
||||||
|
sectionLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'emphasis' || tag == 'strong') {
|
if (tag == 'emphasis' || tag == 'strong') {
|
||||||
@@ -274,11 +327,14 @@ export default class BookParser {
|
|||||||
isFirstTitlePara = false;
|
isFirstTitlePara = false;
|
||||||
bold = false;
|
bold = false;
|
||||||
center = false;
|
center = false;
|
||||||
|
inSubtitle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'epigraph') {
|
if (tag == 'epigraph' || tag == 'annotation') {
|
||||||
italic = false;
|
italic = false;
|
||||||
space -= 1;
|
space -= 1;
|
||||||
|
if (tag == 'annotation')
|
||||||
|
newParagraph(' ', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'stanza') {
|
if (tag == 'stanza') {
|
||||||
@@ -372,7 +428,7 @@ export default class BookParser {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onProgress = async(prog) => {
|
const onProgress = async(prog) => {
|
||||||
await sleep(1);
|
await utils.sleep(1);
|
||||||
callback(prog);
|
callback(prog);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -394,7 +450,7 @@ export default class BookParser {
|
|||||||
this.textLength = paraOffset;
|
this.textLength = paraOffset;
|
||||||
|
|
||||||
callback(100);
|
callback(100);
|
||||||
await sleep(10);
|
await utils.sleep(10);
|
||||||
|
|
||||||
return {fb2};
|
return {fb2};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,38 @@
|
|||||||
export const versionHistory = [
|
export const versionHistory = [
|
||||||
|
{
|
||||||
|
showUntil: '2020-11-12',
|
||||||
|
header: '0.9.8 (2020-11-13)',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>добавлено окно "Оглавление/закладки"</li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
showUntil: '2020-11-11',
|
||||||
|
header: '0.9.7 (2020-11-12)',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>исправления багов</li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
showUntil: '2020-11-05',
|
||||||
|
header: '0.9.6 (2020-11-06)',
|
||||||
|
content:
|
||||||
|
`
|
||||||
|
<ul>
|
||||||
|
<li>завершена работа над новым окном "Библиотека"</li>
|
||||||
|
<li>исправления багов</li>
|
||||||
|
</ul>
|
||||||
|
`
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
showUntil: '2020-10-31',
|
showUntil: '2020-10-31',
|
||||||
header: '0.9.5 (2020-11-01)',
|
header: '0.9.5 (2020-11-01)',
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {QSlider} from 'quasar/src/components/slider';
|
|||||||
import {QTabs, QTab} from 'quasar/src/components/tabs';
|
import {QTabs, QTab} from 'quasar/src/components/tabs';
|
||||||
//import {QTabPanels, QTabPanel} from 'quasar/src/components/tab-panels';
|
//import {QTabPanels, QTabPanel} from 'quasar/src/components/tab-panels';
|
||||||
import {QSeparator} from 'quasar/src/components/separator';
|
import {QSeparator} from 'quasar/src/components/separator';
|
||||||
import {QList, QItem, QItemSection, QItemLabel} from 'quasar/src/components/item';
|
//import {QList, QItem, QItemSection, QItemLabel} from 'quasar/src/components/item';
|
||||||
import {QTooltip} from 'quasar/src/components/tooltip';
|
import {QTooltip} from 'quasar/src/components/tooltip';
|
||||||
import {QSpinner} from 'quasar/src/components/spinner';
|
import {QSpinner} from 'quasar/src/components/spinner';
|
||||||
import {QTable, QTh, QTr, QTd} from 'quasar/src/components/table';
|
import {QTable, QTh, QTr, QTd} from 'quasar/src/components/table';
|
||||||
@@ -32,6 +32,7 @@ import {QPopupProxy} from 'quasar/src/components/popup-proxy';
|
|||||||
import {QDialog} from 'quasar/src/components/dialog';
|
import {QDialog} from 'quasar/src/components/dialog';
|
||||||
import {QChip} from 'quasar/src/components/chip';
|
import {QChip} from 'quasar/src/components/chip';
|
||||||
import {QTree} from 'quasar/src/components/tree';
|
import {QTree} from 'quasar/src/components/tree';
|
||||||
|
//import {QExpansionItem} from 'quasar/src/components/expansion-item';
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
//QLayout,
|
//QLayout,
|
||||||
@@ -48,7 +49,7 @@ const components = {
|
|||||||
QTabs, QTab,
|
QTabs, QTab,
|
||||||
//QTabPanels, QTabPanel,
|
//QTabPanels, QTabPanel,
|
||||||
QSeparator,
|
QSeparator,
|
||||||
QList, QItem, QItemSection, QItemLabel,
|
//QList, QItem, QItemSection, QItemLabel,
|
||||||
QTooltip,
|
QTooltip,
|
||||||
QSpinner,
|
QSpinner,
|
||||||
QTable, QTh, QTr, QTd,
|
QTable, QTh, QTr, QTd,
|
||||||
@@ -58,7 +59,8 @@ const components = {
|
|||||||
QPopupProxy,
|
QPopupProxy,
|
||||||
QDialog,
|
QDialog,
|
||||||
QChip,
|
QChip,
|
||||||
QTree
|
QTree,
|
||||||
|
//QExpansionItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
//directives
|
//directives
|
||||||
|
|||||||
@@ -103,30 +103,57 @@ export function fromBase64(data) {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getObjDiff(oldObj, newObj) {
|
export function getObjDiff(oldObj, newObj, opts = {}) {
|
||||||
const result = {__isDiff: true, change: {}, add: {}, del: []};
|
const {
|
||||||
|
exclude = [],
|
||||||
|
excludeAdd = [],
|
||||||
|
excludeDel = [],
|
||||||
|
} = opts;
|
||||||
|
|
||||||
for (const key of Object.keys(oldObj)) {
|
const ex = new Set(exclude);
|
||||||
if (newObj.hasOwnProperty(key)) {
|
const exAdd = new Set(excludeAdd);
|
||||||
if (!_.isEqual(oldObj[key], newObj[key])) {
|
const exDel = new Set(excludeDel);
|
||||||
if (_.isObject(oldObj[key]) && _.isObject(newObj[key])) {
|
|
||||||
result.change[key] = getObjDiff(oldObj[key], newObj[key]);
|
const makeObjDiff = (oldObj, newObj, keyPath) => {
|
||||||
} else {
|
const result = {__isDiff: true, change: {}, add: {}, del: []};
|
||||||
result.change[key] = _.cloneDeep(newObj[key]);
|
|
||||||
|
keyPath = `${keyPath}${keyPath ? '/' : ''}`;
|
||||||
|
|
||||||
|
for (const key of Object.keys(oldObj)) {
|
||||||
|
const kp = `${keyPath}${key}`;
|
||||||
|
|
||||||
|
if (newObj.hasOwnProperty(key)) {
|
||||||
|
if (ex.has(kp))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!_.isEqual(oldObj[key], newObj[key])) {
|
||||||
|
if (_.isObject(oldObj[key]) && _.isObject(newObj[key])) {
|
||||||
|
result.change[key] = makeObjDiff(oldObj[key], newObj[key], kp);
|
||||||
|
} else {
|
||||||
|
result.change[key] = _.cloneDeep(newObj[key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (exDel.has(kp))
|
||||||
|
continue;
|
||||||
|
result.del.push(key);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
result.del.push(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const key of Object.keys(newObj)) {
|
||||||
|
const kp = `${keyPath}${key}`;
|
||||||
|
if (exAdd.has(kp))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!oldObj.hasOwnProperty(key)) {
|
||||||
|
result.add[key] = _.cloneDeep(newObj[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(newObj)) {
|
return makeObjDiff(oldObj, newObj, '');
|
||||||
if (!oldObj.hasOwnProperty(key)) {
|
|
||||||
result.add[key] = _.cloneDeep(newObj[key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isObjDiff(diff) {
|
export function isObjDiff(diff) {
|
||||||
@@ -277,3 +304,7 @@ export function userHotKeysObjectSwap(userHotKeys) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function removeHtmlTags(s) {
|
||||||
|
return s.replace(/(<([^>]+)>)/ig, '');
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const readerActions = {
|
|||||||
'splitToPara': 'Обновить с разбиением на параграфы',
|
'splitToPara': 'Обновить с разбиением на параграфы',
|
||||||
'refresh': 'Принудительно обновить книгу',
|
'refresh': 'Принудительно обновить книгу',
|
||||||
'offlineMode': 'Автономный режим (без интернета)',
|
'offlineMode': 'Автономный режим (без интернета)',
|
||||||
|
'contents': 'Оглавление/закладки',
|
||||||
'libs': 'Библиотека',
|
'libs': 'Библиотека',
|
||||||
'recentBooks': 'Открыть недавние',
|
'recentBooks': 'Открыть недавние',
|
||||||
'switchToolbar': 'Показать/скрыть панель управления',
|
'switchToolbar': 'Показать/скрыть панель управления',
|
||||||
@@ -42,6 +43,7 @@ const toolButtons = [
|
|||||||
{name: 'copyText', show: false},
|
{name: 'copyText', show: false},
|
||||||
{name: 'splitToPara', show: false},
|
{name: 'splitToPara', show: false},
|
||||||
{name: 'refresh', show: true},
|
{name: 'refresh', show: true},
|
||||||
|
{name: 'contents', show: true},
|
||||||
{name: 'libs', show: true},
|
{name: 'libs', show: true},
|
||||||
{name: 'recentBooks', show: true},
|
{name: 'recentBooks', show: true},
|
||||||
{name: 'offlineMode', show: false},
|
{name: 'offlineMode', show: false},
|
||||||
@@ -61,9 +63,10 @@ const hotKeys = [
|
|||||||
{name: 'copyText', codes: ['Ctrl+C']},
|
{name: 'copyText', codes: ['Ctrl+C']},
|
||||||
{name: 'splitToPara', codes: ['Shift+R']},
|
{name: 'splitToPara', codes: ['Shift+R']},
|
||||||
{name: 'refresh', codes: ['R']},
|
{name: 'refresh', codes: ['R']},
|
||||||
{name: 'offlineMode', codes: ['O']},
|
{name: 'contents', codes: ['C']},
|
||||||
{name: 'libs', codes: ['L']},
|
{name: 'libs', codes: ['L']},
|
||||||
{name: 'recentBooks', codes: ['X']},
|
{name: 'recentBooks', codes: ['X']},
|
||||||
|
{name: 'offlineMode', codes: ['O']},
|
||||||
|
|
||||||
{name: 'switchToolbar', codes: ['Tab', 'Q']},
|
{name: 'switchToolbar', codes: ['Tab', 'Q']},
|
||||||
{name: 'bookBegin', codes: ['Home']},
|
{name: 'bookBegin', codes: ['Home']},
|
||||||
@@ -251,6 +254,7 @@ const settingDefaults = {
|
|||||||
showServerStorageMessages: true,
|
showServerStorageMessages: true,
|
||||||
showWhatsNewDialog: true,
|
showWhatsNewDialog: true,
|
||||||
showDonationDialog2020: true,
|
showDonationDialog2020: true,
|
||||||
|
showLiberamaTopDialog2020: true,
|
||||||
enableSitesFilter: true,
|
enableSitesFilter: true,
|
||||||
|
|
||||||
fontShifts: {},
|
fontShifts: {},
|
||||||
@@ -267,9 +271,12 @@ for (const button of toolButtons)
|
|||||||
for (const hotKey of hotKeys)
|
for (const hotKey of hotKeys)
|
||||||
settingDefaults.userHotKeys[hotKey.name] = hotKey.codes;
|
settingDefaults.userHotKeys[hotKey.name] = hotKey.codes;
|
||||||
|
|
||||||
|
const excludeDiffHotKeys = [];
|
||||||
|
for (const hotKey of hotKeys)
|
||||||
|
excludeDiffHotKeys.push(`userHotKeys/${hotKey.name}`);
|
||||||
|
|
||||||
function addDefaultsToSettings(settings) {
|
function addDefaultsToSettings(settings) {
|
||||||
const diff = utils.getObjDiff(settings, settingDefaults);
|
const diff = utils.getObjDiff(settings, settingDefaults, {exclude: excludeDiffHotKeys});
|
||||||
|
|
||||||
if (!utils.isEmptyObjDiffDeep(diff, {isApplyChange: false})) {
|
if (!utils.isEmptyObjDiffDeep(diff, {isApplyChange: false})) {
|
||||||
return utils.applyObjDiff(settings, diff, {isApplyChange: false});
|
return utils.applyObjDiff(settings, diff, {isApplyChange: false});
|
||||||
}
|
}
|
||||||
@@ -287,15 +294,18 @@ const libsDefaults = {
|
|||||||
{r: 'http://flibusta.is', s: 'http://flibusta.is', list: [
|
{r: 'http://flibusta.is', s: 'http://flibusta.is', list: [
|
||||||
{l: 'http://flibusta.is', c: 'Флибуста | Книжное братство'},
|
{l: 'http://flibusta.is', c: 'Флибуста | Книжное братство'},
|
||||||
]},
|
]},
|
||||||
|
{r: 'https://flibs.in', s: 'https://flibs.in', list: [
|
||||||
|
{l: 'https://flibs.in', c: 'Flibs'},
|
||||||
|
]},
|
||||||
|
{r: 'http://fantasy-worlds.org', s: 'http://fantasy-worlds.org', list: [
|
||||||
|
{l: 'http://fantasy-worlds.org', c: 'Миры Фэнтези'},
|
||||||
|
]},
|
||||||
{r: 'http://samlib.ru', s: 'http://samlib.ru', list: [
|
{r: 'http://samlib.ru', s: 'http://samlib.ru', list: [
|
||||||
{l: 'http://samlib.ru', c: 'Журнал "Самиздат"'},
|
{l: 'http://samlib.ru', c: 'Журнал "Самиздат"'},
|
||||||
]},
|
]},
|
||||||
{r: 'http://lib.ru', s: 'http://lib.ru', list: [
|
{r: 'http://lib.ru', s: 'http://lib.ru', list: [
|
||||||
{l: 'http://lib.ru', c: 'Библиотека Максима Мошкова'},
|
{l: 'http://lib.ru', c: 'Библиотека Максима Мошкова'},
|
||||||
]},
|
]},
|
||||||
{r: 'http://fantasy-worlds.org', s: 'http://fantasy-worlds.org', list: [
|
|
||||||
{l: 'http://fantasy-worlds.org', c: 'Миры Фэнтези'},
|
|
||||||
]},
|
|
||||||
{r: 'https://aldebaran.ru', s: 'https://aldebaran.ru', list: [
|
{r: 'https://aldebaran.ru', s: 'https://aldebaran.ru', list: [
|
||||||
{l: 'https://aldebaran.ru', c: 'АЛЬДЕБАРАН | Электронная библиотека книг'},
|
{l: 'https://aldebaran.ru', c: 'АЛЬДЕБАРАН | Электронная библиотека книг'},
|
||||||
]},
|
]},
|
||||||
|
|||||||
@@ -126,3 +126,18 @@ server {
|
|||||||
proxy_set_header Referer "";
|
proxy_set_header Referer "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 23580;
|
||||||
|
server_name fw_proxy;
|
||||||
|
|
||||||
|
valid_referers liberama.top b.liberama.top;
|
||||||
|
|
||||||
|
if ($invalid_referer) {
|
||||||
|
return 403;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://fantasy-worlds.org;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Liberama",
|
"name": "Liberama",
|
||||||
"version": "0.9.5",
|
"version": "0.9.8",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Liberama",
|
"name": "Liberama",
|
||||||
"version": "0.9.5",
|
"version": "0.9.8",
|
||||||
"author": "Book Pauk <bookpauk@gmail.com>",
|
"author": "Book Pauk <bookpauk@gmail.com>",
|
||||||
"license": "CC0-1.0",
|
"license": "CC0-1.0",
|
||||||
"repository": "bookpauk/liberama",
|
"repository": "bookpauk/liberama",
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = {
|
|||||||
loggingEnabled: true,
|
loggingEnabled: true,
|
||||||
|
|
||||||
maxUploadFileSize: 50*1024*1024,//50Мб
|
maxUploadFileSize: 50*1024*1024,//50Мб
|
||||||
maxTempPublicDirSize: 512*1024*1024,//512Мб
|
maxTempPublicDirSize: 512*1024*1024,//512Мб + 20% квота если проблема с remoteWebDavStorage
|
||||||
maxUploadPublicDirSize: 200*1024*1024,//100Мб
|
maxUploadPublicDirSize: 200*1024*1024,//100Мб
|
||||||
|
|
||||||
useExternalBookConverter: false,
|
useExternalBookConverter: false,
|
||||||
|
|||||||
@@ -266,30 +266,38 @@ class ReaderWorker {
|
|||||||
files.push({name, stat});
|
files.push({name, stat});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log(`clean dir ${dir}, maxSize=${maxSize}, found ${files.length} files`);
|
log(`clean dir ${dir}, maxSize=${maxSize}, found ${files.length} files, total size=${size}`);
|
||||||
|
|
||||||
files.sort((a, b) => a.stat.mtimeMs - b.stat.mtimeMs);
|
files.sort((a, b) => a.stat.mtimeMs - b.stat.mtimeMs);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
let j = 0;
|
||||||
while (i < files.length && size > maxSize) {
|
while (i < files.length && size > maxSize) {
|
||||||
const file = files[i];
|
const file = files[i];
|
||||||
const oldFile = `${dir}/${file.name}`;
|
const oldFile = `${dir}/${file.name}`;
|
||||||
|
|
||||||
|
let remoteSuccess = true;
|
||||||
//отправляем только this.config.tempPublicDir
|
//отправляем только this.config.tempPublicDir
|
||||||
//TODO: убрать в будущем, т.к. уже делается ленивое сохранение compFilename в удаленном хранилище
|
|
||||||
if (this.remoteWebDavStorage && dir === this.config.tempPublicDir) {
|
if (this.remoteWebDavStorage && dir === this.config.tempPublicDir) {
|
||||||
|
remoteSuccess = false;
|
||||||
try {
|
try {
|
||||||
//log(`remoteWebDavStorage.putFile ${path.basename(oldFile)}`);
|
//log(`remoteWebDavStorage.putFile ${path.basename(oldFile)}`);
|
||||||
await this.remoteWebDavStorage.putFile(oldFile);
|
await this.remoteWebDavStorage.putFile(oldFile);
|
||||||
|
remoteSuccess = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(LM_ERR, e.stack);
|
log(LM_ERR, e.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await fs.remove(oldFile);
|
//реально удаляем только если сохранили в хранилище
|
||||||
|
if (remoteSuccess || size > maxSize*1.2) {
|
||||||
|
await fs.remove(oldFile);
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
|
||||||
size -= file.stat.size;
|
size -= file.stat.size;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
log(`removed ${i} files`);
|
log(`removed ${j} files`);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
log(LM_ERR, e.stack);
|
log(LM_ERR, e.stack);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user