From cce0ef2de155dd1362c07e4249659a6c4b6f80ec Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Sat, 4 Nov 2023 00:04:31 -0400 Subject: [PATCH] [fix] book stat dom --- assets/reader/index.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/assets/reader/index.js b/assets/reader/index.js index f050cf6..424184a 100644 --- a/assets/reader/index.js +++ b/assets/reader/index.js @@ -120,26 +120,20 @@ class EBookReader { // Load Progress let { cfi } = await this.getCFIFromXPath(this.bookState.progress); - let getStats = async function () { - // Start Timer - this.bookState.pageStart = Date.now(); - - // Get Stats - let stats = await this.getBookStats(); - this.updateBookStatElements(stats); - }.bind(this); - - // Register Content Hook - this.rendition.hooks.content.register(getStats); - // Update Position await this.setPosition(cfi); // Highlight Element - DOM Has Element let { element } = await this.getCFIFromXPath(this.bookState.progress); + // Set Progress Element & Highlight this.bookState.progressElement = element; this.highlightPositionMarker(); + + // Update Stats & Page Start + let stats = await this.getBookStats(); + this.updateBookStatElements(stats); + this.bookState.pageStart = Date.now(); } initDevice() {