diff --git a/client/components/App.vue b/client/components/App.vue
index a4b4453f..c7eea00d 100644
--- a/client/components/App.vue
+++ b/client/components/App.vue
@@ -52,6 +52,7 @@
+
@@ -63,11 +64,13 @@
//-----------------------------------------------------------------------------
import Vue from 'vue';
import Component from 'vue-class-component';
+import Notify from './share/Notify.vue';
import StdDialog from './share/StdDialog.vue';
import * as utils from '../share/utils';
export default @Component({
components: {
+ Notify,
StdDialog,
},
watch: {
@@ -140,7 +143,9 @@ class App extends Vue {
}
mounted() {
+ this.$root.notify = this.$refs.notify;
this.$root.stdDialog = this.$refs.stdDialog;
+
this.dispatch('config/loadConfig');
this.$watch('apiError', function(newError) {
if (newError) {
diff --git a/client/components/Reader/HelpPage/CommonHelpPage/CommonHelpPage.vue b/client/components/Reader/HelpPage/CommonHelpPage/CommonHelpPage.vue
index 0fa36eea..ab945a71 100644
--- a/client/components/Reader/HelpPage/CommonHelpPage/CommonHelpPage.vue
+++ b/client/components/Reader/HelpPage/CommonHelpPage/CommonHelpPage.vue
@@ -45,7 +45,6 @@ import Vue from 'vue';
import Component from 'vue-class-component';
import {copyTextToClipboard} from '../../../../share/utils';
-import * as notify from '../../../share/notify';
export default @Component({
})
@@ -61,9 +60,9 @@ class CommonHelpPage extends Vue {
const result = await copyTextToClipboard(text);
const msg = (result ? mes : 'Копирование не удалось');
if (result)
- notify.success(this, msg);
+ this.$root.notify.success(msg);
else
- notify.error(this, msg);
+ this.$root.notify.error(msg);
}
}
//-----------------------------------------------------------------------------
diff --git a/client/components/Reader/HelpPage/DonateHelpPage/DonateHelpPage.vue b/client/components/Reader/HelpPage/DonateHelpPage/DonateHelpPage.vue
index 09f850a6..b3994dc4 100644
--- a/client/components/Reader/HelpPage/DonateHelpPage/DonateHelpPage.vue
+++ b/client/components/Reader/HelpPage/DonateHelpPage/DonateHelpPage.vue
@@ -56,7 +56,6 @@
import Vue from 'vue';
import Component from 'vue-class-component';
import {copyTextToClipboard} from '../../../../share/utils';
-import * as notify from '../../../share/notify';
export default @Component({
})
@@ -77,9 +76,9 @@ class DonateHelpPage extends Vue {
async copyAddress(address, prefix) {
const result = await copyTextToClipboard(address);
if (result)
- notify.success(this, `${prefix} ${address} успешно скопирован в буфер обмена`);
+ this.$root.notify.success(`${prefix} ${address} успешно скопирован в буфер обмена`);
else
- notify.error(this, 'Копирование не удалось');
+ this.$root.notify.error('Копирование не удалось');
}
}
//-----------------------------------------------------------------------------
diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue
index 51e0fa6a..fdce9186 100644
--- a/client/components/Reader/Reader.vue
+++ b/client/components/Reader/Reader.vue
@@ -432,9 +432,9 @@ class Reader extends Vue {
async copyLink(link) {
const result = await utils.copyTextToClipboard(link);
if (result)
- this.$notify.success({message: `Ссылка ${link} успешно скопирована в буфер обмена`});
+ this.$root.notify.success(`Ссылка ${link} успешно скопирована в буфер обмена`);
else
- this.$notify.error({message: 'Копирование не удалось'});
+ this.$root.notify.error('Копирование не удалось');
}
openVersionHistory() {
diff --git a/client/components/Reader/SettingsPage/SettingsPage.vue b/client/components/Reader/SettingsPage/SettingsPage.vue
index 89143ee5..93349bb4 100644
--- a/client/components/Reader/SettingsPage/SettingsPage.vue
+++ b/client/components/Reader/SettingsPage/SettingsPage.vue
@@ -78,7 +78,6 @@ import Window from '../../share/Window.vue';
import NumInput from '../../share/NumInput.vue';
import rstore from '../../../store/modules/reader';
import defPalette from './defPalette';
-import * as notify from '../../share/notify';
const hex = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
@@ -332,11 +331,11 @@ class SettingsPage extends Vue {
}
needReload() {
- notify.warning(this, 'Необходимо обновить страницу (F5), чтобы изменения возымели эффект');
+ this.$root.notify.warning('Необходимо обновить страницу (F5), чтобы изменения возымели эффект');
}
needTextReload() {
- notify.warning(this, 'Необходимо обновить книгу в обход кэша, чтобы изменения возымели эффект');
+ this.$root.notify.warning('Необходимо обновить книгу в обход кэша, чтобы изменения возымели эффект');
}
close() {
@@ -443,9 +442,9 @@ class SettingsPage extends Vue {
const suf = (prefix.substr(-1) == 'а' ? 'а' : '');
const msg = (result ? `${prefix} успешно скопирован${suf} в буфер обмена` : 'Копирование не удалось');
if (result)
- notify.success(this, msg);
+ this.$root.notify.success(msg);
else
- notify.error(this, msg);
+ this.$root.notify.error(msg);
}
async showServerStorageKey() {
diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue
index 0762ff94..87c24943 100644
--- a/client/components/Reader/TextPage/TextPage.vue
+++ b/client/components/Reader/TextPage/TextPage.vue
@@ -39,7 +39,6 @@ import Component from 'vue-class-component';
import {loadCSS} from 'fg-loadcss';
import _ from 'lodash';
-import * as notify from '../../share/notify';
import {sleep} from '../../../share/utils';
import bookManager from '../share/bookManager';
import DrawHelper from './DrawHelper';
@@ -287,7 +286,7 @@ class TextPage extends Vue {
(async() => {
await sleep(500);
if (this.fontsLoading)
- close = notify.info(this, 'Загрузка шрифта ');
+ close = this.$root.notify.info('Загрузка шрифта ');
})();
if (!this.fontsLoaded)
@@ -302,7 +301,7 @@ class TextPage extends Vue {
try {
await this.checkLoadedFonts();
} catch (e) {
- notify.error(this, 'Некоторые шрифты не удалось загрузить', 'Ошибка загрузки');
+ this.$root.notify.error('Некоторые шрифты не удалось загрузить', 'Ошибка загрузки');
}
this.fontsLoading = false;
diff --git a/client/components/share/Notify.vue b/client/components/share/Notify.vue
new file mode 100644
index 00000000..67b5b327
--- /dev/null
+++ b/client/components/share/Notify.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
diff --git a/client/components/share/notify.js b/client/components/share/notify.js
deleted file mode 100644
index 49c0c806..00000000
--- a/client/components/share/notify.js
+++ /dev/null
@@ -1,43 +0,0 @@
-export function notify(vue, opts) {
- let {
- caption = null,
- captionColor = 'black',
- color = 'positive',
- icon = '',
- iconColor = 'white',
- message = '',
- messageColor = 'black',
- } = opts;
-
- caption = (caption ? `${caption}
` : '');
- return vue.$q.notify({
- position: 'top-right',
- color,
- textColor: iconColor,
- icon,
- actions: [{icon: 'la la-times notify-button-icon', color: 'black'}],
- html: true,
-
- message:
- `
- ${caption}
-
${message}
-
`
- });
-}
-
-export function success(vue, message, caption) {
- notify(vue, {color: 'positive', icon: 'la la-check-circle', message, caption});
-}
-
-export function warning(vue, message, caption) {
- notify(vue, {color: 'warning', icon: 'la la-exclamation-circle', message, caption});
-}
-
-export function error(vue, message, caption) {
- notify(vue, {color: 'negative', icon: 'la la-exclamation-circle', messageColor: 'yellow', message, caption});
-}
-
-export function info(vue, message, caption) {
- notify(vue, {color: 'info', icon: 'la la-bell', message, caption});
-}