Skip to content

Commit a08f9e0

Browse files
authored
Make building the archive overlay less CPU heavy for huge archives (#1392)
1 parent 0a0e651 commit a08f9e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

public/js/reader.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,7 @@ Reader.initializeArchiveOverlay = function () {
997997
$("#extract-spinner").hide();
998998

999999
// For each link in the pages array, craft a div and jam it in the overlay.
1000+
let htmlBlob = "";
10001001
for (let index = 0; index < Reader.pages.length; ++index) {
10011002
const page = index + 1;
10021003

@@ -1009,8 +1010,10 @@ Reader.initializeArchiveOverlay = function () {
10091010
<i id="${index}_spinner" class="fa fa-4x fa-circle-notch fa-spin ttspinner" style="display:flex;justify-content: center; align-items: center;"></i>
10101011
</div>`;
10111012

1012-
$("#archivePagesOverlay").append(thumbnail);
1013+
htmlBlob += thumbnail;
10131014
}
1015+
// NOTE: This can be slow on huge archives and on slower devices, due to the huge DOM change.
1016+
$("#archivePagesOverlay").append(htmlBlob);
10141017
$("#archivePagesOverlay").attr("loaded", "true");
10151018

10161019
// Queue a single minion job for thumbnails and check on its progress regularly

0 commit comments

Comments
 (0)