]> _ Git - fluidbook-html5.git/commitdiff
(no commit message)
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 9 Oct 2013 13:54:26 +0000 (13:54 +0000)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 9 Oct 2013 13:54:26 +0000 (13:54 +0000)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.l10n.js

index b49c4cd2d58193250a494123015fc745fb6d92de..6c04d5d22877b5897f81272279d368a9374078e6 100644 (file)
@@ -27,6 +27,7 @@ Fluidbook.prototype = {
                this.loader = new FluidbookLoader(this);\r
                this.search = new FluidbookSearch(this);\r
                this.pad = new FluidbookPad(this);\r
+               this.waiters = [];\r
                if (Modernizr.ftouch && this.support.transitions2d && this.datas.mobileTransitions != 'none') {\r
                        this.touch = new FluidbookTouch(this);\r
                }\r
@@ -675,6 +676,7 @@ Fluidbook.prototype = {
                }, 1000);\r
                this.initLinks();\r
                this.hideLoader();\r
+               this.resetWaiters();\r
 \r
                // Clean messy stuffs\r
                $("#pages").removeClass('_3dtransition');\r
@@ -728,21 +730,42 @@ Fluidbook.prototype = {
                var $this = this;\r
 \r
                this.displayLoader();\r
-\r
+               this.resetWaiters();\r
+               \r
                setTimeout(function() {\r
                        $this._openView(view, param1, param2, callback);\r
                }, 20);\r
        },\r
+       addWaiter: function(reset) {\r
+               if (reset == undefined) {\r
+                       reset = false;\r
+               }\r
+               if (reset) {\r
+                       this.resetWaiters();\r
+               }\r
+               var rand = Math.round(Math.random() * 100000);\r
+               this.waiters.push(rand);\r
+               return rand;\r
+       },\r
+       waiterActive: function(id) {\r
+               return this.waiters.indexOf(id) > -1;\r
+       },\r
+       resetWaiters: function() {\r
+               this.waiters = [];\r
+       },\r
        _openView: function(view, param1, param2, callback) {\r
                var $this = this;\r
                var preload = {index: 'thumbnails',\r
                        search: 'thumbnails',\r
                        bookmark: 'thumbnails',\r
                        video: 'extras'};\r
+               \r
                if (this.gal != null && preload[view] != undefined) {\r
+                       var w = this.addWaiter(true);\r
                        this.gal.downloadAndCall(preload[view], function() {\r
-\r
-                               $this.__openView(view, param1, param2, callback);\r
+                               if ($this.waiterActive(w)) {\r
+                                       $this.__openView(view, param1, param2, callback);\r
+                               }\r
                        });\r
                } else {\r
                        this.__openView(view, param1, param2, callback);\r
index 8516e224692527a6258699de116736e7ca9c05e0..67a419037c9d0926e03a55edb56c6fca4aab7ba2 100644 (file)
@@ -48,11 +48,13 @@ FluidbookL10N.prototype = {
                        }
                }
 
-               if (this.fluidbook.datas.multilang == '') {
-                       return;
-               }
-               if (this.fluidbook.datas.multiApp && !force) {
-                       return;
+               if (!force) {
+                       if (this.fluidbook.datas.multilang == '') {
+                               return;
+                       }
+                       if (this.fluidbook.datas.multiApp) {
+                               return;
+                       }
                }
 
                this.multilangEnabled = true;