Рефакторинг, версия 0.9.6
This commit is contained in:
@@ -96,64 +96,7 @@
|
|||||||
<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>
|
||||||
|
|
||||||
<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 +121,12 @@ 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 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 +143,7 @@ export default @Component({
|
|||||||
HelpPage,
|
HelpPage,
|
||||||
ClickMapPage,
|
ClickMapPage,
|
||||||
ServerStorage,
|
ServerStorage,
|
||||||
Dialog,
|
ReaderDialogs,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
bookPos: function(newValue) {
|
bookPos: function(newValue) {
|
||||||
@@ -339,8 +281,7 @@ class Reader extends Vue {
|
|||||||
|
|
||||||
this.updateRoute();
|
this.updateRoute();
|
||||||
|
|
||||||
await this.showWhatsNew();
|
await this.$refs.dialogs.init();
|
||||||
await this.showDonation();
|
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,8 +292,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 +355,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 +458,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) {
|
||||||
@@ -1228,9 +1101,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);
|
||||||
|
|
||||||
@@ -1339,16 +1215,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>
|
||||||
|
|||||||
201
client/components/Reader/ReaderDialogs/ReaderDialogs.vue
Normal file
201
client/components/Reader/ReaderDialogs/ReaderDialogs.vue
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
<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>
|
||||||
|
</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;
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.commit = this.$store.commit;
|
||||||
|
this.loadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
await this.showWhatsNew();
|
||||||
|
await this.showDonation();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadSettings() {
|
||||||
|
const settings = this.settings;
|
||||||
|
this.showWhatsNewDialog = settings.showWhatsNewDialog;
|
||||||
|
this.showDonationDialog2020 = settings.showDonationDialog2020;
|
||||||
|
}
|
||||||
|
|
||||||
|
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.$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
keyHook() {
|
||||||
|
if (this.$refs.dialog1.active || this.$refs.dialog2.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>
|
||||||
@@ -1,4 +1,16 @@
|
|||||||
export const versionHistory = [
|
export const versionHistory = [
|
||||||
|
{
|
||||||
|
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)',
|
||||||
|
|||||||
Reference in New Issue
Block a user