From: Vincent Vanwaelscappel Date: Fri, 23 Nov 2018 18:13:22 +0000 (+0100) Subject: try #2371 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=bf8d94ab58a4ce6449a65f9c2064d435d20b99e1;p=fluidbook-html5.git try #2371 @0.5 --- diff --git a/_index.html b/_index.html index 2785c800..6a14b2f6 100644 --- a/_index.html +++ b/_index.html @@ -103,6 +103,7 @@
+
\ No newline at end of file diff --git a/js/libs/fluidbook/fluidbook.interface.js b/js/libs/fluidbook/fluidbook.interface.js index 5d87da2d..27ba10cd 100644 --- a/js/libs/fluidbook/fluidbook.interface.js +++ b/js/libs/fluidbook/fluidbook.interface.js @@ -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 () { diff --git a/js/libs/fluidbook/fluidbook.loader.js b/js/libs/fluidbook/fluidbook.loader.js index 4dc13fee..f902b8b3 100644 --- a/js/libs/fluidbook/fluidbook.loader.js +++ b/js/libs/fluidbook/fluidbook.loader.js @@ -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 () { diff --git a/style/fluidbook.less b/style/fluidbook.less index b694779d..52278e22 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -2981,4 +2981,7 @@ body > input { #pscanvas { visibility: hidden; +} +#loadedcontents{ + display: none; } \ No newline at end of file