]> _ Git - fluidbook-html5.git/commitdiff
try #2371 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Nov 2018 18:13:22 +0000 (19:13 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 23 Nov 2018 18:13:22 +0000 (19:13 +0100)
_index.html
js/libs/fluidbook/fluidbook.interface.js
js/libs/fluidbook/fluidbook.loader.js
style/fluidbook.less

index 2785c8009dd00627edb5b05ac2c9a2d88647021e..6a14b2f672a1c671b4268d37c623c99ba3acf1b3 100644 (file)
 <div id="splash" style="background-color:#<!-- $bgcolor -->;"><!-- $splash --></div>
 <div id="popinOverlay"></div>
 <div id="landingPage"></div>
+<div id="loadedcontents"></div>
 <!-- $statsfooter -->
 </body>
 </html>
\ No newline at end of file
index 5d87da2d1ed305658fcec4bbb2ec8590d23b483f..27ba10cda9b6080277836e989e5945a2fb6a0aab 100644 (file)
@@ -59,14 +59,16 @@ FluidbookInterface.prototype = {
             return true;
         });
 
-        $(document).on('click', ':not(a)', function () {
-            var selector = '#background,header,footer';
-            if (!$(this).is(selector) && $(this).closest(selector).length == 0) {
+        if (this.autoHideArrows()) {
+            $(document).on('click', ':not(a)', function () {
+                var selector = '#background,header,footer';
+                if (!$(this).is(selector) && $(this).closest(selector).length == 0) {
+                    return true;
+                }
+                $this.toggleInterface();
                 return true;
-            }
-            $this.toggleInterface();
-            return true;
-        });
+            });
+        }
 
         $(this.fluidbook).on('fluidbook.ready', function () {
             setTimeout(function () {
index 4dc13fee2a648e95ac4d30a799066ee4b98f20fa..f902b8b35e5fbe15ef2944cd8cde9cbbe51b94a8 100644 (file)
@@ -235,8 +235,7 @@ FluidbookLoader.prototype = {
             if (!$(page).hasClass(position)) {
                 if (position == 'left') {
                     $(page).removeClass('right');
-                }
-                else {
+                } else {
                     $(page).removeClass('left');
                 }
                 $(page).addClass(position);
@@ -508,50 +507,57 @@ FluidbookLoader.prototype = {
         }).addClass('img');
         return $(div).get(0).outerHTML;
     },
-    loadImage: function (src, width, height, type, callback) {
-        if (src == false) {
-            callback();
-            return;
-        }
-        var img = new Image();
+    loadImage: function (src, width, height, type, cb) {
         var $this = this;
-        var callbackCalled = false;
-        if (callback && typeof callback == 'function') {
-            $(img).one('load', function () {
+        var callback = function () {
+            if (cb && typeof cb == 'function') {
                 setTimeout(function () {
                     if (!callbackCalled) {
                         callbackCalled = true;
-                        callback();
+                        cb();
                     }
-                }, 10);
-            });
+                }, 10)
+            }
+            setTimeout(function () {
+                $this.fluidbook.executeWhenNetwork(function () {
+                    $("#loadedcontents").find('[src="' + src + '"]').remove();
+                });
+            }, 30000);
+        }
+
+        if (src === false) {
+            callback();
+            return;
         }
-        $(img).on('error', function () {
+        var img = new Image();
+        var $this = this;
+        var callbackCalled = false;
+
+        $(img).one('load', function () {
+            callback();
+        });
+
+        $(img).one('error', function () {
             $this.imagesErrors.push(this);
-            setTimeout(function () {
-                callback();
-            }, 10);
+            callback();
         });
         img.src = src;
-        if (width != undefined && width != null) {
+        if (width !== undefined && width !== null) {
             img.width = width;
         }
-        if (height != undefined && height != null) {
+        if (height !== undefined && height !== null) {
             img.height = height;
         }
-        if (type != undefined && type != null) {
+        if (type !== undefined && type !== null) {
             img.type = type;
         }
-        if (callback && typeof callback == 'function' && (img.complete || img.readyState == 'complete' || img.readyState == 4)) {
-            setTimeout(function () {
-                if (!callbackCalled) {
-                    callbackCalled = true;
-                    callback();
-                }
-            }, 10);
+        if (img.complete || img.readyState === 'complete' || img.readyState === 4) {
+            callback();
         }
 
-        return $(img);
+        var res = $(img);
+        $("#loadedcontents").append(res);
+        return res;
     },
     retryErrorImages: function () {
         $(this.imagesErrors).each(function () {
index b694779d85fa9e85f2b3ebb5ba5c9a57093fa14b..52278e222b29825172f0e33851c4a2d96a033ef0 100644 (file)
@@ -2981,4 +2981,7 @@ body > input {
 
 #pscanvas {
        visibility: hidden;
+}
+#loadedcontents{
+       display: none;
 }
\ No newline at end of file