Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
5a3e4ee5ca | ||
|
|
ab2cf0aeec | ||
|
|
9de6a02b30 | ||
|
|
9fb7892bfe | ||
|
|
546f4556f6 | ||
|
|
471de104bc | ||
|
|
d30be1536d | ||
|
|
6c0678ed61 | ||
|
|
4883b8a190 | ||
|
|
14742ed4ad | ||
|
|
1d8bd56862 | ||
|
|
94b8f9fe1c | ||
|
|
27412211a5 | ||
|
|
f8c4960079 | ||
|
|
b2e0bcf995 | ||
|
|
fcf6639d38 | ||
|
|
d540cb91a9 | ||
|
|
f69cc6f1b1 | ||
|
|
607f2ff407 | ||
|
|
ba6bf8c091 | ||
|
|
7e4c938dfd | ||
|
|
7f36d55320 | ||
|
|
d9634a134c | ||
|
|
4f8868d4b1 |
@@ -248,7 +248,7 @@ body, html, #app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.dborder {
|
.dborder {
|
||||||
border: 2px solid yellow !important;
|
border: 2px solid magenta !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-rotate {
|
.icon-rotate {
|
||||||
|
|||||||
@@ -4,6 +4,65 @@
|
|||||||
Настроить закладки
|
Настроить закладки
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div class="col column fit">
|
||||||
|
<div class="row items-center top-panel bg-grey-3">
|
||||||
|
<q-btn class="q-mr-md" round dense color="blue" icon="la la-check" @click.stop="openSelected" size="16px" :disabled="!selected">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Открыть выбранную закладку</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-input class="col" ref="search" rounded outlined dense bg-color="white" placeholder="Найти" v-model="search">
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon v-if="search !== ''" name="la la-times" class="cursor-pointer" @click="resetSearch"/>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col row">
|
||||||
|
<div class="left-panel column items-center no-wrap bg-grey-3">
|
||||||
|
<q-btn class="q-my-sm" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="14px">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Добавить закладку</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn class="q-mb-sm" round dense color="blue" icon="la la-minus" @click.stop="delBookmark" size="14px" :disabled="!ticked.length">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Удалить отмеченные закладки</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn class="q-mb-sm" round dense color="blue" icon="la la-edit" @click.stop="editBookmark" size="14px" :disabled="!selected || selected.indexOf('r-') == 0">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Редактировать закладку</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn class="q-mb-sm" round dense color="blue" icon="la la-arrow-up" @click.stop="moveBookmark(false)" size="14px" :disabled="!ticked.length">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Переместить отмеченные вверх</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn class="q-mb-sm" round dense color="blue" icon="la la-arrow-down" @click.stop="moveBookmark(true)" size="14px" :disabled="!ticked.length">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Переместить отмеченные вниз</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn class="q-mb-sm" round dense color="blue" icon="la la-broom" @click.stop="setDefaultBookmarks" size="14px">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Установить по умолчанию</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<div class="space"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col fit tree">
|
||||||
|
<div v-show="nodes.length" class="checkbox-tick-all">
|
||||||
|
<q-checkbox v-model="tickAll" @input="makeTickAll" size="36px" label="Выбрать все" />
|
||||||
|
</div>
|
||||||
|
<q-tree
|
||||||
|
class="q-my-xs"
|
||||||
|
:nodes="nodes"
|
||||||
|
node-key="key"
|
||||||
|
tick-strategy="leaf"
|
||||||
|
:selected.sync="selected"
|
||||||
|
:ticked.sync="ticked"
|
||||||
|
:expanded.sync="expanded"
|
||||||
|
selected-color="black"
|
||||||
|
:filter="search"
|
||||||
|
no-nodes-label="Закладок пока нет"
|
||||||
|
no-results-label="Ничего не найдено"
|
||||||
|
>
|
||||||
|
<template v-slot:default-header="p">
|
||||||
|
<div class="q-px-xs" :class="{selected: selected == p.key}">{{ p.node.label }}</div>
|
||||||
|
</template>
|
||||||
|
</q-tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Window>
|
</Window>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -11,11 +70,16 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Component from 'vue-class-component';
|
import Component from 'vue-class-component';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
import Window from '../../share/Window.vue';
|
import Window from '../../share/Window.vue';
|
||||||
|
import * as lu from '../linkUtils';
|
||||||
|
import rstore from '../../../store/modules/reader';
|
||||||
|
|
||||||
const BookmarkSettingsProps = Vue.extend({
|
const BookmarkSettingsProps = Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
libs: Object,
|
libs: Object,
|
||||||
|
addBookmarkVisible: Boolean,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -24,12 +88,20 @@ export default @Component({
|
|||||||
Window,
|
Window,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
libs: function() {
|
ticked: function() {
|
||||||
|
this.checkAllTicked();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
class BookmarkSettings extends BookmarkSettingsProps {
|
class BookmarkSettings extends BookmarkSettingsProps {
|
||||||
|
search = '';
|
||||||
|
selected = '';
|
||||||
|
ticked = [];
|
||||||
|
expanded = [];
|
||||||
|
tickAll = false;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.afterInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -39,11 +111,195 @@ class BookmarkSettings extends BookmarkSettingsProps {
|
|||||||
this.$refs.window.init();
|
this.$refs.window.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get nodes() {
|
||||||
|
const result = [];
|
||||||
|
|
||||||
|
const expanded = [];
|
||||||
|
this.links = {};
|
||||||
|
this.libs.groups.forEach(group => {
|
||||||
|
const rkey = `r-${group.r}`;
|
||||||
|
const g = {label: group.r, key: rkey, children: []};
|
||||||
|
this.links[rkey] = {l: group.r, c: ''};
|
||||||
|
|
||||||
|
group.list.forEach(link => {
|
||||||
|
const key = link.l;
|
||||||
|
g.children.push({
|
||||||
|
label: (link.c ? link.c + ' ': '') + lu.removeOrigin(link.l),
|
||||||
|
key
|
||||||
|
});
|
||||||
|
|
||||||
|
this.links[key] = link;
|
||||||
|
if (link.l == this.libs.startLink && expanded.indexOf(rkey) < 0) {
|
||||||
|
expanded.push(rkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
result.push(g);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.afterInit) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.expanded = expanded;
|
||||||
|
});
|
||||||
|
this.afterInit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
makeTickAll() {
|
||||||
|
if (this.tickAll) {
|
||||||
|
const newTicked = [];
|
||||||
|
for (const key of Object.keys(this.links)) {
|
||||||
|
if (key.indexOf('r-') != 0)
|
||||||
|
newTicked.push(key);
|
||||||
|
}
|
||||||
|
this.ticked = newTicked;
|
||||||
|
} else {
|
||||||
|
this.ticked = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkAllTicked() {
|
||||||
|
const ticked = new Set(this.ticked);
|
||||||
|
|
||||||
|
let newTickAll = !!(this.nodes.length);
|
||||||
|
for (const key of Object.keys(this.links)) {
|
||||||
|
if (key.indexOf('r-') != 0 && !ticked.has(key))
|
||||||
|
newTickAll = false;
|
||||||
|
}
|
||||||
|
this.tickAll = newTickAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
resetSearch() {
|
||||||
|
this.search = '';
|
||||||
|
this.$refs.search.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
openSelected() {
|
||||||
|
if (!this.selected)
|
||||||
|
return;
|
||||||
|
if (this.selected.indexOf('r-') === 0) {//rootLink
|
||||||
|
this.$emit('do-action', {action: 'setRootLink', data: this.links[this.selected].l});
|
||||||
|
} else {//selectedLink
|
||||||
|
this.$emit('do-action', {action: 'setSelectedLink', data: this.links[this.selected].l});
|
||||||
|
}
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
editBookmark() {
|
||||||
|
this.$emit('do-action', {action: 'editBookmark', data: {link: this.links[this.selected].l, desc: this.links[this.selected].c}});
|
||||||
|
}
|
||||||
|
|
||||||
|
addBookmark() {
|
||||||
|
this.$emit('do-action', {action: 'addBookmark'});
|
||||||
|
}
|
||||||
|
|
||||||
|
async delBookmark() {
|
||||||
|
const newLibs = _.cloneDeep(this.libs);
|
||||||
|
|
||||||
|
if (await this.$root.stdDialog.confirm(`Подтвердите удаление ${this.ticked.length} закладок:`, ' ')) {
|
||||||
|
const ticked = new Set(this.ticked);
|
||||||
|
for (let i = newLibs.groups.length - 1; i >= 0; i--) {
|
||||||
|
const g = newLibs.groups[i];
|
||||||
|
for (let j = g.list.length - 1; j >= 0; j--) {
|
||||||
|
if (ticked.has(g.list[j].l)) {
|
||||||
|
delete g.list[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.list = g.list.filter(v => v);
|
||||||
|
if (!g.list.length)
|
||||||
|
delete newLibs.groups[i];
|
||||||
|
else {
|
||||||
|
const item = lu.getListItemByLink(g.list, g.s);
|
||||||
|
if (!item)
|
||||||
|
g.s = g.list[0].l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newLibs.groups = newLibs.groups.filter(v => v);
|
||||||
|
this.ticked = [];
|
||||||
|
this.selected = '';
|
||||||
|
this.$emit('do-action', {action: 'setLibs', data: newLibs});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moveBookmark(down = false) {
|
||||||
|
const newLibs = _.cloneDeep(this.libs);
|
||||||
|
|
||||||
|
const ticked = new Set(this.ticked);
|
||||||
|
let moved = false;
|
||||||
|
let prevFull = false;
|
||||||
|
if (!down) {
|
||||||
|
for (let i = 0; i < newLibs.groups.length; i++) {
|
||||||
|
const g = newLibs.groups[i];
|
||||||
|
let count = 0;
|
||||||
|
for (let j = 0; j < g.list.length; j++) {
|
||||||
|
if (ticked.has(g.list[j].l)) {
|
||||||
|
if (j > 0 && !ticked.has(g.list[j - 1].l)) {
|
||||||
|
[g.list[j], g.list[j - 1]] = [g.list[j - 1], g.list[j]];
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == g.list.length && !prevFull && i > 0) {
|
||||||
|
const gs = newLibs.groups;
|
||||||
|
[gs[i], gs[i - 1]] = [gs[i - 1], gs[i]];
|
||||||
|
moved = true;
|
||||||
|
} else
|
||||||
|
prevFull = (count == g.list.length);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let i = newLibs.groups.length - 1; i >= 0; i--) {
|
||||||
|
const g = newLibs.groups[i];
|
||||||
|
let count = 0;
|
||||||
|
for (let j = g.list.length - 1; j >= 0; j--) {
|
||||||
|
if (ticked.has(g.list[j].l)) {
|
||||||
|
if (j < g.list.length - 1 && !ticked.has(g.list[j + 1].l)) {
|
||||||
|
[g.list[j], g.list[j + 1]] = [g.list[j + 1], g.list[j]];
|
||||||
|
moved = true;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count == g.list.length && !prevFull && i < newLibs.groups.length - 1) {
|
||||||
|
const gs = newLibs.groups;
|
||||||
|
[gs[i], gs[i + 1]] = [gs[i + 1], gs[i]];
|
||||||
|
moved = true;
|
||||||
|
} else
|
||||||
|
prevFull = (count == g.list.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (moved)
|
||||||
|
this.$emit('do-action', {action: 'setLibs', data: newLibs});
|
||||||
|
}
|
||||||
|
|
||||||
|
async setDefaultBookmarks() {
|
||||||
|
const result = await this.$root.stdDialog.prompt(`Введите 'да' для сброса всех закладок в предустановленные значения:`, ' ', {
|
||||||
|
inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Удаление не подтверждено'; },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result && result.value && result.value.toLowerCase() == 'да') {
|
||||||
|
this.$emit('do-action', {action: 'setLibs', data: _.cloneDeep(
|
||||||
|
Object.assign({helpShowed: true}, rstore.libsDefaults)
|
||||||
|
)});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
this.afterInit = false;
|
||||||
this.$emit('close');
|
this.$emit('close');
|
||||||
}
|
}
|
||||||
|
|
||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
|
if (this.addBookmarkVisible)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (event.type == 'keydown' && event.key == 'Escape') {
|
if (event.type == 'keydown' && event.key == 'Escape') {
|
||||||
this.close();
|
this.close();
|
||||||
return true;
|
return true;
|
||||||
@@ -56,4 +312,38 @@ class BookmarkSettings extends BookmarkSettingsProps {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.top-panel {
|
||||||
|
height: 50px;
|
||||||
|
border-bottom: 1px solid gray;
|
||||||
|
padding: 0 10px 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-panel {
|
||||||
|
width: 60px;
|
||||||
|
height: 100%;
|
||||||
|
border-right: 1px solid gray;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree {
|
||||||
|
padding: 0px 10px 10px 10px;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
text-shadow: 0 0 20px yellow, 0 0 15px yellow, 0 0 10px yellow, 0 0 10px yellow, 0 0 5px yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-tick-all {
|
||||||
|
border-bottom: 1px solid #bbbbbb;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
padding: 5px 5px 2px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.space {
|
||||||
|
min-height: 1px;
|
||||||
|
width: 1px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,6 +9,18 @@
|
|||||||
<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">
|
||||||
@@ -23,12 +35,12 @@
|
|||||||
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="12px">
|
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="12px">
|
||||||
<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>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn round dense color="blue" icon="la la-bars" @click.stop="bookmarkSettings" size="12px" disabled>
|
<q-btn round dense color="blue" icon="la la-bars" @click.stop="bookmarkSettings" size="12px">
|
||||||
<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>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:selected>
|
<template v-slot:selected>
|
||||||
<div style="overflow: hidden; white-space: nowrap;">{{ removeProtocol(rootLink) }}</div>
|
<div style="overflow: hidden; white-space: nowrap;">{{ rootLinkWithoutProtocol }}</div>
|
||||||
</template>
|
</template>
|
||||||
</q-select>
|
</q-select>
|
||||||
|
|
||||||
@@ -44,23 +56,30 @@
|
|||||||
@focus="selectAllOnFocus" @keydown="bookUrlKeyDown"
|
@focus="selectAllOnFocus" @keydown="bookUrlKeyDown"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-home" @click="goToLink(libs.startLink)" size="12px">
|
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-home" @click="goToLink(selectedLink)" size="12px">
|
||||||
<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>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
<q-btn round dense color="blue" icon="la la-angle-double-down" @click="openBookUrlInFrame" size="12px">
|
<q-btn round dense color="blue" icon="la la-angle-double-down" @click="openBookUrlInFrame" size="12px" :disabled="!bookUrl">
|
||||||
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Загрузить URL во фрейм</q-tooltip>
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Загрузить URL во фрейм</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-btn round dense color="blue" icon="la la-cog" @click.stop="optionsVisible = true" size="12px">
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Опции</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
||||||
<q-btn rounded color="green-7" no-caps size="14px" @click="submitUrl">Открыть
|
<q-btn rounded color="green-7" no-caps size="14px" @click="submitUrl" :disabled="!bookUrl">Открыть
|
||||||
<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>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</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>
|
||||||
|
|
||||||
@@ -68,7 +87,8 @@
|
|||||||
<template slot="header">
|
<template slot="header">
|
||||||
<div class="row items-center">
|
<div class="row items-center">
|
||||||
<q-icon class="q-mr-sm" name="la la-bookmark" size="28px"></q-icon>
|
<q-icon class="q-mr-sm" name="la la-bookmark" size="28px"></q-icon>
|
||||||
Добавить закладку
|
<div v-if="addBookmarkMode == 'edit'">Редактировать закладку</div>
|
||||||
|
<div v-else>Добавить закладку</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -96,8 +116,30 @@
|
|||||||
<q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="okAddBookmark" :disabled="!bookmarkLink">OK</q-btn>
|
<q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="okAddBookmark" :disabled="!bookmarkLink">OK</q-btn>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog ref="options" v-model="optionsVisible">
|
||||||
|
<template slot="header">
|
||||||
|
<div class="row items-center">
|
||||||
|
<q-icon class="q-mr-sm" name="la la-cog" size="28px"></q-icon>
|
||||||
|
Опции
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div class="q-mx-md column">
|
||||||
|
<q-checkbox v-model="closeAfterSubmit" size="36px" label="Закрыть окно при отправке ссылки в читалку" />
|
||||||
|
<q-checkbox v-model="openInFrameOnEnter" size="36px" label="Открывать ссылку во фрейме при нажатии 'Enter'" />
|
||||||
|
<q-checkbox v-model="openInFrameOnAdd" size="36px" label="Активировать новую закладку после добавления" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<template slot="footer">
|
||||||
|
<q-btn class="q-px-md q-ml-sm" color="primary" dense no-caps @click="optionsVisible = false">OK</q-btn>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
</div>
|
</div>
|
||||||
<BookmarkSettings v-if="bookmarkSettingsActive" ref="bookmarkSettings" :libs="libs" @close="closeBookmarkSettings"></BookmarkSettings>
|
|
||||||
|
<BookmarkSettings v-if="bookmarkSettingsActive" ref="bookmarkSettings" :libs="libs" :addBookmarkVisible="addBookmarkVisible"
|
||||||
|
@do-action="doAction" @close="closeBookmarkSettings">
|
||||||
|
</BookmarkSettings>
|
||||||
</Window>
|
</Window>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -113,6 +155,7 @@ import BookmarkSettings from './BookmarkSettings/BookmarkSettings.vue';
|
|||||||
|
|
||||||
import rstore from '../../store/modules/reader';
|
import rstore from '../../store/modules/reader';
|
||||||
import * as utils from '../../share/utils';
|
import * as utils from '../../share/utils';
|
||||||
|
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',
|
||||||
@@ -128,44 +171,81 @@ export default @Component({
|
|||||||
libs: function() {
|
libs: function() {
|
||||||
this.loadLibs();
|
this.loadLibs();
|
||||||
},
|
},
|
||||||
rootLink: function() {
|
|
||||||
this.updateSelectedLink();
|
|
||||||
this.updateStartLink();
|
|
||||||
},
|
|
||||||
selectedLink: function() {
|
|
||||||
this.updateStartLink();
|
|
||||||
},
|
|
||||||
defaultRootLink: function() {
|
defaultRootLink: function() {
|
||||||
this.updateBookmarkLink();
|
this.updateBookmarkLink();
|
||||||
}
|
},
|
||||||
|
bookUrl: function(newValue) {
|
||||||
|
const value = lu.addProtocol(newValue);
|
||||||
|
const subst = this.makeProxySubst(value, true);
|
||||||
|
if (value != subst) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.bookUrl = subst;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bookmarkLink: function(newValue) {
|
||||||
|
const value = lu.addProtocol(newValue);
|
||||||
|
const subst = this.makeProxySubst(value, true);
|
||||||
|
if (value != subst) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.bookmarkLink = subst;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
closeAfterSubmit: function(newValue) {
|
||||||
|
this.commitProp('closeAfterSubmit', newValue);
|
||||||
|
},
|
||||||
|
openInFrameOnEnter: function(newValue) {
|
||||||
|
this.commitProp('openInFrameOnEnter', newValue);
|
||||||
|
},
|
||||||
|
openInFrameOnAdd: function(newValue) {
|
||||||
|
this.commitProp('openInFrameOnAdd', newValue);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
class ExternalLibs extends Vue {
|
class ExternalLibs extends Vue {
|
||||||
ready = false;
|
ready = false;
|
||||||
frameVisible = false;
|
frameVisible = false;
|
||||||
startLink = '';
|
|
||||||
rootLink = '';
|
rootLink = '';
|
||||||
selectedLink = '';
|
selectedLink = '';
|
||||||
frameSrc = '';
|
frameSrc = '';
|
||||||
bookUrl = '';
|
bookUrl = '';
|
||||||
libs = {};
|
libs = {};
|
||||||
fullScreenActive = false;
|
fullScreenActive = false;
|
||||||
addBookmarkVisible = false;
|
|
||||||
transparentLayoutVisible = false;
|
transparentLayoutVisible = false;
|
||||||
|
|
||||||
|
addBookmarkVisible = false;
|
||||||
|
optionsVisible = false;
|
||||||
|
|
||||||
|
addBookmarkMode = '';
|
||||||
bookmarkLink = '';
|
bookmarkLink = '';
|
||||||
bookmarkDesc = '';
|
bookmarkDesc = '';
|
||||||
defaultRootLink = '';
|
defaultRootLink = '';
|
||||||
|
|
||||||
bookmarkSettingsActive = false;
|
bookmarkSettingsActive = false;
|
||||||
|
|
||||||
|
closeAfterSubmit = false;
|
||||||
|
openInFrameOnEnter = false;
|
||||||
|
openInFrameOnAdd = false;
|
||||||
|
frameScale = 1;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.oldStartLink = '';
|
||||||
|
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);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.debouncedGoToLink = _.debounce((link) => {
|
||||||
|
this.goToLink(link);
|
||||||
|
}, 100, {'maxWait':200});
|
||||||
//this.commit = this.$store.commit;
|
//this.commit = this.$store.commit;
|
||||||
//this.commit('reader/setLibs', rstore.libsDefaults);
|
//this.commit('reader/setLibs', rstore.libsDefaults);
|
||||||
}
|
}
|
||||||
@@ -258,8 +338,6 @@ class ExternalLibs extends Vue {
|
|||||||
} else if (d.type == 'libs') {
|
} else if (d.type == 'libs') {
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
this.libs = _.cloneDeep(d.data);
|
this.libs = _.cloneDeep(d.data);
|
||||||
if (!this.frameSrc)
|
|
||||||
this.goToLink(this.libs.startLink);
|
|
||||||
} else if (d.type == 'notify') {
|
} else if (d.type == 'notify') {
|
||||||
this.$root.notify.success(d.data, '', {position: 'bottom-right'});
|
this.$root.notify.success(d.data, '', {position: 'bottom-right'});
|
||||||
}
|
}
|
||||||
@@ -284,11 +362,44 @@ class ExternalLibs extends Vue {
|
|||||||
this.sendMessage({type: 'libs', data: libs});
|
this.sendMessage({type: 'libs', data: libs});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commitProp(prop, value) {
|
||||||
|
let libs = _.cloneDeep(this.libs);
|
||||||
|
libs[prop] = value;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
}
|
||||||
|
|
||||||
loadLibs() {
|
loadLibs() {
|
||||||
const libs = this.libs;
|
const libs = this.libs;
|
||||||
this.startLink = (libs.comment ? libs.comment + ' ': '') + this.removeProtocol(libs.startLink);
|
|
||||||
this.rootLink = this.getOrigin(libs.startLink);
|
if (!libs.helpShowed) {
|
||||||
this.updateSelectedLink();
|
this.showHelp();
|
||||||
|
(async() => {
|
||||||
|
await utils.sleep(1000);
|
||||||
|
this.commitProp('helpShowed', true);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectedLink = libs.startLink;
|
||||||
|
this.closeAfterSubmit = libs.closeAfterSubmit || false;
|
||||||
|
this.openInFrameOnEnter = libs.openInFrameOnEnter || 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
doAction(event) {
|
||||||
|
switch (event.action) {
|
||||||
|
case 'setLibs': this.commitLibs(event.data); break;
|
||||||
|
case 'setRootLink': this.rootLink = event.data; this.rootLinkInput(); break;
|
||||||
|
case 'setSelectedLink': this.selectedLink = event.data; this.selectedLinkInput(); break;
|
||||||
|
case 'editBookmark': this.addBookmark('edit', event.data.link, event.data.desc); break;
|
||||||
|
case 'addBookmark': this.addBookmark('add'); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get mode() {
|
get mode() {
|
||||||
@@ -297,32 +408,60 @@ class ExternalLibs extends Vue {
|
|||||||
|
|
||||||
get header() {
|
get header() {
|
||||||
let result = (this.ready ? 'Библиотека' : 'Загрузка...');
|
let result = (this.ready ? 'Библиотека' : 'Загрузка...');
|
||||||
if (this.ready && this.startLink) {
|
if (this.ready && this.selectedLink) {
|
||||||
result += ` | ${this.startLink}`;
|
result += ` | ${(this.libs.comment ? this.libs.comment + ' ': '') + lu.removeProtocol(this.libs.startLink)}`;
|
||||||
}
|
}
|
||||||
this.$root.$emit('set-app-title', result);
|
this.$root.$emit('set-app-title', result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSelectedLink() {
|
get rootLinkWithoutProtocol() {
|
||||||
if (!this.ready)
|
return lu.removeProtocol(this.rootLink);
|
||||||
return;
|
|
||||||
const index = this.getRootIndexByUrl(this.libs.groups, this.rootLink);
|
|
||||||
if (index >= 0)
|
|
||||||
this.selectedLink = this.libs.groups[index].s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStartLink() {
|
updateSelectedLinkByRoot() {
|
||||||
if (!this.ready)
|
if (!this.ready)
|
||||||
return;
|
return;
|
||||||
const index = this.getRootIndexByUrl(this.libs.groups, this.rootLink);
|
|
||||||
|
const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.rootLink);
|
||||||
|
if (index >= 0)
|
||||||
|
this.selectedLink = this.libs.groups[index].s;
|
||||||
|
else
|
||||||
|
this.selectedLink = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
updateStartLink(force) {
|
||||||
|
if (!this.ready)
|
||||||
|
return;
|
||||||
|
|
||||||
|
let index = -1;
|
||||||
|
try {
|
||||||
|
this.rootLink = lu.getOrigin(this.selectedLink);
|
||||||
|
index = lu.getRootIndexByUrl(this.libs.groups, this.rootLink);
|
||||||
|
} catch(e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
let libs = _.cloneDeep(this.libs);
|
let libs = _.cloneDeep(this.libs);
|
||||||
libs.groups[index].s = this.selectedLink;
|
const com = this.getCommentByLink(libs.groups[index].list, this.selectedLink);
|
||||||
libs.startLink = this.selectedLink;
|
if (libs.groups[index].s != this.selectedLink ||
|
||||||
libs.comment = this.getCommentByLink(libs.groups[index].list, this.selectedLink);
|
libs.startLink != this.selectedLink ||
|
||||||
this.goToLink(this.selectedLink);
|
libs.comment != com) {
|
||||||
this.commitLibs(libs);
|
libs.groups[index].s = this.selectedLink;
|
||||||
|
libs.startLink = this.selectedLink;
|
||||||
|
libs.comment = com;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (force || this.oldStartLink != libs.startLink) {
|
||||||
|
this.oldStartLink = libs.startLink;
|
||||||
|
this.debouncedGoToLink(this.selectedLink);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.rootLink = '';
|
||||||
|
this.selectedLink = '';
|
||||||
|
this.debouncedGoToLink(this.selectedLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +471,7 @@ class ExternalLibs extends Vue {
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
this.libs.groups.forEach(group => {
|
this.libs.groups.forEach(group => {
|
||||||
result.push({label: this.removeProtocol(group.r), value: group.r});
|
result.push({label: lu.removeProtocol(group.r), value: group.r});
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -342,7 +481,7 @@ class ExternalLibs extends Vue {
|
|||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
rstore.libsDefaults.groups.forEach(group => {
|
rstore.libsDefaults.groups.forEach(group => {
|
||||||
result.push({label: this.removeProtocol(group.r), value: group.r});
|
result.push({label: lu.removeProtocol(group.r), value: group.r});
|
||||||
});
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -353,10 +492,10 @@ class ExternalLibs extends Vue {
|
|||||||
if (!this.ready)
|
if (!this.ready)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
const index = this.getRootIndexByUrl(this.libs.groups, this.rootLink);
|
const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.rootLink);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.libs.groups[index].list.forEach(link => {
|
this.libs.groups[index].list.forEach(link => {
|
||||||
result.push({label: (link.c ? link.c + ' ': '') + this.removeOrigin(link.l), value: link.l});
|
result.push({label: (link.c ? link.c + ' ': '') + lu.removeOrigin(link.l), value: link.l});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,66 +504,69 @@ class ExternalLibs extends Vue {
|
|||||||
|
|
||||||
openBookUrlInFrame() {
|
openBookUrlInFrame() {
|
||||||
if (this.bookUrl) {
|
if (this.bookUrl) {
|
||||||
this.goToLink(this.addProtocol(this.bookUrl));
|
this.goToLink(lu.addProtocol(this.bookUrl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goToLink(link) {
|
goToLink(link) {
|
||||||
if (!this.ready)
|
if (!this.ready || !link)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!link) {
|
||||||
|
this.frameVisible = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.frameSrc = this.makeProxySubst(link);
|
this.frameSrc = this.makeProxySubst(link);
|
||||||
|
|
||||||
this.frameVisible = false;
|
this.frameVisible = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.frameVisible = true;
|
this.frameVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.frame.contentWindow.focus();
|
if (this.$refs.frame) {
|
||||||
|
this.$refs.frame.contentWindow.focus();
|
||||||
|
this.frameResize();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
addProtocol(url) {
|
frameResize() {
|
||||||
if ((url.indexOf('http://') != 0) && (url.indexOf('https://') != 0))
|
this.$refs.frameWrap.style = 'width: 1px; height: 1px;';
|
||||||
return 'http://' + url;
|
this.$nextTick(() => {
|
||||||
return url;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeProtocol(url) {
|
changeScale(delta) {
|
||||||
return url.replace(/(^\w+:|^)\/\//, '');
|
if ((this.frameScale > 0.1 && delta <= 0) || (this.frameScale < 5 && delta >= 0)) {
|
||||||
}
|
this.frameScale = _.round(this.frameScale + delta, 1);
|
||||||
|
|
||||||
getOrigin(url) {
|
const index = lu.getSafeRootIndexByUrl(this.libs.groups, this.selectedLink);
|
||||||
const parsed = new URL(url);
|
if (index >= 0) {
|
||||||
return parsed.origin;
|
let libs = _.cloneDeep(this.libs);
|
||||||
}
|
libs.groups[index].frameScale = this.frameScale;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
}
|
||||||
|
|
||||||
removeOrigin(url) {
|
this.frameResize();
|
||||||
const parsed = new URL(url);
|
this.$root.notify.success(`Масштаб изменен: ${(this.frameScale*100).toFixed(0)}%`, '', {position: 'bottom-right'});
|
||||||
const result = url.substring(parsed.origin.length);
|
|
||||||
return (result ? result : '/');
|
|
||||||
}
|
|
||||||
|
|
||||||
getRootIndexByUrl(groups, url) {
|
|
||||||
if (!this.ready)
|
|
||||||
return -1;
|
|
||||||
const origin = this.getOrigin(url);
|
|
||||||
for (let i = 0; i < groups.length; i++) {
|
|
||||||
if (groups[i].r == origin)
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
getListItemByLink(list, link) {
|
|
||||||
for (const item of list) {
|
|
||||||
if (item.l == link)
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommentByLink(list, link) {
|
getCommentByLink(list, link) {
|
||||||
const item = this.getListItemByLink(list, link);
|
const item = lu.getListItemByLink(list, link);
|
||||||
return (item ? item.c : '');
|
return (item ? item.c : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +574,7 @@ class ExternalLibs extends Vue {
|
|||||||
for (const [key, value] of Object.entries(proxySubst)) {
|
for (const [key, value] of Object.entries(proxySubst)) {
|
||||||
if (reverse && value == url.substring(0, value.length)) {
|
if (reverse && value == url.substring(0, value.length)) {
|
||||||
return key + url.substring(value.length);
|
return key + url.substring(value.length);
|
||||||
} else if (key == url.substring(0, key.length)) {
|
} else if (!reverse && key == url.substring(0, key.length)) {
|
||||||
return value + url.substring(key.length);
|
return value + url.substring(key.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -446,29 +588,37 @@ class ExternalLibs extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rootLinkInput() {
|
rootLinkInput() {
|
||||||
this.updateSelectedLink();
|
this.updateSelectedLinkByRoot();
|
||||||
this.updateStartLink();
|
this.updateStartLink(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedLinkInput() {
|
selectedLinkInput() {
|
||||||
this.updateStartLink();
|
this.updateStartLink(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
submitUrl() {
|
submitUrl() {
|
||||||
if (this.bookUrl) {
|
if (this.bookUrl) {
|
||||||
this.sendMessage({type: 'submitUrl', data: {
|
this.sendMessage({type: 'submitUrl', data: {
|
||||||
url: this.makeProxySubst(this.addProtocol(this.bookUrl), true),
|
url: this.bookUrl,
|
||||||
force: true
|
force: true
|
||||||
}});
|
}});
|
||||||
this.bookUrl = '';
|
this.bookUrl = '';
|
||||||
if (this.libs.closeAfterSubmit)
|
if (this.closeAfterSubmit)
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addBookmark() {
|
addBookmark(mode = 'add', link = '', desc = '') {
|
||||||
this.bookmarkLink = (this.bookUrl ? this.makeProxySubst(this.addProtocol(this.bookUrl), true) : '');
|
|
||||||
this.bookmarkDesc = '';
|
if (mode == 'edit') {
|
||||||
|
this.editBookmarkLink = this.bookmarkLink = link;
|
||||||
|
this.editBookmarkDesc = this.bookmarkDesc = desc;
|
||||||
|
} else {
|
||||||
|
this.bookmarkLink = this.bookUrl;
|
||||||
|
this.bookmarkDesc = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addBookmarkMode = mode;
|
||||||
this.addBookmarkVisible = true;
|
this.addBookmarkVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.bookmarkLink.focus();
|
this.$refs.bookmarkLink.focus();
|
||||||
@@ -477,7 +627,7 @@ class ExternalLibs extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateBookmarkLink() {
|
updateBookmarkLink() {
|
||||||
const index = this.getRootIndexByUrl(rstore.libsDefaults.groups, this.defaultRootLink);
|
const index = lu.getSafeRootIndexByUrl(rstore.libsDefaults.groups, this.defaultRootLink);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
this.bookmarkLink = rstore.libsDefaults.groups[index].s;
|
this.bookmarkLink = rstore.libsDefaults.groups[index].s;
|
||||||
this.bookmarkDesc = this.getCommentByLink(rstore.libsDefaults.groups[index].list, this.bookmarkLink);
|
this.bookmarkDesc = this.getCommentByLink(rstore.libsDefaults.groups[index].list, this.bookmarkLink);
|
||||||
@@ -500,8 +650,9 @@ class ExternalLibs extends Vue {
|
|||||||
|
|
||||||
bookmarkDescKeyDown(event) {
|
bookmarkDescKeyDown(event) {
|
||||||
if (event.key == 'Enter') {
|
if (event.key == 'Enter') {
|
||||||
this.okAddBookmark();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.okAddBookmark();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,46 +660,76 @@ class ExternalLibs extends Vue {
|
|||||||
if (!this.bookmarkLink)
|
if (!this.bookmarkLink)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const link = this.addProtocol(this.bookmarkLink);
|
const link = (this.addBookmarkMode == 'edit' ? lu.addProtocol(this.editBookmarkLink) : lu.addProtocol(this.bookmarkLink));
|
||||||
let index = -1;
|
let index = -1;
|
||||||
try {
|
try {
|
||||||
index = this.getRootIndexByUrl(this.libs.groups, link);
|
index = lu.getRootIndexByUrl(this.libs.groups, link);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await this.$root.stdDialog.alert('Неверный формат ссылки', 'Ошибка');
|
await this.$root.stdDialog.alert('Неверный формат ссылки', 'Ошибка');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let libs = _.cloneDeep(this.libs);
|
||||||
|
|
||||||
|
//добавление
|
||||||
//есть группа в закладках
|
//есть группа в закладках
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
const item = this.getListItemByLink(this.libs.groups[index].list, link);
|
const item = lu.getListItemByLink(libs.groups[index].list, link);
|
||||||
|
|
||||||
if (!item || item.c != this.bookmarkDesc) {
|
//редактирование
|
||||||
|
if (item && this.addBookmarkMode == 'edit') {
|
||||||
|
if (item) {
|
||||||
|
//редактируем
|
||||||
|
item.l = link;
|
||||||
|
item.c = this.bookmarkDesc;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
} else {
|
||||||
|
await this.$root.stdDialog.alert('Не удалось отредактировать закладку', 'Ошибка');
|
||||||
|
}
|
||||||
|
} else if (!item) {
|
||||||
//добавляем
|
//добавляем
|
||||||
let libs = _.cloneDeep(this.libs);
|
|
||||||
|
|
||||||
if (libs.groups[index].list.length >= 100) {
|
if (libs.groups[index].list.length >= 100) {
|
||||||
await this.$root.stdDialog.alert('Достигнут предел количества закладок для этого сайта', 'Ошибка');
|
await this.$root.stdDialog.alert('Достигнут предел количества закладок для этого сайта', 'Ошибка');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
libs.groups[index].list.push({l: link, c: this.bookmarkDesc});
|
libs.groups[index].list.push({l: link, c: this.bookmarkDesc});
|
||||||
|
|
||||||
|
if (this.openInFrameOnAdd) {
|
||||||
|
libs.startLink = link;
|
||||||
|
libs.comment = this.bookmarkDesc;
|
||||||
|
}
|
||||||
|
|
||||||
this.commitLibs(libs);
|
this.commitLibs(libs);
|
||||||
|
} else if (item.c != this.bookmarkDesc) {
|
||||||
|
if (await this.$root.stdDialog.confirm(`Такая закладка уже существует с другим описанием.<br>` +
|
||||||
|
`Заменить '${this.$sanitize(item.c)}' на '${this.$sanitize(this.bookmarkDesc)}'?`, ' ')) {
|
||||||
|
item.c = this.bookmarkDesc;
|
||||||
|
this.commitLibs(libs);
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
await this.$root.stdDialog.alert('Такая закладка уже существует', ' ');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else {//нет группы в закладках
|
} else {//нет группы в закладках
|
||||||
let libs = _.cloneDeep(this.libs);
|
|
||||||
|
|
||||||
if (libs.groups.length >= 100) {
|
if (libs.groups.length >= 100) {
|
||||||
await this.$root.stdDialog.alert('Достигнут предел количества различных сайтов в закладках', 'Ошибка');
|
await this.$root.stdDialog.alert('Достигнут предел количества различных сайтов в закладках', 'Ошибка');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//добавляем сначала группу
|
//добавляем сначала группу
|
||||||
libs.groups.push({r: this.getOrigin(link), s: link, list: []});
|
libs.groups.push({r: lu.getOrigin(link), s: link, list: []});
|
||||||
|
|
||||||
index = this.getRootIndexByUrl(libs.groups, link);
|
index = lu.getSafeRootIndexByUrl(libs.groups, link);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
libs.groups[index].list.push({l: link, c: this.bookmarkDesc});
|
libs.groups[index].list.push({l: link, c: this.bookmarkDesc});
|
||||||
|
|
||||||
|
if (this.openInFrameOnAdd) {
|
||||||
|
libs.startLink = link;
|
||||||
|
libs.comment = this.bookmarkDesc;
|
||||||
|
}
|
||||||
|
|
||||||
this.commitLibs(libs);
|
this.commitLibs(libs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +763,12 @@ class ExternalLibs extends Vue {
|
|||||||
|
|
||||||
bookUrlKeyDown(event) {
|
bookUrlKeyDown(event) {
|
||||||
if (event.key == 'Enter') {
|
if (event.key == 'Enter') {
|
||||||
this.submitUrl();
|
if (!this.openInFrameOnEnter) {
|
||||||
|
this.submitUrl();
|
||||||
|
} else {
|
||||||
|
if (this.bookUrl)
|
||||||
|
this.goToLink(this.bookUrl);
|
||||||
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -598,12 +784,34 @@ class ExternalLibs extends Vue {
|
|||||||
this.bookmarkSettingsActive = false;
|
this.bookmarkSettingsActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showHelp() {
|
||||||
|
this.$root.stdDialog.alert(`
|
||||||
|
<p>Окно 'Библиотека' позволяет открывать ссылки в читалке без переключения между окнами,
|
||||||
|
что особенно актуально для мобильных устройств.</p>
|
||||||
|
|
||||||
|
<p>'Библиотека' разрешает свободный доступ к сайту flibusta.is. Имеется возможность управлять закладками
|
||||||
|
на понравившиеся ресурсы, книги или страницы авторов. Открытие ссылок и навигация происходят во фрейме, но,
|
||||||
|
к сожалению, в нем открываются не все страницы.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Из-за проблем с безопасностью, навигация 'вперед-назад' во фрейме осуществляется с помощью контекстного меню правой кнопкой мыши.
|
||||||
|
На мобильных устройствах для этого служит системная клавиша 'Назад (стрелка влево)' и опция 'Вперед (стрелка вправо)' в меню браузера.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>Приятного пользования ;-)
|
||||||
|
</p>
|
||||||
|
`, 'Справка', {iconName: 'la la-info-circle'});
|
||||||
|
}
|
||||||
|
|
||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
if (this.$root.rootRoute() == '/external-libs') {
|
if (this.$root.rootRoute() == '/external-libs') {
|
||||||
|
if (this.$root.stdDialog.active)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (this.bookmarkSettingsActive && this.$refs.bookmarkSettings.keyHook(event))
|
if (this.bookmarkSettingsActive && this.$refs.bookmarkSettings.keyHook(event))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (this.$refs.dialogAddBookmark.active)
|
if (this.addBookmarkVisible || this.optionsVisible)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (event.type == 'keydown' && event.key == 'F4') {
|
if (event.type == 'keydown' && event.key == 'F4') {
|
||||||
@@ -621,7 +829,6 @@ class ExternalLibs extends Vue {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
48
client/components/ExternalLibs/linkUtils.js
Normal file
48
client/components/ExternalLibs/linkUtils.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
export function addProtocol(url) {
|
||||||
|
if ((url.indexOf('http://') != 0) && (url.indexOf('https://') != 0))
|
||||||
|
return 'http://' + url;
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeProtocol(url) {
|
||||||
|
return url.replace(/(^\w+:|^)\/\//, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrigin(url) {
|
||||||
|
const parsed = new URL(url);
|
||||||
|
return parsed.origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeOrigin(url) {
|
||||||
|
const parsed = new URL(url);
|
||||||
|
const result = url.substring(parsed.origin.length);
|
||||||
|
return (result ? result : '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRootIndexByUrl(groups, url) {
|
||||||
|
const origin = getOrigin(url);
|
||||||
|
for (let i = 0; i < groups.length; i++) {
|
||||||
|
if (groups[i].r == origin)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getSafeRootIndexByUrl(groups, url) {
|
||||||
|
let index = -1;
|
||||||
|
try {
|
||||||
|
index = getRootIndexByUrl(groups, url);
|
||||||
|
} catch(e) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getListItemByLink(list, link) {
|
||||||
|
for (const item of list) {
|
||||||
|
if (item.l == link)
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
207
client/components/Reader/ContentsPage/ContentsPage.vue
Normal file
207
client/components/Reader/ContentsPage/ContentsPage.vue
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
<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 class="row" v-for="item in contents" :key="item.key">
|
||||||
|
<q-expansion-item v-if="item.list.length"
|
||||||
|
class="item separator-bottom"
|
||||||
|
expand-icon-toggle
|
||||||
|
switch-toggle-side
|
||||||
|
expand-icon="la la-arrow-circle-down"
|
||||||
|
>
|
||||||
|
<template slot="header">
|
||||||
|
<div class="row no-wrap clickable" style="width: 465px" @click="setBookPos(item.offset)">
|
||||||
|
<div :style="item.style"></div>
|
||||||
|
<div class="q-mr-sm col overflow-hidden column justify-center" v-html="item.label"></div>
|
||||||
|
<div class="column justify-center">{{ item.perc }}%</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<q-item class="subitem separator-top column justify-center" v-for="subitem in item.list" :key="subitem.key">
|
||||||
|
<div class="row no-wrap clickable" style="padding-left: 55px; width: 520px" @click="setBookPos(subitem.offset)">
|
||||||
|
<div :style="subitem.style"></div>
|
||||||
|
<div class="q-mr-sm col overflow-hidden column justify-center" v-html="subitem.label"></div>
|
||||||
|
<div class="column justify-center">{{ subitem.perc }}%</div>
|
||||||
|
</div>
|
||||||
|
</q-item>
|
||||||
|
</q-expansion-item>
|
||||||
|
<q-item v-else class="item separator-bottom">
|
||||||
|
<div class="row no-wrap clickable" style="padding-left: 55px; width: 520px" @click="setBookPos(item.offset)">
|
||||||
|
<div :style="item.style"></div>
|
||||||
|
<div class="q-mr-sm col overflow-hidden column justify-center" v-html="item.label"></div>
|
||||||
|
<div class="column justify-center">{{ item.perc }}%</div>
|
||||||
|
</div>
|
||||||
|
</q-item>
|
||||||
|
</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) {
|
||||||
|
this.contents = [];
|
||||||
|
await this.$nextTick();
|
||||||
|
this.parsed = parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
const prepareLabel = (title, bolder = false) => {
|
||||||
|
let titleParts = title.split('<p>');
|
||||||
|
const textParts = titleParts.filter(v => v).map(v => `<div>${v.replace(/(<([^>]+)>)/ig, '')}</div>`);
|
||||||
|
if (bolder && textParts.length > 1)
|
||||||
|
textParts[0] = `<b>${textParts[0]}</b>`;
|
||||||
|
return textParts.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const insetStyle = inset => `width: ${inset*20}px`;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//формируем newContents
|
||||||
|
let i = 0;
|
||||||
|
const newContents = [];
|
||||||
|
newpc.forEach((cont) => {
|
||||||
|
const label = prepareLabel(cont.title, true);
|
||||||
|
const style = insetStyle(cont.inset);
|
||||||
|
|
||||||
|
let j = 0;
|
||||||
|
const list = [];
|
||||||
|
cont.subtitles.forEach((sub) => {
|
||||||
|
const l = prepareLabel(sub.title);
|
||||||
|
const s = insetStyle(sub.inset + 1);
|
||||||
|
const p = parsed.para[sub.paraIndex];
|
||||||
|
list.push({perc: (p.offset/parsed.textLength*100).toFixed(2), label: l, key: j, offset: p.offset, style: s});
|
||||||
|
j++;
|
||||||
|
});
|
||||||
|
|
||||||
|
const p = parsed.para[cont.paraIndex];
|
||||||
|
newContents.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, style, list});
|
||||||
|
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.contents = newContents;
|
||||||
|
}
|
||||||
|
|
||||||
|
async setBookPos(newValue) {
|
||||||
|
this.$emit('book-pos-changed', {bookPos: newValue});
|
||||||
|
await this.$nextTick();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item:hover {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subitem:hover {
|
||||||
|
background-color: #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator-top {
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
.separator-bottom {
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
</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>
|
||||||
@@ -407,7 +407,7 @@ class SettingsPage extends Vue {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Удаление профиля '${this.currentProfile}' необратимо.` +
|
const result = await this.$root.stdDialog.prompt(`<b>Предупреждение!</b> Удаление профиля '${this.$sanitize(this.currentProfile)}' необратимо.` +
|
||||||
`<br>Все настройки профиля будут потеряны, однако список читаемых книг сохранится.` +
|
`<br>Все настройки профиля будут потеряны, однако список читаемых книг сохранится.` +
|
||||||
`<br><br>Введите 'да' для подтверждения удаления:`, ' ', {
|
`<br><br>Введите 'да' для подтверждения удаления:`, ' ', {
|
||||||
inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Удаление не подтверждено'; },
|
inputValidator: (str) => { if (str && str.toLowerCase() === 'да') return true; else return 'Удаление не подтверждено'; },
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<q-select v-model="currentProfile" :options="currentProfileOptions"
|
<q-select v-model="currentProfile" :options="currentProfileOptions"
|
||||||
style="width: 275px"
|
style="width: 275px"
|
||||||
dropdown-icon="la la-angle-down la-sm"
|
dropdown-icon="la la-angle-down la-sm"
|
||||||
outlined dense emit-value map-options
|
outlined dense emit-value map-options display-value-sanitize options-sanitize
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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({});
|
||||||
@@ -198,6 +227,7 @@ export default class BookParser {
|
|||||||
if (!isFirstBody)
|
if (!isFirstBody)
|
||||||
newParagraph(' ', 1);
|
newParagraph(' ', 1);
|
||||||
isFirstBody = false;
|
isFirstBody = false;
|
||||||
|
bodyIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag == 'title') {
|
if (tag == 'title') {
|
||||||
@@ -205,12 +235,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 +266,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 +299,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 +318,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') {
|
||||||
|
|||||||
@@ -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)',
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div v-show="type == 'alert'" class="bg-white no-wrap">
|
<div v-show="type == 'alert'" class="bg-white no-wrap">
|
||||||
<div class="header row">
|
<div class="header row">
|
||||||
<div class="caption col row items-center q-ml-md">
|
<div class="caption col row items-center q-ml-md">
|
||||||
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
|
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" :name="iconName" size="28px"></q-icon>
|
||||||
<div v-html="caption"></div>
|
<div v-html="caption"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="close-icon column justify-center items-center">
|
<div class="close-icon column justify-center items-center">
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<div v-show="type == 'confirm'" class="bg-white no-wrap">
|
<div v-show="type == 'confirm'" class="bg-white no-wrap">
|
||||||
<div class="header row">
|
<div class="header row">
|
||||||
<div class="caption col row items-center q-ml-md">
|
<div class="caption col row items-center q-ml-md">
|
||||||
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
|
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" :name="iconName" size="28px"></q-icon>
|
||||||
<div v-html="caption"></div>
|
<div v-html="caption"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="close-icon column justify-center items-center">
|
<div class="close-icon column justify-center items-center">
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<div v-show="type == 'prompt'" class="bg-white no-wrap">
|
<div v-show="type == 'prompt'" class="bg-white no-wrap">
|
||||||
<div class="header row">
|
<div class="header row">
|
||||||
<div class="caption col row items-center q-ml-md">
|
<div class="caption col row items-center q-ml-md">
|
||||||
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
|
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" :name="iconName" size="28px"></q-icon>
|
||||||
<div v-html="caption"></div>
|
<div v-html="caption"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="close-icon column justify-center items-center">
|
<div class="close-icon column justify-center items-center">
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<div v-show="type == 'hotKey'" class="bg-white no-wrap">
|
<div v-show="type == 'hotKey'" class="bg-white no-wrap">
|
||||||
<div class="header row">
|
<div class="header row">
|
||||||
<div class="caption col row items-center q-ml-md">
|
<div class="caption col row items-center q-ml-md">
|
||||||
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" name="las la-exclamation-circle" size="28px"></q-icon>
|
<q-icon v-show="caption" class="q-mr-sm" :class="iconColor" :name="iconName" size="28px"></q-icon>
|
||||||
<div v-html="caption"></div>
|
<div v-html="caption"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="close-icon column justify-center items-center">
|
<div class="close-icon column justify-center items-center">
|
||||||
@@ -127,6 +127,7 @@ class StdDialog extends Vue {
|
|||||||
inputValue = '';
|
inputValue = '';
|
||||||
error = '';
|
error = '';
|
||||||
iconColor = '';
|
iconColor = '';
|
||||||
|
iconName = '';
|
||||||
hotKeyCode = '';
|
hotKeyCode = '';
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@@ -144,12 +145,18 @@ class StdDialog extends Vue {
|
|||||||
this.inputValidator = null;
|
this.inputValidator = null;
|
||||||
this.inputValue = '';
|
this.inputValue = '';
|
||||||
this.error = '';
|
this.error = '';
|
||||||
|
this.showed = false;
|
||||||
|
|
||||||
this.iconColor = 'text-warning';
|
this.iconColor = 'text-warning';
|
||||||
if (opts && opts.color) {
|
if (opts && opts.color) {
|
||||||
this.iconColor = `text-${opts.color}`;
|
this.iconColor = `text-${opts.color}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.iconName = 'las la-exclamation-circle';
|
||||||
|
if (opts && opts.iconName) {
|
||||||
|
this.iconName = opts.iconName;
|
||||||
|
}
|
||||||
|
|
||||||
this.hotKeyCode = '';
|
this.hotKeyCode = '';
|
||||||
if (opts && opts.hotKeyCode) {
|
if (opts && opts.hotKeyCode) {
|
||||||
this.hotKeyCode = opts.hotKeyCode;
|
this.hotKeyCode = opts.hotKeyCode;
|
||||||
@@ -161,6 +168,7 @@ class StdDialog extends Vue {
|
|||||||
this.hideTrigger();
|
this.hideTrigger();
|
||||||
this.hideTrigger = null;
|
this.hideTrigger = null;
|
||||||
}
|
}
|
||||||
|
this.showed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
@@ -170,6 +178,7 @@ class StdDialog extends Vue {
|
|||||||
this.validate(this.inputValue);
|
this.validate(this.inputValue);
|
||||||
this.$refs.input.focus();
|
this.$refs.input.focus();
|
||||||
}
|
}
|
||||||
|
this.showed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(value) {
|
validate(value) {
|
||||||
@@ -276,7 +285,7 @@ class StdDialog extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
keyHook(event) {
|
keyHook(event) {
|
||||||
if (this.active) {
|
if (this.active && this.showed) {
|
||||||
let handled = false;
|
let handled = false;
|
||||||
if (this.type == 'hotKey') {
|
if (this.type == 'hotKey') {
|
||||||
if (event.type == 'keydown') {
|
if (event.type == 'keydown') {
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ export default @Component({
|
|||||||
class Window extends Vue {
|
class Window extends Vue {
|
||||||
init() {
|
init() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
this.$refs.main.style.top = 0;
|
||||||
|
this.$refs.main.style.left = 0;
|
||||||
|
|
||||||
this.$refs.windowBox.style.height = this.height;
|
this.$refs.windowBox.style.height = this.height;
|
||||||
this.$refs.windowBox.style.width = this.width;
|
this.$refs.windowBox.style.width = this.width;
|
||||||
if (this.maxWidth)
|
if (this.maxWidth)
|
||||||
@@ -124,7 +127,6 @@ class Window extends Vue {
|
|||||||
.main {
|
.main {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.xyfit {
|
.xyfit {
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import router from './router';
|
|||||||
import store from './store';
|
import store from './store';
|
||||||
import './quasar';
|
import './quasar';
|
||||||
|
|
||||||
|
import vueSanitize from 'vue-sanitize';
|
||||||
|
Vue.use(vueSanitize);
|
||||||
|
|
||||||
import App from './components/App.vue';
|
import App from './components/App.vue';
|
||||||
//Vue.config.productionTip = false;
|
//Vue.config.productionTip = false;
|
||||||
Vue.prototype.$isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
|
Vue.prototype.$isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ import {QColor} from 'quasar/src/components/color';
|
|||||||
import {QPopupProxy} from 'quasar/src/components/popup-proxy';
|
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 {QExpansionItem} from 'quasar/src/components/expansion-item';
|
||||||
|
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
//QLayout,
|
//QLayout,
|
||||||
@@ -57,6 +60,8 @@ const components = {
|
|||||||
QPopupProxy,
|
QPopupProxy,
|
||||||
QDialog,
|
QDialog,
|
||||||
QChip,
|
QChip,
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
function addDefaultsToSettings(settings) {
|
const excludeDiffHotKeys = [];
|
||||||
const diff = utils.getObjDiff(settings, settingDefaults);
|
for (const hotKey of hotKeys)
|
||||||
|
excludeDiffHotKeys.push(`userHotKeys/${hotKey.name}`);
|
||||||
|
|
||||||
|
function addDefaultsToSettings(settings) {
|
||||||
|
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});
|
||||||
}
|
}
|
||||||
@@ -281,10 +288,15 @@ const libsDefaults = {
|
|||||||
startLink: 'http://flibusta.is',
|
startLink: 'http://flibusta.is',
|
||||||
comment: 'Флибуста | Книжное братство',
|
comment: 'Флибуста | Книжное братство',
|
||||||
closeAfterSubmit: false,
|
closeAfterSubmit: false,
|
||||||
|
openInFrameOnEnter: false,
|
||||||
|
openInFrameOnAdd: false,
|
||||||
groups: [
|
groups: [
|
||||||
{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://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: 'Журнал "Самиздат"'},
|
||||||
]},
|
]},
|
||||||
|
|||||||
175
package-lock.json
generated
175
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": {
|
||||||
@@ -36,12 +36,6 @@
|
|||||||
"pkg-up": "^2.0.0"
|
"pkg-up": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
|
||||||
"version": "1.0.30001062",
|
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001062.tgz",
|
|
||||||
"integrity": "sha512-ei9ZqeOnN7edDrb24QfJ0OZicpEbsWxv7WusOiQGz/f2SfvBgHHbOEwBJ8HKGVSyx8Z6ndPjxzR6m0NQq+0bfw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.446",
|
"version": "1.3.446",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
||||||
@@ -321,12 +315,6 @@
|
|||||||
"pkg-up": "^2.0.0"
|
"pkg-up": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
|
||||||
"version": "1.0.30001062",
|
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001062.tgz",
|
|
||||||
"integrity": "sha512-ei9ZqeOnN7edDrb24QfJ0OZicpEbsWxv7WusOiQGz/f2SfvBgHHbOEwBJ8HKGVSyx8Z6ndPjxzR6m0NQq+0bfw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.446",
|
"version": "1.3.446",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
||||||
@@ -1603,12 +1591,6 @@
|
|||||||
"pkg-up": "^2.0.0"
|
"pkg-up": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
|
||||||
"version": "1.0.30001062",
|
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001062.tgz",
|
|
||||||
"integrity": "sha512-ei9ZqeOnN7edDrb24QfJ0OZicpEbsWxv7WusOiQGz/f2SfvBgHHbOEwBJ8HKGVSyx8Z6ndPjxzR6m0NQq+0bfw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.446",
|
"version": "1.3.446",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
||||||
@@ -4017,9 +3999,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
"caniuse-lite": {
|
||||||
"version": "1.0.30000989",
|
"version": "1.0.30001154",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001154.tgz",
|
||||||
"integrity": "sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw==",
|
"integrity": "sha512-y9DvdSti8NnYB9Be92ddMZQrcOe04kcQtcxtBx4NkB04+qZ+JUWotnXBJTmxlKudhxNTQ3RRknMwNU2YQl/Org==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"caseless": {
|
"caseless": {
|
||||||
@@ -4373,6 +4355,11 @@
|
|||||||
"simple-swizzle": "^0.2.2"
|
"simple-swizzle": "^0.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"colorette": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw=="
|
||||||
|
},
|
||||||
"combined-stream": {
|
"combined-stream": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
@@ -4759,12 +4746,6 @@
|
|||||||
"pkg-up": "^2.0.0"
|
"pkg-up": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"caniuse-lite": {
|
|
||||||
"version": "1.0.30001062",
|
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001062.tgz",
|
|
||||||
"integrity": "sha512-ei9ZqeOnN7edDrb24QfJ0OZicpEbsWxv7WusOiQGz/f2SfvBgHHbOEwBJ8HKGVSyx8Z6ndPjxzR6m0NQq+0bfw==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.446",
|
"version": "1.3.446",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.446.tgz",
|
||||||
@@ -8696,6 +8677,11 @@
|
|||||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"klona": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/klona/-/klona-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA=="
|
||||||
|
},
|
||||||
"last-call-webpack-plugin": {
|
"last-call-webpack-plugin": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz",
|
||||||
@@ -8790,6 +8776,30 @@
|
|||||||
"immediate": "~3.0.5"
|
"immediate": "~3.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"line-column": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-0lryk2tvSEkXKzEuR5LR2Ye8NKI=",
|
||||||
|
"requires": {
|
||||||
|
"isarray": "^1.0.0",
|
||||||
|
"isobject": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"isobject": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
|
||||||
|
"integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=",
|
||||||
|
"requires": {
|
||||||
|
"isarray": "1.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"loader-runner": {
|
"loader-runner": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.4.0.tgz",
|
||||||
@@ -9372,6 +9382,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
|
||||||
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
|
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
|
||||||
},
|
},
|
||||||
|
"nanoid": {
|
||||||
|
"version": "3.1.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.16.tgz",
|
||||||
|
"integrity": "sha512-+AK8MN0WHji40lj8AEuwLOvLSbWYApQpre/aFJZD71r43wVRLrOYS4FmJOPQYon1TqB462RzrrxlfA74XRES8w=="
|
||||||
|
},
|
||||||
"nanomatch": {
|
"nanomatch": {
|
||||||
"version": "1.2.13",
|
"version": "1.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
||||||
@@ -10010,6 +10025,11 @@
|
|||||||
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
|
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"parse-srcset": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-8r0iH2zJcKk42IVWq8WJyqqiveE="
|
||||||
|
},
|
||||||
"parseurl": {
|
"parseurl": {
|
||||||
"version": "1.3.3",
|
"version": "1.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||||
@@ -13306,6 +13326,97 @@
|
|||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
|
"sanitize-html": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-yb+I+K25cn6PzsRJb+kGdlOBC3SkvEwJrr/Xl+6YR42oDZDeu61yWeEMSEi0hCKlRSYlWWE4tUnF2Ds+c/M1Vg==",
|
||||||
|
"requires": {
|
||||||
|
"deepmerge": "^4.2.2",
|
||||||
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
"htmlparser2": "^4.1.0",
|
||||||
|
"is-plain-object": "^5.0.0",
|
||||||
|
"klona": "^2.0.3",
|
||||||
|
"parse-srcset": "^1.0.2",
|
||||||
|
"postcss": "^8.0.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"dom-serializer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-ox7bvGXt2n+uLWtCRLybYx60IrOlWL/aCebWJk1T0d4m3y2tzf4U3ij9wBMUb6YJZpz06HCCYuyCDveE2xXmzQ==",
|
||||||
|
"requires": {
|
||||||
|
"domelementtype": "^2.0.1",
|
||||||
|
"domhandler": "^3.0.0",
|
||||||
|
"entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domelementtype": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA=="
|
||||||
|
},
|
||||||
|
"domhandler": {
|
||||||
|
"version": "3.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-3.3.0.tgz",
|
||||||
|
"integrity": "sha512-J1C5rIANUbuYK+FuFL98650rihynUOEzRLxW+90bKZRWB6A1X1Tf82GxR1qAWLyfNPRvjqfip3Q5tdYlmAa9lA==",
|
||||||
|
"requires": {
|
||||||
|
"domelementtype": "^2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domutils": {
|
||||||
|
"version": "2.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.4.2.tgz",
|
||||||
|
"integrity": "sha512-NKbgaM8ZJOecTZsIzW5gSuplsX2IWW2mIK7xVr8hTQF2v1CJWTmLZ1HOCh5sH+IzVPAGE5IucooOkvwBRAdowA==",
|
||||||
|
"requires": {
|
||||||
|
"dom-serializer": "^1.0.1",
|
||||||
|
"domelementtype": "^2.0.1",
|
||||||
|
"domhandler": "^3.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"entities": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w=="
|
||||||
|
},
|
||||||
|
"escape-string-regexp": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="
|
||||||
|
},
|
||||||
|
"htmlparser2": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-4zDq1a1zhE4gQso/c5LP1OtrhYTncXNSpvJYtWJBtXAETPlMfi3IFNjGuQbYLuVY4ZR0QMqRVvo4Pdy9KLyP8Q==",
|
||||||
|
"requires": {
|
||||||
|
"domelementtype": "^2.0.1",
|
||||||
|
"domhandler": "^3.0.0",
|
||||||
|
"domutils": "^2.0.0",
|
||||||
|
"entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-plain-object": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||||
|
},
|
||||||
|
"postcss": {
|
||||||
|
"version": "8.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.1.4.tgz",
|
||||||
|
"integrity": "sha512-LfqcwgMq9LOd8pX7K2+r2HPitlIGC5p6PoZhVELlqhh2YGDVcXKpkCseqan73Hrdik6nBd2OvoDPUaP/oMj9hQ==",
|
||||||
|
"requires": {
|
||||||
|
"colorette": "^1.2.1",
|
||||||
|
"line-column": "^1.0.2",
|
||||||
|
"nanoid": "^3.1.15",
|
||||||
|
"source-map": "^0.6.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source-map": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"sax": {
|
"sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
@@ -15193,6 +15304,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz",
|
||||||
"integrity": "sha512-GYhn2ynaZlysZMkFE5oCHRUTqE8BWs/a9YbKpNLi0i7xD6KG1EzDqpHQmv1F5gXjr8kL5iIVS8EOtRaVUEXTqA=="
|
"integrity": "sha512-GYhn2ynaZlysZMkFE5oCHRUTqE8BWs/a9YbKpNLi0i7xD6KG1EzDqpHQmv1F5gXjr8kL5iIVS8EOtRaVUEXTqA=="
|
||||||
},
|
},
|
||||||
|
"vue-sanitize": {
|
||||||
|
"version": "0.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/vue-sanitize/-/vue-sanitize-0.2.1.tgz",
|
||||||
|
"integrity": "sha512-MhrfAaAqIQ8JXWfdlhK6f+H2WnZ7KQwkOgLNeUyfACI2bq/3HPZ2zeUQDathnLdsXMXAa8pJehOgPYtlaG9Jew==",
|
||||||
|
"requires": {
|
||||||
|
"sanitize-html": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vue-style-loader": {
|
"vue-style-loader": {
|
||||||
"version": "4.1.2",
|
"version": "4.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.2.tgz",
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -81,6 +81,7 @@
|
|||||||
"unbzip2-stream": "^1.3.3",
|
"unbzip2-stream": "^1.3.3",
|
||||||
"vue": "github:bookpauk/vue",
|
"vue": "github:bookpauk/vue",
|
||||||
"vue-router": "^3.1.6",
|
"vue-router": "^3.1.6",
|
||||||
|
"vue-sanitize": "^0.2.1",
|
||||||
"vuex": "^3.1.2",
|
"vuex": "^3.1.2",
|
||||||
"vuex-persistedstate": "^2.7.1",
|
"vuex-persistedstate": "^2.7.1",
|
||||||
"webdav": "^2.10.2",
|
"webdav": "^2.10.2",
|
||||||
|
|||||||
@@ -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