Skip to content

Commit 8024b18

Browse files

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "chartero",
3-
"version": "2.9.12",
3+
"version": "2.9.13",
44
"type": "module",
55
"config": {
66
"addonName": "Chartero",

src/vue/dashboard/main.vue

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,20 @@ export default {
173173
},
174174
// 更新阅读进度
175175
async updateProgress() {
176-
const att = this.isReader
177-
? this.item
178-
: await this.topLevel?.getBestAttachment(),
179-
his = att && addon.history.getByAttachment(att);
180-
if (his) {
181-
animate(this, { ...this.animateInt, readPages: his.record.readPages });
182-
animate(this, {
183-
...this.animateInt,
184-
numPages: his.record.numPages ?? 0,
185-
});
176+
const att = this.isReader ? this.item : await this.topLevel?.getBestAttachment();
177+
let readPages = 0;
178+
let numPages = 0;
179+
if (att) {
180+
const his = addon.history.getByAttachment(att);
181+
if (his) {
182+
readPages = his.record.readPages;
183+
numPages = his.record.numPages ?? 0;
184+
} else {
185+
const fullPages = await Zotero.FullText.getPages(att.id);
186+
numPages = fullPages ? fullPages.total : 0;
187+
}
186188
}
189+
animate(this, { ...this.animateInt, readPages, numPages });
187190
},
188191
// 统计附件大小
189192
updateSize() {

0 commit comments

Comments
 (0)