Работа над LibsPage
This commit is contained in:
@@ -4,6 +4,13 @@
|
|||||||
{{ header }}
|
{{ header }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template slot="buttons">
|
||||||
|
<span class="full-screen-button row justify-center items-center" @mousedown.stop @click="fullScreenToggle">
|
||||||
|
<q-icon :name="(fullScreenActive ? 'la la-compress-arrows-alt': 'la la-expand-arrows-alt')" size="16px"/>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">На весь экран</q-tooltip>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
<div v-show="ready" class="col column" style="min-width: 600px">
|
<div v-show="ready" class="col column" style="min-width: 600px">
|
||||||
<div class="row items-center q-px-sm" style="height: 50px">
|
<div class="row items-center q-px-sm" style="height: 50px">
|
||||||
<q-select class="q-mr-sm" v-model="rootLink" :options="rootLinkOptions"
|
<q-select class="q-mr-sm" v-model="rootLink" :options="rootLinkOptions"
|
||||||
@@ -12,8 +19,12 @@
|
|||||||
rounded outlined dense emit-value map-options display-value-sanitize options-sanitize
|
rounded outlined dense emit-value map-options display-value-sanitize options-sanitize
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" size="12px"/>
|
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" @click="addBookmark" size="12px">
|
||||||
<q-btn round dense color="blue" icon="la la-bars" size="12px"/>
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Добавить закладку</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
<q-btn round dense color="blue" icon="la la-bars" size="12px" disabled>
|
||||||
|
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Настроить закладки (пока недоступно)</q-tooltip>
|
||||||
|
</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;">{{ removeProtocol(rootLink) }}</div>
|
||||||
@@ -39,7 +50,7 @@
|
|||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
<iframe v-if="frameVisible" class="col fit" ref="frame" :src="frameSrc" sandbox="allow-same-origin" frameborder="0"></iframe>
|
<iframe v-if="frameVisible" class="col fit" ref="frame" :src="frameSrc" frameborder="0"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</Window>
|
</Window>
|
||||||
</template>
|
</template>
|
||||||
@@ -53,6 +64,10 @@ import _ from 'lodash';
|
|||||||
import Window from '../share/Window.vue';
|
import Window from '../share/Window.vue';
|
||||||
import * as utils from '../../share/utils';
|
import * as utils from '../../share/utils';
|
||||||
|
|
||||||
|
const proxySubst = {
|
||||||
|
'http://flibusta.is': 'http://b.liberama.top:23480',
|
||||||
|
};
|
||||||
|
|
||||||
export default @Component({
|
export default @Component({
|
||||||
components: {
|
components: {
|
||||||
Window
|
Window
|
||||||
@@ -79,9 +94,11 @@ class ExternalLibs extends Vue {
|
|||||||
frameSrc = '';
|
frameSrc = '';
|
||||||
bookUrl = '';
|
bookUrl = '';
|
||||||
libs = {};
|
libs = {};
|
||||||
|
fullScreenActive = false;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.$root.addKeyHook(this.keyHook);
|
this.$root.addKeyHook(this.keyHook);
|
||||||
|
|
||||||
//this.commit = this.$store.commit;
|
//this.commit = this.$store.commit;
|
||||||
//this.commit('reader/setLibs', rstore.libsDefaults);
|
//this.commit('reader/setLibs', rstore.libsDefaults);
|
||||||
}
|
}
|
||||||
@@ -237,7 +254,7 @@ class ExternalLibs extends Vue {
|
|||||||
if (!this.ready)
|
if (!this.ready)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.frameSrc = this.libs.startLink;
|
this.frameSrc = this.makeProxySubst(this.libs.startLink);
|
||||||
this.frameVisible = false;
|
this.frameVisible = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.frameVisible = true;
|
this.frameVisible = true;
|
||||||
@@ -285,19 +302,46 @@ class ExternalLibs extends Vue {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makeProxySubst(url, reverse = false) {
|
||||||
|
for (const [key, value] of Object.entries(proxySubst)) {
|
||||||
|
if (reverse && value == url.substring(0, value.length)) {
|
||||||
|
return key + url.substring(value.length);
|
||||||
|
} else if (key == url.substring(0, key.length)) {
|
||||||
|
return value + url.substring(key.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
onInputFocus() {
|
onInputFocus() {
|
||||||
this.$refs.input.select();
|
this.$refs.input.select();
|
||||||
}
|
}
|
||||||
|
|
||||||
submitUrl() {
|
submitUrl() {
|
||||||
if (this.bookUrl) {
|
if (this.bookUrl) {
|
||||||
this.sendMessage({type: 'submitUrl', data: {url: this.addProtocol(this.bookUrl), force: true}});
|
this.sendMessage({type: 'submitUrl', data: {
|
||||||
|
url: this.makeProxySubst(this.addProtocol(this.bookUrl), true),
|
||||||
|
force: true
|
||||||
|
}});
|
||||||
this.bookUrl = '';
|
this.bookUrl = '';
|
||||||
if (this.libs.closeAfterSubmit)
|
if (this.libs.closeAfterSubmit)
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addBookmark() {
|
||||||
|
}
|
||||||
|
|
||||||
|
fullScreenToggle() {
|
||||||
|
this.fullScreenActive = !this.fullScreenActive;
|
||||||
|
if (this.fullScreenActive) {
|
||||||
|
this.$q.fullscreen.request();
|
||||||
|
} else {
|
||||||
|
this.$q.fullscreen.exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.sendMessage({type: 'close'});
|
this.sendMessage({type: 'close'});
|
||||||
}
|
}
|
||||||
@@ -325,4 +369,15 @@ class ExternalLibs extends Vue {
|
|||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: #A0A0A0;
|
background-color: #A0A0A0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.full-screen-button {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-screen-button:hover {
|
||||||
|
background-color: #69C05F;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
@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"></LibsPage>
|
<LibsPage v-show="libsActive" 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>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<div ref="header" class="header row justify-end" @mousedown.prevent.stop="onMouseDown"
|
<div ref="header" class="header row justify-end" @mousedown.prevent.stop="onMouseDown"
|
||||||
@touchstart.stop="onTouchStart" @touchend.stop="onTouchEnd" @touchmove.stop="onTouchMove">
|
@touchstart.stop="onTouchStart" @touchend.stop="onTouchEnd" @touchmove.stop="onTouchMove">
|
||||||
<span class="header-text col"><slot name="header"></slot></span>
|
<span class="header-text col"><slot name="header"></slot></span>
|
||||||
|
<slot name="buttons"></slot>
|
||||||
<span class="close-button row justify-center items-center" @mousedown.stop @click="close"><q-icon name="la la-times" size="16px"/></span>
|
<span class="close-button row justify-center items-center" @mousedown.stop @click="close"><q-icon name="la la-times" size="16px"/></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -264,6 +264,9 @@ const libsDefaults = {
|
|||||||
{r: 'http://samlib.ru', s: 'http://samlib.ru', list: [
|
{r: 'http://samlib.ru', s: 'http://samlib.ru', list: [
|
||||||
{l: 'http://samlib.ru', c: 'Журнал "Самиздат"'},
|
{l: 'http://samlib.ru', c: 'Журнал "Самиздат"'},
|
||||||
]},
|
]},
|
||||||
|
{r: 'http://lib.ru', s: 'http://lib.ru', list: [
|
||||||
|
{l: 'http://lib.ru', c: 'Библиотека Максима Мошкова'},
|
||||||
|
]},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user