Работа над LibsPage
This commit is contained in:
@@ -125,10 +125,7 @@ class ExternalLibs extends Vue {
|
||||
}
|
||||
|
||||
while(this.opener) {
|
||||
if (this.opener.closed) {
|
||||
await this.$root.stdDialog.alert('Потеряна связь с читалкой. Окно будет закрыто', 'Ошибка');
|
||||
window.close();
|
||||
}
|
||||
await this.checkOpener();
|
||||
await utils.sleep(1000);
|
||||
}
|
||||
})();
|
||||
@@ -143,12 +140,24 @@ class ExternalLibs extends Vue {
|
||||
this.ready = true;
|
||||
this.libs = _.cloneDeep(d.data);
|
||||
this.goToStartLink();
|
||||
} else if (d.type == 'notify') {
|
||||
this.$root.notify.success(d.data);
|
||||
}
|
||||
}
|
||||
|
||||
sendMessage(d) {
|
||||
if (this.opener && this.openerOrigin)
|
||||
this.opener.postMessage(Object.assign({}, {from: 'ExternalLibs'}, d), this.openerOrigin);
|
||||
(async() => {
|
||||
await this.checkOpener();
|
||||
if (this.opener && this.openerOrigin)
|
||||
this.opener.postMessage(Object.assign({}, {from: 'ExternalLibs'}, d), this.openerOrigin);
|
||||
})();
|
||||
}
|
||||
|
||||
async checkOpener() {
|
||||
if (this.opener.closed) {
|
||||
await this.$root.stdDialog.alert('Потеряна связь с читалкой. Окно будет закрыто', 'Ошибка');
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
commitLibs(libs) {
|
||||
@@ -283,8 +292,10 @@ class ExternalLibs extends Vue {
|
||||
|
||||
submitUrl() {
|
||||
if (this.bookUrl) {
|
||||
this.$emit('load-book', {url: this.addProtocol(this.bookUrl), force: true});
|
||||
this.sendMessage({type: 'submitUrl', data: {url: this.addProtocol(this.bookUrl), force: true}});
|
||||
this.bookUrl = '';
|
||||
if (this.libs.closeAfterSubmit)
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,9 @@ class LibsPage extends Vue {
|
||||
this.commit('reader/setLibs', d.data);
|
||||
} else if (d.type == 'close') {
|
||||
this.close();
|
||||
} else if (d.type == 'submitUrl') {
|
||||
this.$emit('load-book', d.data);
|
||||
this.sendMessage({type: 'notify', data: 'Ссылка передана в читалку'});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,13 +108,6 @@ class LibsPage extends Vue {
|
||||
this.sendMessage({type: 'libs', data: this.libs});
|
||||
}
|
||||
|
||||
/* submitUrl() {
|
||||
if (this.bookUrl) {
|
||||
this.$emit('load-book', {url: this.addProtocol(this.bookUrl), force: true});
|
||||
this.bookUrl = '';
|
||||
}
|
||||
}*/
|
||||
|
||||
close() {
|
||||
this.$emit('libs-close');
|
||||
}
|
||||
|
||||
@@ -256,6 +256,7 @@ const settingDefaults = {
|
||||
const libsDefaults = {
|
||||
startLink: 'http://flibusta.is',
|
||||
comment: 'Флибуста | Книжное братство',
|
||||
closeAfterSubmit: false,
|
||||
groups: [
|
||||
{r: 'http://flibusta.is', s: 'http://flibusta.is', list: [
|
||||
{l: 'http://flibusta.is', c: 'Флибуста | Книжное братство'},
|
||||
|
||||
Reference in New Issue
Block a user