]> _ Git - fluidbook-html5.git/commitdiff
wait #7712 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 4 Sep 2025 14:11:40 +0000 (16:11 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 4 Sep 2025 14:11:40 +0000 (16:11 +0200)
js/libs/fluidbook/fluidbook.loader.js
js/libs/fluidbook/menu/fluidbook.index.js

index 876e8c963e0c0f8120bbb9cd3dfcb8b5358048eb..c217a1c69ee15e0168f1fe47c5e9b1a08b543c38 100644 (file)
@@ -1221,6 +1221,17 @@ FluidbookLoader.prototype = {
     },
 
     checkLoadedThumbs: function () {
+        let $this = this;
+        $.each(this.thumbnails, function (page, img) {
+            if (img === undefined || img === null || $this.loadedThumbnails.indexOf(page) >= 0) {
+                return;
+            }
+            img = $(img).get(0);
+
+            if (img.complete || img.readyState === 'complete' || img.readyState === 4) {
+                $this.loadedThumbnails.push(page);
+            }
+        });
         return this.loadedThumbnails.length === this.fluidbook.settings.pages;
     },
 
@@ -1238,6 +1249,7 @@ FluidbookLoader.prototype = {
         for (var i = 1; i <= this.fluidbook.settings.pages; i++) {
             this.loadThumb(i, cb);
         }
+
     },
 
     loadThumb: function (pageNr, callback) {
@@ -1254,8 +1266,10 @@ FluidbookLoader.prototype = {
             return;
         }
         var $this = this;
-        var cb = function () {
-            $this.loadedThumbnails.push(pageNr);
+        let cb = function () {
+            if ($this.loadedThumbnails.indexOf(pageNr) === -1) {
+                $this.loadedThumbnails.push(pageNr);
+            }
             if ($this.checkLoadedThumbs()) {
                 $($this).trigger('thumbnails.loaded');
             }
@@ -1292,7 +1306,7 @@ FluidbookLoader.prototype = {
                         callbackCalled = true;
                         cb(img);
                     }
-                }, $this.fluidbook.shortLoading ? 0 : 10);
+                }, $this.fluidbook.shortLoading ? 4 : 10);
             }
         }
 
@@ -1315,7 +1329,7 @@ FluidbookLoader.prototype = {
                         clearInterval(interval);
                         callback(img);
                     }
-                }, $this.fluidbook.shortLoading ? 0 : 100);
+                }, $this.fluidbook.shortLoading ? 4 : 100);
             }
         });
 
index ebe4ab8cf993e7e2609979b9731bc76e05d26924..72b5d426db73a73f7307047503a9cedc192bbb43 100644 (file)
@@ -27,6 +27,7 @@ FluidbookIndex.prototype = {
     },
 
     openIndex: function (title, group, closeAll, callback) {
+        console.log('openIndex');
         var $this = this;
         this.fluidbook.displayLoader();
         this.preloadThumbs(function () {
@@ -35,6 +36,7 @@ FluidbookIndex.prototype = {
     },
 
     _openIndex: function (title, group, closeAll, callback) {
+        console.log('_openIndex');
         var c = !closeAll ? ' one' : '';
         var index = this.fluidbook.menu.getCaption(title);
         index += this.getView(group);