|
@@ -147,6 +147,9 @@ class Reader extends Vue {
|
|
showRefreshIcon = true;
|
|
showRefreshIcon = true;
|
|
mostRecentBookReactive = null;
|
|
mostRecentBookReactive = null;
|
|
|
|
|
|
|
|
+ actionList = [];
|
|
|
|
+ actionCur = -1;
|
|
|
|
+
|
|
created() {
|
|
created() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
this.commit = this.$store.commit;
|
|
this.commit = this.$store.commit;
|
|
@@ -165,6 +168,9 @@ class Reader extends Vue {
|
|
const recent = this.mostRecentBook();
|
|
const recent = this.mostRecentBook();
|
|
if (recent && recent.bookPos != newValue) {
|
|
if (recent && recent.bookPos != newValue) {
|
|
await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
|
|
await bookManager.setRecentBook(Object.assign({}, recent, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
|
|
|
|
+
|
|
|
|
+ if (this.actionCur < 0 || (this.actionCur >= 0 && this.actionList[this.actionCur] != newValue))
|
|
|
|
+ this.addAction(newValue);
|
|
}
|
|
}
|
|
}, 500);
|
|
}, 500);
|
|
|
|
|
|
@@ -247,6 +253,16 @@ class Reader extends Vue {
|
|
return this.$store.state.reader.settings;
|
|
return this.$store.state.reader.settings;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ addAction(pos) {
|
|
|
|
+ let a = this.actionList;
|
|
|
|
+ if (!a.length || a[a.length - 1] != pos) {
|
|
|
|
+ a.push(pos);
|
|
|
|
+ if (a.length > 20)
|
|
|
|
+ a.shift();
|
|
|
|
+ this.actionCur = a.length - 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
toolBarToggle() {
|
|
toolBarToggle() {
|
|
this.commit('reader/setToolBarActive', !this.toolBarActive);
|
|
this.commit('reader/setToolBarActive', !this.toolBarActive);
|
|
this.$root.$emit('resize');
|
|
this.$root.$emit('resize');
|
|
@@ -393,6 +409,18 @@ class Reader extends Vue {
|
|
case 'loader':
|
|
case 'loader':
|
|
this.loaderToggle();
|
|
this.loaderToggle();
|
|
break;
|
|
break;
|
|
|
|
+ case 'undoAction':
|
|
|
|
+ if (this.actionCur > 0) {
|
|
|
|
+ this.actionCur--;
|
|
|
|
+ this.bookPosChanged({bookPos: this.actionList[this.actionCur]});
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case 'redoAction':
|
|
|
|
+ if (this.actionCur < this.actionList.length - 1) {
|
|
|
|
+ this.actionCur++;
|
|
|
|
+ this.bookPosChanged({bookPos: this.actionList[this.actionCur]});
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
case 'fullScreen':
|
|
case 'fullScreen':
|
|
this.fullScreenToggle();
|
|
this.fullScreenToggle();
|
|
break;
|
|
break;
|
|
@@ -442,6 +470,17 @@ class Reader extends Vue {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ switch (button) {
|
|
|
|
+ case 'undoAction':
|
|
|
|
+ if (this.actionCur <= 0)
|
|
|
|
+ classResult = classDisabled;
|
|
|
|
+ break;
|
|
|
|
+ case 'redoAction':
|
|
|
|
+ if (this.actionCur == this.actionList.length - 1)
|
|
|
|
+ classResult = classDisabled;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (this.activePage == 'LoaderPage' || !this.mostRecentBook()) {
|
|
if (this.activePage == 'LoaderPage' || !this.mostRecentBook()) {
|
|
switch (button) {
|
|
switch (button) {
|
|
case 'undoAction':
|
|
case 'undoAction':
|
|
@@ -524,6 +563,9 @@ class Reader extends Vue {
|
|
this.$nextTick(async() => {
|
|
this.$nextTick(async() => {
|
|
const progress = this.$refs.page;
|
|
const progress = this.$refs.page;
|
|
|
|
|
|
|
|
+ this.actionList = [];
|
|
|
|
+ this.actionCur = -1;
|
|
|
|
+
|
|
try {
|
|
try {
|
|
progress.show();
|
|
progress.show();
|
|
progress.setState({state: 'parse'});
|
|
progress.setState({state: 'parse'});
|
|
@@ -547,6 +589,7 @@ class Reader extends Vue {
|
|
if (bookParsed) {
|
|
if (bookParsed) {
|
|
await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
|
|
await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
|
|
this.mostRecentBook();
|
|
this.mostRecentBook();
|
|
|
|
+ this.addAction(bookPos);
|
|
this.loaderActive = false;
|
|
this.loaderActive = false;
|
|
progress.hide(); this.progressActive = false;
|
|
progress.hide(); this.progressActive = false;
|
|
this.blinkCachedLoadMessage();
|
|
this.blinkCachedLoadMessage();
|
|
@@ -587,6 +630,7 @@ class Reader extends Vue {
|
|
// добавляем в историю
|
|
// добавляем в историю
|
|
await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
|
|
await bookManager.setRecentBook(Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
|
|
this.mostRecentBook();
|
|
this.mostRecentBook();
|
|
|
|
+ this.addAction(bookPos);
|
|
this.updateRoute(true);
|
|
this.updateRoute(true);
|
|
|
|
|
|
this.loaderActive = false;
|
|
this.loaderActive = false;
|