|
@@ -7,35 +7,35 @@
|
|
|
</el-tooltip>
|
|
|
|
|
|
<div>
|
|
|
- <el-tooltip content="Действие назад" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['undoAction']" content="Действие назад" :open-delay="1000" effect="light">
|
|
|
<el-button ref="undoAction" class="tool-button" :class="buttonActiveClass('undoAction')" @click="buttonClick('undoAction')" ><i class="el-icon-arrow-left"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Действие вперед" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['redoAction']" content="Действие вперед" :open-delay="1000" effect="light">
|
|
|
<el-button ref="redoAction" class="tool-button" :class="buttonActiveClass('redoAction')" @click="buttonClick('redoAction')" ><i class="el-icon-arrow-right"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
<div class="space"></div>
|
|
|
- <el-tooltip content="На весь экран" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['fullScreen']" content="На весь экран" :open-delay="1000" effect="light">
|
|
|
<el-button ref="fullScreen" class="tool-button" :class="buttonActiveClass('fullScreen')" @click="buttonClick('fullScreen')"><i class="el-icon-rank"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Плавный скроллинг" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['scrolling']" content="Плавный скроллинг" :open-delay="1000" effect="light">
|
|
|
<el-button ref="scrolling" class="tool-button" :class="buttonActiveClass('scrolling')" @click="buttonClick('scrolling')"><i class="el-icon-sort"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Перелистнуть" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['setPosition']" content="На страницу" :open-delay="1000" effect="light">
|
|
|
<el-button ref="setPosition" class="tool-button" :class="buttonActiveClass('setPosition')" @click="buttonClick('setPosition')"><i class="el-icon-d-arrow-right"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Найти в тексте" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['search']" content="Найти в тексте" :open-delay="1000" effect="light">
|
|
|
<el-button ref="search" class="tool-button" :class="buttonActiveClass('search')" @click="buttonClick('search')"><i class="el-icon-search"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Скопировать текст со страницы" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['copyText']" content="Скопировать текст со страницы" :open-delay="1000" effect="light">
|
|
|
<el-button ref="copyText" class="tool-button" :class="buttonActiveClass('copyText')" @click="buttonClick('copyText')"><i class="el-icon-edit-outline"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
- <el-tooltip content="Принудительно обновить книгу в обход кэша" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['refresh']" content="Принудительно обновить книгу в обход кэша" :open-delay="1000" effect="light">
|
|
|
<el-button ref="refresh" class="tool-button" :class="buttonActiveClass('refresh')" @click="buttonClick('refresh')">
|
|
|
<i class="el-icon-refresh" :class="{clear: !showRefreshIcon}"></i>
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
<div class="space"></div>
|
|
|
- <el-tooltip content="Открыть недавние" :open-delay="1000" effect="light">
|
|
|
+ <el-tooltip v-show="showToolButton['history']" content="Открыть недавние" :open-delay="1000" effect="light">
|
|
|
<el-button ref="history" class="tool-button" :class="buttonActiveClass('history')" @click="buttonClick('history')"><i class="el-icon-document"></i></el-button>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
@@ -68,13 +68,27 @@
|
|
|
@start-text-search="startTextSearch"
|
|
|
@stop-text-search="stopTextSearch">
|
|
|
</SearchPage>
|
|
|
- <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>
|
|
|
+ <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>
|
|
|
<HistoryPage v-show="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
|
|
|
<SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
|
|
|
<HelpPage v-if="helpActive" ref="helpPage" @help-toggle="helpToggle"></HelpPage>
|
|
|
<ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
|
|
|
<ServerStorage v-show="hidden" ref="serverStorage"></ServerStorage>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ title="Что нового:"
|
|
|
+ :visible.sync="whatsNewVisible"
|
|
|
+ width="80%">
|
|
|
+ <div style="line-height: 20px" v-html="whatsNewContent"></div>
|
|
|
+
|
|
|
+ <span class="clickable" @click="openVersionHistory">Посмотреть историю версий</span>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="whatsNewDisable">Больше не показывать</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</el-main>
|
|
|
+
|
|
|
</el-container>
|
|
|
</template>
|
|
|
|
|
@@ -101,6 +115,7 @@ import ServerStorage from './ServerStorage/ServerStorage.vue';
|
|
|
import bookManager from './share/bookManager';
|
|
|
import readerApi from '../../api/reader';
|
|
|
import * as utils from '../../share/utils';
|
|
|
+import {versionHistory} from './versionHistory';
|
|
|
|
|
|
export default @Component({
|
|
|
components: {
|
|
@@ -167,11 +182,15 @@ class Reader extends Vue {
|
|
|
allowUrlParamBookPos = false;
|
|
|
showRefreshIcon = true;
|
|
|
mostRecentBookReactive = null;
|
|
|
+ showToolButton = {};
|
|
|
|
|
|
actionList = [];
|
|
|
actionCur = -1;
|
|
|
hidden = false;
|
|
|
|
|
|
+ whatsNewVisible = false;
|
|
|
+ whatsNewContent = '';
|
|
|
+
|
|
|
created() {
|
|
|
this.loading = true;
|
|
|
this.commit = this.$store.commit;
|
|
@@ -223,14 +242,17 @@ class Reader extends Vue {
|
|
|
|
|
|
if (this.$root.rootRoute == '/reader') {
|
|
|
if (this.routeParamUrl) {
|
|
|
- await this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos});
|
|
|
+ await this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos, force: this.routeParamRefresh});
|
|
|
} else {
|
|
|
this.loaderActive = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.checkSetStorageAccessKey();
|
|
|
+ this.checkActivateDonateHelpPage();
|
|
|
this.loading = false;
|
|
|
+
|
|
|
+ await this.showWhatsNew();
|
|
|
})();
|
|
|
}
|
|
|
|
|
@@ -241,6 +263,8 @@ class Reader extends Vue {
|
|
|
this.showClickMapPage = settings.showClickMapPage;
|
|
|
this.clickControl = settings.clickControl;
|
|
|
this.blinkCachedLoad = settings.blinkCachedLoad;
|
|
|
+ this.showWhatsNewDialog = settings.showWhatsNewDialog;
|
|
|
+ this.showToolButton = settings.showToolButton;
|
|
|
}
|
|
|
|
|
|
checkSetStorageAccessKey() {
|
|
@@ -257,6 +281,56 @@ class Reader extends Vue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ checkActivateDonateHelpPage() {
|
|
|
+ const q = this.$route.query;
|
|
|
+
|
|
|
+ if (q['donate']) {
|
|
|
+ this.$router.replace(`/reader`);
|
|
|
+ this.helpToggle();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.helpPage.activateDonateHelpPage();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ checkBookPosPercent() {
|
|
|
+ const q = this.$route.query;
|
|
|
+ if (q['__pp']) {
|
|
|
+ let pp = q['__pp'];
|
|
|
+ if (pp) {
|
|
|
+ pp = parseFloat(pp) || 0;
|
|
|
+ const recent = this.mostRecentBook();
|
|
|
+ (async() => {
|
|
|
+ await utils.sleep(100);
|
|
|
+ this.bookPos = Math.floor(recent.textLength*pp/100);
|
|
|
+ })();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ openVersionHistory() {
|
|
|
+ this.whatsNewVisible = false;
|
|
|
+ this.versionHistoryToggle();
|
|
|
+ }
|
|
|
+
|
|
|
+ whatsNewDisable() {
|
|
|
+ this.whatsNewVisible = false;
|
|
|
+ const whatsNew = versionHistory[0];
|
|
|
+ this.commit('reader/setWhatsNewContentHash', whatsNew.header);
|
|
|
+ }
|
|
|
+
|
|
|
get routeParamPos() {
|
|
|
let result = undefined;
|
|
|
const q = this.$route.query;
|
|
@@ -293,6 +367,11 @@ class Reader extends Vue {
|
|
|
return decodeURIComponent(result);
|
|
|
}
|
|
|
|
|
|
+ get routeParamRefresh() {
|
|
|
+ const q = this.$route.query;
|
|
|
+ return !!q['__refresh'];
|
|
|
+ }
|
|
|
+
|
|
|
bookPosChanged(event) {
|
|
|
if (event.bookPosSeen !== undefined)
|
|
|
this.bookPosSeen = event.bookPosSeen;
|
|
@@ -353,6 +432,10 @@ class Reader extends Vue {
|
|
|
return this.$store.state.reader.settings;
|
|
|
}
|
|
|
|
|
|
+ get whatsNewContentHash() {
|
|
|
+ return this.$store.state.reader.whatsNewContentHash;
|
|
|
+ }
|
|
|
+
|
|
|
addAction(pos) {
|
|
|
let a = this.actionList;
|
|
|
if (!a.length || a[a.length - 1] != pos) {
|
|
@@ -523,6 +606,15 @@ class Reader extends Vue {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ versionHistoryToggle() {
|
|
|
+ this.helpToggle();
|
|
|
+ if (this.helpActive) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.helpPage.activateVersionHistoryHelpPage();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
refreshBook() {
|
|
|
if (this.mostRecentBook()) {
|
|
|
this.loadBook({url: this.mostRecentBook().url, force: true});
|
|
@@ -708,7 +800,7 @@ class Reader extends Vue {
|
|
|
|
|
|
this.progressActive = true;
|
|
|
|
|
|
- await this.$nextTick()
|
|
|
+ await this.$nextTick();
|
|
|
|
|
|
const progress = this.$refs.page;
|
|
|
|
|
@@ -743,6 +835,7 @@ class Reader extends Vue {
|
|
|
progress.hide(); this.progressActive = false;
|
|
|
this.blinkCachedLoadMessage();
|
|
|
|
|
|
+ this.checkBookPosPercent();
|
|
|
await this.activateClickMapPage();
|
|
|
return;
|
|
|
}
|
|
@@ -791,6 +884,7 @@ class Reader extends Vue {
|
|
|
} else
|
|
|
this.stopBlink = true;
|
|
|
|
|
|
+ this.checkBookPosPercent();
|
|
|
await this.activateClickMapPage();
|
|
|
} catch (e) {
|
|
|
progress.hide(); this.progressActive = false;
|
|
@@ -1010,4 +1104,10 @@ i {
|
|
|
.clear {
|
|
|
color: rgba(0,0,0,0);
|
|
|
}
|
|
|
-</style>
|
|
|
+
|
|
|
+.clickable {
|
|
|
+ color: blue;
|
|
|
+ text-decoration: underline;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+</style>
|