From bc65180c324d9c4e80c5128435ccdd56095218b5 Mon Sep 17 00:00:00 2001 From: quarz12 Date: Mon, 15 May 2023 14:36:33 +0200 Subject: [PATCH] restructured and fixed a bug in getprevfilesize --- cps/static/js/reading/epub-progress.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cps/static/js/reading/epub-progress.js b/cps/static/js/reading/epub-progress.js index 985a9bb8..95938407 100644 --- a/cps/static/js/reading/epub-progress.js +++ b/cps/static/js/reading/epub-progress.js @@ -8,9 +8,10 @@ class EpubParser { getTextByteLength() { let size = 0; - for (let key in y = Object.keys(this.files)) { - let file = this.files[y[key]]; + for (let key of Object.keys(this.files)) { + let file = this.files[key]; if (file.name.endsWith("html")) { + console.log(file.name+" "+file._data.uncompressedSize) size += file._data.uncompressedSize; } } @@ -65,9 +66,10 @@ class EpubParser { let bytesize = 0; for (let file of this.getSpine()) { if (file !== currentFile) { - let filepath = this.absPath(this.resolveIDref(currentFile)); + let filepath = this.absPath(this.resolveIDref(file)); //ignore non text files if (filepath.endsWith("html")) { + console.log(filepath+" "+bytesize) bytesize += this.files[filepath]._data.uncompressedSize; } } else {