]> _ Git - fluidbook-html5.git/commitdiff
wip #809 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 26 Jun 2018 17:18:47 +0000 (19:18 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 26 Jun 2018 17:18:47 +0000 (19:18 +0200)
js/libs/fluidbook/fluidbook.3dflip.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.loader.js
js/libs/fluidbook/fluidbook.pagetransitions.js [new file with mode: 0644]
js/libs/fluidbook/fluidbook.resize.js
js/libs/fluidbook/fluidbook.support.js
js/libs/modernizr/modernizr.min.js
js/libs/modernizr/tests.js
style/fluidbook.less

index 2835f51ecd5b3127ceb2fd26d5e692c61d20f9c5..5363140cbb82854e6f37b43da3f9efabf2d32f60 100644 (file)
@@ -18,6 +18,7 @@ function Fluidbook3DFlip(fluidbook) {
     this._progressAnimation = 0;
     this.ready = false;
     this.animationTime = 1.2;
+    this.textures = [];
 
     this.lowPerf = this.fluidbook.support.android || this.fluidbook.support.iOS || this.fluidbook.support.IE > 0;
 
@@ -26,8 +27,9 @@ function Fluidbook3DFlip(fluidbook) {
     this.pw = this.fluidbook.resize.ww;
     this.ph = this.fluidbook.resize.hh;
 
-    var $this = this;
+    this.turnRunning = false;
 
+    var $this = this;
     this.init();
 }
 
@@ -51,7 +53,7 @@ Fluidbook3DFlip.prototype = {
 
         var far = 24000;
         var near = 1000;
-        this.enableShadow = false && !this.lowPerf;
+        this.enableShadow = true && !this.lowPerf;
 
         this.camera = new THREE.PerspectiveCamera(20, 1, near, far);
         this.camera.zoom = 1;
@@ -74,21 +76,8 @@ Fluidbook3DFlip.prototype = {
 
         this.scene.add(light);
 
-        // light = new THREE.SpotLight(0xffffff, lightIntensity, 0, 1);
-        // light.position.set(-1.7382 * 10000, -0.081 * 10000, 1.725 * 10000);
-        // if (this.enableShadow) {
-        //     light.castShadow = true;
-        //     light.shadow.mapSize.width = 512;  // default
-        //     light.shadow.mapSize.height = 512; // default
-        //     light.shadow.camera.near = near;
-        //     light.shadow.camera.far = far;
-        //     light.shadow.bias = -0.005;
-        // }
-        //
-        // this.scene.add(light);
-
         if (this.enableShadow) {
-            var geometry = new THREE.PlaneGeometry(this.fluidbook.datas.width * this.geometryScale * 2, this.fluidbook.datas.height * this.geometryScale, 3, 3, true);
+            var geometry = new THREE.PlaneGeometry(this.fluidbook.datas.width * this.geometryScale * 2, this.fluidbook.datas.height * this.geometryScale, 1, 1, true);
             var shadowTexture = new THREE.ShadowMaterial({
                 color: 0x000000,
                 side: THREE.FrontSide,
@@ -101,34 +90,23 @@ Fluidbook3DFlip.prototype = {
             this.scene.add(this.shadowPlane);
         }
 
-        this.prepareTexture(3, function (t1) {
-            $this.prepareTexture(2, function (t2) {
-                $this.texturesLoaded(t1, t2);
-            });
-        })
-    },
-
-    texturesLoaded: function (t1, t2) {
-        var $this = this;
-
-        var triangles = 10;
+        var triangles = 6;
         if (this.lowPerf) {
-            triangles = 3;
+            triangles = 2;
         }
 
-        var geometry = new THREE.PlaneGeometry(this.fluidbook.datas.width * this.geometryScale, this.fluidbook.datas.height * this.geometryScale, triangles * 5, triangles, true);
+        var geometry = new THREE.PlaneGeometry(this.fluidbook.datas.width * this.geometryScale, this.fluidbook.datas.height * this.geometryScale, Math.round(triangles * 5), Math.round(triangles), true);
         var geometry2 = geometry.clone();
         geometry.merge(geometry2, new THREE.Matrix4().makeRotationY(Math.PI), 1);
 
         var roughness = 0.8;
-
-        var textures = [
-            new THREE.MeshStandardMaterial({map: t1, side: THREE.FrontSide, overdraw: 0.5, roughness: roughness}),
-            new THREE.MeshStandardMaterial({map: t2, side: THREE.FrontSide, overdraw: 0.5, roughness: roughness}),
+        this.textures = [
+            new THREE.MeshStandardMaterial({side: THREE.FrontSide, overdraw: 0.5, roughness: roughness}),
+            new THREE.MeshStandardMaterial({side: THREE.FrontSide, overdraw: 0.5, roughness: roughness}),
         ];
         geometry.translate(this.fluidbook.datas.width * this.geometryScale * 0.5, 0, 0);
 
-        this.plane = new THREE.Mesh(geometry, textures);
+        this.plane = new THREE.Mesh(geometry, this.textures);
         this.plane.castShadow = this.enableShadow;
         this.plane.receiveShadow = false;
 
@@ -155,11 +133,27 @@ Fluidbook3DFlip.prototype = {
         this.renderer.setPixelRatio(window.devicePixelRatio * qualityRatio);
         this.renderer.setSize(this.pw, this.ph);
         this.container.appendChild(this.renderer.domElement);
+        this.animate();
+    },
+
+    playTurn: function (turning, callback) {
+        var $this = this;
+        this.prepareTexture(turning.flip[0], function (t1) {
+            $this.prepareTexture(turning.flip[1], function (t2) {
+                $this.texturesLoaded(t1, t2, callback);
+            });
+        })
+    },
+
+    texturesLoaded: function (t1, t2, callback) {
+        var $this = this;
+
+        this.textures[0].map = t1;
+        this.textures[1].map = t2;
 
         this.ready = true;
         this.resize();
-        this.animate();
-        $this.play();
+        $this.play(callback);
     },
 
     prepareTexture: function (page, callback) {
@@ -183,18 +177,16 @@ Fluidbook3DFlip.prototype = {
         };
     },
 
-    play: function () {
+    play: function (callback) {
         this.guessCameraZoom();
-        this.playAnimation();
-    },
 
-    playAnimation: function () {
         var $this = this;
         this.tl = new TimelineMax();
         this.tl.add(TweenMax.to(this.bend, 5, {force: -0.65, offset: 0.65, ease: Power0.easeIn}));
         this.tl.add(TweenMax.to(this.bend, 5, {force: 0, offset: 0.65, ease: Power0.easeOut}));
         this.tl.add(TweenMax.to(this.plane.rotation, 10, {y: Math.PI * -1, ease: Power1.easeIn}), 0);
 
+        TweenMax.killTweensOf(this);
         TweenMax.fromTo(this, this.animationTime,
             {
                 progressAnimation: 0
@@ -202,12 +194,7 @@ Fluidbook3DFlip.prototype = {
                 progressAnimation: 1,
                 ease: Power0.easeIn,
                 onComplete: function () {
-                    setTimeout(function () {
-                        $this.progressAnimation(0);
-                        setTimeout(function () {
-                            $this.playAnimation();
-                        }, 1000);
-                    }, 1000);
+                    callback();
                 }
             }
         );
@@ -230,13 +217,17 @@ Fluidbook3DFlip.prototype = {
             $this.animate();
         });
 
+        if (!this.turnRunning) {
+            //return;
+        }
+
         this.stats.update();
         this.renderer.render(this.scene, this.camera);
         this.modifier && this.modifier.apply();
     },
 
     resize: function () {
-        if (!this.ready) {
+        if (!this.ready || this.turnRunning) {
             return;
         }
 
@@ -249,6 +240,8 @@ Fluidbook3DFlip.prototype = {
         $("#flip3dcontainer").css({width: this.pw, height: this.ph});
 
         this.renderer.setSize(this.pw, this.ph);
+
+        this.guessCameraZoom();
     },
 
     guessCameraZoom: function () {
@@ -266,7 +259,11 @@ Fluidbook3DFlip.prototype = {
 
         var bookBox = $("#currentDoublePage").get(0).getBoundingClientRect();
         var s = (bookBox.width / 2) / rect.width;
-        console.log(s);
+
+        if (rect.width == 0 || rect.width > 100000) {
+            return;
+        }
+
         this.plane.scale.x *= s;
         this.plane.scale.y *= s;
         this.plane.rotateX(0);
@@ -286,9 +283,6 @@ Fluidbook3DFlip.prototype = {
                 height: Math.abs(min.y - max.y)
             };
 
-            console.log(rect.y);
-            console.log(bookBox.y);
-
             this.plane.translateY(rect.y - bookBox.top);
         }
         if (this.enableShadow) {
@@ -317,10 +311,15 @@ Fluidbook3DFlip.prototype = {
         if (arguments.length === 0) {
             return this._progressAnimation;
         }
+        if (val == 1) {
+            val = 0;
+        }
         if (val == 0 || val == 1) {
             $("#flip3dcontainer").hide();
+            this.turnRunning = false;
         } else {
             $("#flip3dcontainer").show();
+            this.turnRunning = true;
         }
         this.tl.pause();
         this.tl.progress(val);
index 8c2971d813b229aa4003f06ec6e9b958950ef22a..78d2b192d1111be2c253888ec7dc8642c745403e 100644 (file)
@@ -88,7 +88,7 @@ Fluidbook.prototype = {
         $('html').addClass(this.datas.mobileLVersion);
         this.currentPage = -1;
         this.resize = new FluidbookResize(this);
-        this.flip3d = new Fluidbook3DFlip(this);
+        this.pagetransitions = new FluidbookPageTransition(this);
         this.stats = new FluidbookStats(this);
         this.stats.track(10);
 
@@ -330,11 +330,7 @@ Fluidbook.prototype = {
             if (isNaN(page) || page == undefined) {
                 return this.setCurrentPage('1');
             }
-            if (this.pad.enabled) {
-                this.transitionAxis = this.pad.getTransitionAxis(this.currentPage, page);
-            } else {
-                this.transitionAxis = 'x';
-            }
+
             if (page != $this.currentPage) {
                 $($this).trigger('changePage', [page]);
             }
@@ -343,7 +339,7 @@ Fluidbook.prototype = {
             }
             this.menu.closeView(function () {
                 if (page != $this.currentPage) {
-                    $this.pageTransition(page);
+                    $this.pagetransitions.pageTransition(page);
                     $this.stats.track(0, page);
                 }
                 $this.zoom.resetZoom();
@@ -386,174 +382,13 @@ Fluidbook.prototype = {
         }
         return;
     },
-    pageTransition: function (pageNr) {
-
-        $(this).trigger('fluidbook.beforePageTransition');
-
-        this.tooltip.hideTooltip();
-
-        if (pageNr == undefined) {
-            pageNr = this.currentPage;
-            if (pageNr == -1) {
-                pageNr = 1;
-            }
-        }
-        pageNr = this.normalizePage(pageNr);
-        if (pageNr == this.normalizePage(this.currentPage) || this.currentPage == -1 || !this.support.transitions2d || this.datas.mobileTransitions == 'none') {
-            return this.pageTransition1D(pageNr);
-        }
-
-        if (this.displayOnePage) {
-            return this.pageTransition2DPortrait(pageNr);
-        }
-
-        if (!this.support.transitions3d || this.datas.mobileTransitions == 'slide') {
-            return this.pageTransition2D(pageNr);
-        }
-
-        return this.pageTransition3D(pageNr);
-    },
-    pageTransition3D: function (pageNr) {
-        var $this = this;
-        if ($("#pages").hasClass('_3dtransition')) {
-            return;
-        }
-        this.transitionning = true;
-        var $this = this;
-        var turning = this.getTurningPages(pageNr);
-        $("#pages").prepend('<div id="nextDoublePage" class="_3d doublePage ' + turning.nextFromClass + 'start"></div>');
-        var doublePage = $("#nextDoublePage");
-        var currentDoublePage = $("#currentDoublePage");
-        if (!this.loader.arePreloadedPages(turning.end)) {
-            this.displayLoader();
-        }
-        this.loader.preloadPagesBeforeTransition(turning.end, function () {
-            $("#pages").addClass('_3dtransition');
-            $this.loader.setContentsInDoublePage(currentDoublePage, turning.flat, true, function () {
-                $this.loader.setContentsInDoublePage(doublePage, turning.flip, true, function () {
-                    $this.beforeTransition(pageNr, 3, turning);
-                    $(doublePage).addClass(turning.nextFromClass + 'end').one($this.support.getTransitionEndEvent(), function () {
-                        if ($this.transitionning == false) {
-                            return;
-                        }
-                        if ($("#nextDoublePage").length == 0) {
-                            $("#pages").removeClass('_3dtransition');
-                            $this.transitionning = false;
-                            return;
-                        }
-
-                        // Set the flat contents with the new page
-                        $this.loader.setContentsInDoublePage(doublePage, turning.end, false, function () {
-                            $(doublePage).removeClass('_3d').removeClass(turning.nextFromClass + 'start').removeClass(turning.nextFromClass + 'end');
-                            // Remove former part
-                            $("#currentDoublePage").remove();
-                            $(doublePage).attr('id', 'currentDoublePage');
-                            $("#pages").removeClass('_3dtransition');
-                            $this.afterTransition(pageNr);
-                        });
-                    });
-                });
-            });
-        });
-    },
-
-    centerBook: function (center, animationDuration) {
-        var animate = animationDuration != undefined && animationDuration > 0;
-        var move = $("#center-fluidbook,#center-shadow");
-        var currentLeft = $("#center-fluidbook").data('left');
-        var left = 0;
-        if (center == undefined) {
-            center = $("#center-fluidbook").data('center');
-        }
-        if (center != 0) {
-            left = this.resize.centerOffset * center;
-        }
-
-        if (currentLeft == left) {
-            return;
-        }
-
-        $("#center-fluidbook").data({left: left, center: center});
-
-        if (animate) {
-            $(move).addClass('animate');
-        } else {
-            $(move).removeClass('animate');
-        }
-
-        var delay = this.support.android ? this.datas.mobileTransitionDuration * 1000 : 10;
-        setTimeout(function () {
-            move.transform({translateX: left + 'px'});
-        }, delay);
-    },
 
-    getTurningPages: function (newPage) {
-        var res = {};
-        res.dir = 1;
-        if (newPage < this.currentPage) {
-            res.dir = -1;
-        }
-
-        if (this.l10n.dir == 'ltr') {
-            res.currentLeft = this.currentPage - this.currentPage % 2;
-            res.currentRight = res.currentLeft + 1;
-            if (res.dir == 1) {
-                res.currentToClass = 'prev';
-                res.nextFromClass = 'next';
-                res.flat = [res.currentLeft, newPage + 1];
-                res.flip = [newPage, res.currentRight];
-            } else {
-                res.currentToClass = 'next';
-                res.nextFromClass = 'prev';
-                res.flat = [newPage, res.currentRight];
-                res.flip = [res.currentLeft, newPage + 1];
-            }
 
-            res['end'] = [newPage, newPage + 1];
-        } else {
-            res.currentRight = this.currentPage - this.currentPage % 2;
-            res.currentLeft = res.currentRight + 1;
-            if (res.dir == 1) {
-                res.currentToClass = 'next';
-                res.nextFromClass = 'prev';
-                res.flat = [newPage + 1, res.currentRight];
-                res.flip = [res.currentLeft, newPage];
-            } else {
-                res.currentToClass = 'prev';
-                res.nextFromClass = 'next';
-                res.flat = [res.currentLeft, newPage];
-                res.flip = [newPage + 1, res.currentRight];
-            }
-
-            if (this.displayOnePage) {
-                res.end = [newPage, newPage + 1];
-            } else {
-                res.end = [newPage + 1, newPage];
-            }
-        }
-
-        var center = this.centerBookEnabled();
-        res.center = 0;
-        if (center) {
-            if (newPage <= 1) {
-                res.center = -1;
-            } else if (this.datas.pages % 2 == 0 && newPage == this.datas.pages) {
-                res.center = 1;
-            }
-        }
-
-        res.loading = [res.currentLeft, res.currentRight];
-        res = json_parse(JSON.stringify(res));
-        return res;
-    },
-
-    centerBookEnabled: function () {
-        return !!this.datas.centerBook && !this.displayOnePage && $('.tabslink').length == 0;
-    },
 
     reloadCurrentPage: function () {
         this.pageTransition(this.currentPage);
     },
+
     readingPage: function (side) {
         if (!this.displayOnePage) {
             var page = this.currentPage;
@@ -646,138 +481,6 @@ Fluidbook.prototype = {
     showAllButtons: function () {
         $("#next,#previous").addClass('help').show();
     },
-    pageTransition2D: function (pageNr) {
-        this.transitionning = true;
-        var $this = this;
-        var turning = this.getTurningPages(pageNr);
-        $("#pages").append('<div id="nextDoublePage" class="doublePage _2d axis_' + this.transitionAxis + ' ' + turning.nextFromClass + '"></div>');
-        var doublePage = $("#nextDoublePage");
-        if (!this.loader.arePreloadedPages(turning.end)) {
-            this.displayLoader();
-        }
-        this.loader.preloadPagesBeforeTransition(turning.end, function () {
-            $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
-                $this.beforeTransition(pageNr, 2, turning);
-                $("#currentDoublePage").addClass('_2d').addClass('axis_' + $this.transitionAxis).addClass(turning.currentToClass);
-                $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function (event) {
-                    if ($this.transitionning == false) {
-                        return;
-                    }
-                    $("#currentDoublePage").remove();
-                    $("#nextDoublePage").attr('id', 'currentDoublePage');
-                    $this.afterTransition(pageNr);
-                });
-            });
-        });
-    },
-    pageTransition2DPortrait: function (pageNr) {
-        this.transitionning = true;
-        var $this = this;
-        var turning = this.getTurningPages(pageNr);
-        $("#pages").append('<div id="nextDoublePage" class="doublePage _2d axis_' + this.transitionAxis + ' ' + turning.nextFromClass + '"></div>');
-        var doublePage = $("#nextDoublePage");
-        if (this.displayOnePage) {
-            this.hidePage('right');
-        }
-
-        if (!this.loader.arePreloadedPages(turning.end)) {
-            this.displayLoader();
-        }
-        this.loader.preloadPagesBeforeTransition(turning.end, function () {
-            $this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
-                $this.beforeTransition(pageNr, 2, turning);
-                $("#currentDoublePage").addClass('axis_' + $this.transitionAxis).addClass('_2d').addClass(turning.currentToClass);
-                $(doublePage).removeClass(turning.nextFromClass).one($this.support.getTransitionEndEvent(), function () {
-                    if ($this.transitionning == false) {
-                        return;
-                    }
-                    $("#currentDoublePage").remove();
-                    $("#nextDoublePage").attr('id', 'currentDoublePage');
-                    $this.afterTransition(pageNr);
-                });
-            });
-        });
-    },
-    pageTransition1D: function (pageNr) {
-        var page = pageNr;
-        var doublePage = $("#currentDoublePage");
-        var $this = this;
-        if (this.displayOnePage) {
-            this.hidePage('right');
-        }
-        var turning = this.getTurningPages(pageNr);
-        this.beforeTransition(pageNr, 1, turning);
-        this.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
-            $this.afterTransition(page);
-        });
-    },
-    beforeTransition: function (page, d, turning) {
-        if (d == undefined) {
-            d = 1;
-        }
-        $(this).trigger('fluidbook.page.change.start', [page, {transition: d, page: page, turningPages: turning.flip}]);
-        this.tooltip.hideTooltip();
-        $(".axis_y").removeClass('axis_y');
-        $(".axis_x").removeClass('axis_x');
-        $("#links").hide();
-        this.hideLoader();
-        this.hideUnnecessaryButtons(page);
-        var animationDuration = d <= 1 ? 0 : parseFloat(this.datas.mobileTransitionDuration);
-        this.updateShadows(page, animationDuration);
-        this.centerBook(turning.center, animationDuration);
-        $("#pagesnumbers").addClass('hidden');
-
-        try {
-            this.search.clearHighlights();
-        } catch (err) {
-
-        }
-    },
-    afterTransition: function (page) {
-        if (this.transitionning === false) {
-            //return;
-        }
-        var $this = this;
-        this.currentPage = page;
-        this.setPageNumbers();
-        setTimeout(function () {
-            $this.loader.preloadAround(page);
-        }, 1000);
-        this.links.initLinks();
-        this.hideLoader();
-        this.resetWaiters();
-        // Clean messy stuffs
-        $("#pages").removeClass('_3dtransition');
-        if ($("#nextDoublePage").length > 0) {
-            $("#currentDoublePage").remove();
-            $("#nextDoublePage").attr('id', 'currentDoublePage');
-        }
-        if ($("#currentDoublePage").length > 1) {
-            $("#currentDoublePage:gt(0)").remove();
-        }
-        this.transitionning = false;
-        if (this.pad.enabled) {
-            if (this.currentPage == this.datas.pages) {
-                $("#down").css('opacity', 0);
-            } else {
-                $("#down").css('opacity', 1);
-                if (!this.bookmarks.hasNextPageInGroup(this.currentPage)) {
-                    $("#down").addClass('right');
-                } else {
-                    $("#down").removeClass('right');
-                }
-            }
-        } else {
-            $("#down").css('opacity', 0);
-        }
-
-        // Handle audio descriptions
-        if (Modernizr.audio) {
-            this.audiodescription.setupPages();
-        }
-
-        $(this).trigger('fluidbook.page.change.end', [this.currentPage]);
-    },
     setPageNumbers: function () {
         $("#pagesnumbers .left").html(this.getPageNumberOfSide('left'));
         $("#pagesnumbers .right").html(this.getPageNumberOfSide('right'));
index 4c23141d8ea26842f9aaadc0700f2d4bac0f4af7..73c6f6fe9318ec96efe80c13682cd27d063fb54d 100644 (file)
@@ -2,6 +2,7 @@ function FluidbookLoader(fluidbook) {
     this.fluidbook = fluidbook;
     this.texts = [];
     this.backgrounds = [];
+    this.textures = [];
     this.links = [];
     this.toPreload = [];
     this.imagesErrors = [];
@@ -13,7 +14,7 @@ FluidbookLoader.prototype = {
             if (this.fluidbook.datas.vectorPages.indexOf(page) >= 0) {
                 return 'vector';
             }
-            if (this.fluidbook.datas.rasterizePages.indexOf(page) == -1) {
+            if (this.fluidbook.datas.rasterizePages.indexOf(page) === -1) {
                 return 'textasvector';
             }
         }
@@ -30,20 +31,10 @@ FluidbookLoader.prototype = {
 
         var $callback = callback;
         var $page = $pages.shift();
-        if ($page > this.fluidbook.datas.pages || $page < 1) {
+
+        this._preloadPage($page, function () {
             $this.preloadPagesBeforeTransition($pages, $callback);
-            return;
-        }
-        this._loadBackground($page, function () {
-            if ($this.getVersionToLoad($page) == 'textasvector') {
-                $this._loadTexts($page, function () {
-                    $this.preloadPagesBeforeTransition($pages, $callback);
-                });
-            } else {
-                $this.preloadPagesBeforeTransition($pages, $callback);
-            }
         });
-
     },
 
     arePreloadedPages: function (pages) {
@@ -62,23 +53,40 @@ FluidbookLoader.prototype = {
         }
 
         var $this = this;
+        var callback = function () {
+            $this.preloadPages();
+        };
+
         var preloadingPage = this.toPreload.shift();
 
-        if (this.backgrounds[preloadingPage] != undefined) {
-            $this.preloadPages();
+        this._preloadPage(preloadingPage, callback);
+    },
+
+    _preloadPage: function (page, callback) {
+        var $this = this;
+        if (this.backgrounds[page] != undefined) {
+            callback();
             return;
         }
 
-        this.backgrounds[preloadingPage] = this.loadImage(this.getBackgroundURL(preloadingPage), null, null, null, function () {
-            if ($this.getVersionToLoad(preloadingPage) == 'textasvector') {
-                $this._loadTexts(preloadingPage, function () {
-                    $this.preloadPages();
-                });
+        if (this.fluidbook.support.transitions3dacc) {
+            $_callback = function () {
+                $this._loadTexture(page, callback);
+            };
+        } else {
+            $_callback = callback;
+        }
+
+        this.backgrounds[page] = this.loadImage(this.getBackgroundURL(page), null, null, null, function () {
+            if ($this.getVersionToLoad(page) === 'textasvector') {
+                $this._loadTexts(page, $_callback);
             } else {
-                $this.preloadPages();
+                $_callback();
             }
         });
     },
+
+
     preloadAround: function (page) {
         if (this.numPreload == 0) {
             this.cleanPreloaded();
@@ -112,6 +120,9 @@ FluidbookLoader.prototype = {
         delete this.backgrounds[page];
         delete this.texts[page];
         delete this.links[page];
+        if (this.textures[page] !== undefined) {
+            delete this.textures[page];
+        }
     },
     setContentsInDoublePage: function (doublePage, pages, immediate, callback) {
         var $this = this;
@@ -211,6 +222,12 @@ FluidbookLoader.prototype = {
         var prefix = (version == 'textasvector') ? 'p' : 't';
         return 'data/background/' + this.fluidbook.support.resolution + '/' + prefix + page + '.jpg';
     },
+
+    getTextureURL: function (page) {
+        var prefix = 't';
+        return 'data/background/150/' + prefix + page + '.jpg';
+    },
+
     getTextsURL: function (page) {
         return 'data/contents/p' + page + '.svg';
     },
@@ -244,6 +261,23 @@ FluidbookLoader.prototype = {
         }
         this.backgrounds[page] = this.loadImage(url, null, null, null, callback);
     },
+    _loadTexture: function (page, callback) {
+        if (this.textures[page] != undefined) {
+            callback();
+        } else {
+            this.__loadTexture(page, callback);
+        }
+    },
+
+    __loadTexture: function (page, callback) {
+        var url = this.getTextureURL(page);
+        if (url == false) {
+            callback();
+            return false;
+        }
+        this.textures[page] = this.loadImage(url, null, null, null, callback);
+    },
+
     loadTexts: function (pageNr, callback) {
 
         if (this.getVersionToLoad(pageNr) == 'raster') {
diff --git a/js/libs/fluidbook/fluidbook.pagetransitions.js b/js/libs/fluidbook/fluidbook.pagetransitions.js
new file mode 100644 (file)
index 0000000..6e103be
--- /dev/null
@@ -0,0 +1,337 @@
+function FluidbookPageTransition(fluidbook) {
+    this.fluidbook = fluidbook;
+    this.init();
+}
+
+FluidbookPageTransition.prototype = {
+    init: function () {
+        if (this.fluidbook.support.transitions3dacc) {
+            this.flip3d = new Fluidbook3DFlip(this.fluidbook);
+        }
+    },
+
+    pageTransition: function (pageNr) {
+
+        if (this.fluidbook.pad.enabled) {
+            this.transitionAxis = this.fluidbook.pad.getTransitionAxis(this.fluidbook.currentPage, page);
+        } else {
+            this.transitionAxis = 'x';
+        }
+
+        $(this.fluidbook).trigger('fluidbook.beforePageTransition');
+
+        this.fluidbook.tooltip.hideTooltip();
+
+        if (pageNr == undefined) {
+            pageNr = this.fluidbook.currentPage;
+            if (pageNr == -1) {
+                pageNr = 1;
+            }
+        }
+        pageNr = this.fluidbook.normalizePage(pageNr);
+        if (pageNr == this.fluidbook.normalizePage(this.fluidbook.currentPage) || this.fluidbook.currentPage == -1 || !this.fluidbook.support.transitions2d || this.fluidbook.datas.mobileTransitions == 'none') {
+            return this.pageTransition1D(pageNr);
+        }
+
+        if (this.fluidbook.displayOnePage) {
+            return this.pageTransition2DPortrait(pageNr);
+        }
+
+        if ((!this.fluidbook.support.transitions3d && !this.fluidbook.support.transitions3dacc) || this.fluidbook.datas.mobileTransitions == 'slide') {
+            return this.pageTransition2D(pageNr);
+        }
+
+        if (this.fluidbook.support.transitions3dacc) {
+            return this.pageTransition3DFlip(pageNr);
+        } else {
+            return this.pageTransition3D(pageNr);
+        }
+    },
+    pageTransition3D: function (pageNr) {
+        var $this = this;
+        if ($("#pages").hasClass('_3dtransition')) {
+            return;
+        }
+        this.transitionning = true;
+        var $this = this;
+        var turning = this.getTurningPages(pageNr);
+        $("#pages").prepend('<div id="nextDoublePage" class="_3d doublePage ' + turning.nextFromClass + 'start"></div>');
+        var doublePage = $("#nextDoublePage");
+        var currentDoublePage = $("#currentDoublePage");
+        if (!this.fluidbook.loader.arePreloadedPages(turning.end)) {
+            this.fluidbook.displayLoader();
+        }
+        this.fluidbook.loader.preloadPagesBeforeTransition(turning.end, function () {
+            $("#pages").addClass('_3dtransition');
+            $this.fluidbook.loader.setContentsInDoublePage(currentDoublePage, turning.flat, true, function () {
+                $this.fluidbook.loader.setContentsInDoublePage(doublePage, turning.flip, true, function () {
+                    $this.beforeTransition(pageNr, 3, turning);
+                    $(doublePage).addClass(turning.nextFromClass + 'end').one($this.fluidbook.support.getTransitionEndEvent(), function () {
+                        if ($this.transitionning == false) {
+                            return;
+                        }
+                        if ($("#nextDoublePage").length == 0) {
+                            $("#pages").removeClass('_3dtransition');
+                            $this.transitionning = false;
+                            return;
+                        }
+
+                        // Set the flat contents with the new page
+                        $this.fluidbook.loader.setContentsInDoublePage(doublePage, turning.end, false, function () {
+                            $(doublePage).removeClass('_3d').removeClass(turning.nextFromClass + 'start').removeClass(turning.nextFromClass + 'end');
+                            // Remove former part
+                            $("#currentDoublePage").remove();
+                            $(doublePage).attr('id', 'currentDoublePage');
+                            $("#pages").removeClass('_3dtransition');
+                            $this.afterTransition(pageNr);
+                        });
+                    });
+                });
+            });
+        });
+    },
+
+    pageTransition3DFlip: function (pageNr) {
+        var $this = this;
+        var turning = this.getTurningPages(pageNr);
+        if (!this.fluidbook.loader.arePreloadedPages(turning.end)) {
+            this.fluidbook.displayLoader();
+        }
+
+        this.fluidbook.loader.preloadPagesBeforeTransition(turning.end, function () {
+            $this.beforeTransition(pageNr, 3, turning);
+            $this.flip3d.playTurn(turning, function () {
+                $this.afterTransition(pageNr);
+            });
+        });
+    },
+
+    getTurningPages: function (newPage) {
+        var res = {};
+        res.dir = 1;
+        if (newPage < this.fluidbook.currentPage) {
+            res.dir = -1;
+        }
+
+        if (this.fluidbook.l10n.dir == 'ltr') {
+            res.currentLeft = this.fluidbook.currentPage - this.fluidbook.currentPage % 2;
+            res.currentRight = res.currentLeft + 1;
+            if (res.dir == 1) {
+                res.currentToClass = 'prev';
+                res.nextFromClass = 'next';
+                res.flat = [res.currentLeft, newPage + 1];
+                res.flip = [newPage, res.currentRight];
+            } else {
+                res.currentToClass = 'next';
+                res.nextFromClass = 'prev';
+                res.flat = [newPage, res.currentRight];
+                res.flip = [res.currentLeft, newPage + 1];
+            }
+
+            res['end'] = [newPage, newPage + 1];
+        } else {
+            res.currentRight = this.fluidbook.currentPage - this.fluidbook.currentPage % 2;
+            res.currentLeft = res.currentRight + 1;
+            if (res.dir == 1) {
+                res.currentToClass = 'next';
+                res.nextFromClass = 'prev';
+                res.flat = [newPage + 1, res.currentRight];
+                res.flip = [res.currentLeft, newPage];
+            } else {
+                res.currentToClass = 'prev';
+                res.nextFromClass = 'next';
+                res.flat = [res.currentLeft, newPage];
+                res.flip = [newPage + 1, res.currentRight];
+            }
+
+            if (this.fluidbook.displayOnePage) {
+                res.end = [newPage, newPage + 1];
+            } else {
+                res.end = [newPage + 1, newPage];
+            }
+        }
+
+        var center = this.centerBookEnabled();
+        res.center = 0;
+        if (center) {
+            if (newPage <= 1) {
+                res.center = -1;
+            } else if (this.fluidbook.datas.pages % 2 == 0 && newPage == this.fluidbook.datas.pages) {
+                res.center = 1;
+            }
+        }
+
+        res.loading = [res.currentLeft, res.currentRight];
+        res = json_parse(JSON.stringify(res));
+        return res;
+    },
+
+    centerBookEnabled: function () {
+        return !!this.fluidbook.datas.centerBook && !this.fluidbook.displayOnePage && $('.tabslink').length == 0;
+    },
+
+
+    centerBook: function (center, animationDuration) {
+        var animate = animationDuration != undefined && animationDuration > 0;
+        var move = $("#center-fluidbook,#center-shadow");
+        var currentLeft = $("#center-fluidbook").data('left');
+        var left = 0;
+        if (center == undefined) {
+            center = $("#center-fluidbook").data('center');
+        }
+        if (center != 0) {
+            left = this.fluidbook.resize.centerOffset * center;
+        }
+
+        if (currentLeft == left) {
+            return;
+        }
+
+        $("#center-fluidbook").data({left: left, center: center});
+
+        if (animate) {
+            $(move).addClass('animate');
+        } else {
+            $(move).removeClass('animate');
+        }
+
+        var delay = this.fluidbook.support.android ? this.fluidbook.datas.mobileTransitionDuration * 1000 : 10;
+        setTimeout(function () {
+            move.transform({translateX: left + 'px'});
+        }, delay);
+    },
+
+    pageTransition2D: function (pageNr) {
+        this.transitionning = true;
+        var $this = this;
+        var turning = this.getTurningPages(pageNr);
+        $("#pages").append('<div id="nextDoublePage" class="doublePage _2d axis_' + this.transitionAxis + ' ' + turning.nextFromClass + '"></div>');
+        var doublePage = $("#nextDoublePage");
+        if (!this.fluidbook.loader.arePreloadedPages(turning.end)) {
+            this.displayLoader();
+        }
+        this.fluidbook.loader.preloadPagesBeforeTransition(turning.end, function () {
+            $this.fluidbook.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
+                $this.beforeTransition(pageNr, 2, turning);
+                $("#currentDoublePage").addClass('_2d').addClass('axis_' + $this.transitionAxis).addClass(turning.currentToClass);
+                $(doublePage).removeClass(turning.nextFromClass).one($this.fluidbook.support.getTransitionEndEvent(), function (event) {
+                    if ($this.transitionning == false) {
+                        return;
+                    }
+                    $("#currentDoublePage").remove();
+                    $("#nextDoublePage").attr('id', 'currentDoublePage');
+                    $this.afterTransition(pageNr);
+                });
+            });
+        });
+    },
+    pageTransition2DPortrait: function (pageNr) {
+        this.transitionning = true;
+        var $this = this;
+        var turning = this.getTurningPages(pageNr);
+        $("#pages").append('<div id="nextDoublePage" class="doublePage _2d axis_' + this.transitionAxis + ' ' + turning.nextFromClass + '"></div>');
+        var doublePage = $("#nextDoublePage");
+        if (this.displayOnePage) {
+            this.hidePage('right');
+        }
+
+        if (!this.fluidbook.loader.arePreloadedPages(turning.end)) {
+            this.displayLoader();
+        }
+        this.fluidbook.loader.preloadPagesBeforeTransition(turning.end, function () {
+            $this.fluidbook.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
+                $this.beforeTransition(pageNr, 2, turning);
+                $("#currentDoublePage").addClass('axis_' + $this.transitionAxis).addClass('_2d').addClass(turning.currentToClass);
+                $(doublePage).removeClass(turning.nextFromClass).one($this.fluidbook.support.getTransitionEndEvent(), function () {
+                    if ($this.transitionning == false) {
+                        return;
+                    }
+                    $("#currentDoublePage").remove();
+                    $("#nextDoublePage").attr('id', 'currentDoublePage');
+                    $this.afterTransition(pageNr);
+                });
+            });
+        });
+    },
+    pageTransition1D: function (pageNr) {
+        var page = pageNr;
+        var doublePage = $("#currentDoublePage");
+        var $this = this;
+        if (this.displayOnePage) {
+            this.hidePage('right');
+        }
+        var turning = this.getTurningPages(pageNr);
+        this.beforeTransition(pageNr, 1, turning);
+        this.fluidbook.loader.setContentsInDoublePage(doublePage, turning.end, true, function () {
+            $this.afterTransition(page);
+        });
+    },
+    beforeTransition: function (page, d, turning) {
+        if (d == undefined) {
+            d = 1;
+        }
+        $(this).trigger('fluidbook.page.change.start', [page, {transition: d, page: page, turningPages: turning.flip}]);
+        this.fluidbook.tooltip.hideTooltip();
+        $(".axis_y").removeClass('axis_y');
+        $(".axis_x").removeClass('axis_x');
+        $("#links").hide();
+        this.fluidbook.hideLoader();
+        this.fluidbook.hideUnnecessaryButtons(page);
+        var animationDuration = d <= 1 ? 0 : parseFloat(this.fluidbook.datas.mobileTransitionDuration);
+        this.fluidbook.updateShadows(page, animationDuration);
+        this.centerBook(turning.center, animationDuration);
+        $("#pagesnumbers").addClass('hidden');
+
+        try {
+            this.search.clearHighlights();
+        } catch (err) {
+
+        }
+    },
+    afterTransition: function (page) {
+        if (this.transitionning === false) {
+            //return;
+        }
+        var $this = this;
+        this.fluidbook.currentPage = page;
+        this.fluidbook.setPageNumbers();
+        setTimeout(function () {
+            $this.fluidbook.loader.preloadAround(page);
+        }, 1000);
+        this.fluidbook.links.initLinks();
+        this.fluidbook.hideLoader();
+        this.fluidbook.resetWaiters();
+        // Clean messy stuffs
+        $("#pages").removeClass('_3dtransition');
+        if ($("#nextDoublePage").length > 0) {
+            $("#currentDoublePage").remove();
+            $("#nextDoublePage").attr('id', 'currentDoublePage');
+        }
+        if ($("#currentDoublePage").length > 1) {
+            $("#currentDoublePage:gt(0)").remove();
+        }
+        this.transitionning = false;
+        if (this.fluidbook.pad.enabled) {
+            if (this.fluidbook.currentPage == this.fluidbook.datas.pages) {
+                $("#down").css('opacity', 0);
+            } else {
+                $("#down").css('opacity', 1);
+                if (!this.fluidbook.bookmarks.hasNextPageInGroup(this.fluidbook.currentPage)) {
+                    $("#down").addClass('right');
+                } else {
+                    $("#down").removeClass('right');
+                }
+            }
+        } else {
+            $("#down").css('opacity', 0);
+        }
+
+        // Handle audio descriptions
+        if (Modernizr.audio) {
+            this.fluidbook.audiodescription.setupPages();
+        }
+
+        $(this.fluidbook).trigger('fluidbook.page.change.end', [this.fluidbook.currentPage]);
+    },
+
+}
\ No newline at end of file
index 2438838ab1375083e7e9e0d5598e7934cb4dc6d3..acbf1e64dc8b77ee4071ff3ef52034e4b0d9e996 100644 (file)
@@ -152,7 +152,7 @@ FluidbookResize.prototype = {
             height: fhh
         });
         this.centerOffset = fw / 4;
-        this.fluidbook.centerBook();
+        this.fluidbook.pagetransitions.centerBook();
 
         if ($("#pagesnumbers").data('size') == null) {
             $("#pagesnumbers").data('size', parseInt($("#pagesnumbers").css('font-size')));
index b9a7233fa15ecf83a34ed3aaf83ad99c5870f5c2..f9c7ccfd7030fbe64971c9e87a7cf84bb4dbf48a 100644 (file)
@@ -31,6 +31,7 @@ function FluidbookSupport(fluidbook) {
 
     this.transitions2d = Modernizr.csstransforms && Modernizr.csstransitions;
     this.transitions3d = Modernizr.csstransforms3d && Modernizr.preserve3d && this.transitions2d;
+    this.transitions3dacc = Modernizr.webgl;
 
     this.ie9 = $("html").hasClass('ie9');
 
index cc85e674631530fb0c6288ce1ec4c66beb84080e..2cd626f3768c882f8d99a8ef7fa59f63284f5112 100644 (file)
@@ -1,3 +1,3 @@
-/*! modernizr 3.3.1 (Custom Build) | MIT *
- * https://modernizr.com/download/?-applicationcache-audio-csstransforms-csstransforms3d-csstransitions-fullscreen-localstorage-preserve3d-sessionstorage-svg-touchevents-video-addtest-atrule-domprefixes-hasevent-mq-prefixed-prefixedcss-prefixedcssvalue-prefixes-setclasses-testallprops-testprop-teststyles !*/
-!function(e,n,t){function r(e,n){return typeof e===n}function o(){var e,n,t,o,i,a,s;for(var c in T)if(T.hasOwnProperty(c)){if(e=[],n=T[c],n.name&&(e.push(n.name.toLowerCase()),n.options&&n.options.aliases&&n.options.aliases.length))for(t=0;t<n.options.aliases.length;t++)e.push(n.options.aliases[t].toLowerCase());for(o=r(n.fn,"function")?n.fn():n.fn,i=0;i<e.length;i++)a=e[i],s=a.split("."),1===s.length?Modernizr[s[0]]=o:(!Modernizr[s[0]]||Modernizr[s[0]]instanceof Boolean||(Modernizr[s[0]]=new Boolean(Modernizr[s[0]])),Modernizr[s[0]][s[1]]=o),w.push((o?"":"no-")+s.join("-"))}}function i(e){var n=_.className,t=Modernizr._config.classPrefix||"";if(b&&(n=n.baseVal),Modernizr._config.enableJSClass){var r=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");n=n.replace(r,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(n+=" "+t+e.join(" "+t),b?_.className.baseVal=n:_.className=n)}function a(e,n){if("object"==typeof e)for(var t in e)x(e,t)&&a(t,e[t]);else{e=e.toLowerCase();var r=e.split("."),o=Modernizr[r[0]];if(2==r.length&&(o=o[r[1]]),"undefined"!=typeof o)return Modernizr;n="function"==typeof n?n():n,1==r.length?Modernizr[r[0]]=n:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=n),i([(n&&0!=n?"":"no-")+r.join("-")]),Modernizr._trigger(e,n)}return Modernizr}function s(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):b?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function c(e){return e.replace(/([a-z])-([a-z])/g,function(e,n,t){return n+t.toUpperCase()}).replace(/^-/,"")}function u(e){return e.replace(/([A-Z])/g,function(e,n){return"-"+n.toLowerCase()}).replace(/^ms-/,"-ms-")}function l(e,n){return!!~(""+e).indexOf(n)}function f(){var e=n.body;return e||(e=s(b?"svg":"body"),e.fake=!0),e}function d(e,t,r,o){var i,a,c,u,l="modernizr",d=s("div"),p=f();if(parseInt(r,10))for(;r--;)c=s("div"),c.id=o?o[r]:l+(r+1),d.appendChild(c);return i=s("style"),i.type="text/css",i.id="s"+l,(p.fake?p:d).appendChild(i),p.appendChild(d),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(n.createTextNode(e)),d.id=l,p.fake&&(p.style.background="",p.style.overflow="hidden",u=_.style.overflow,_.style.overflow="hidden",_.appendChild(p)),a=t(d,e),p.fake?(p.parentNode.removeChild(p),_.style.overflow=u,_.offsetHeight):d.parentNode.removeChild(d),!!a}function p(n,r){var o=n.length;if("CSS"in e&&"supports"in e.CSS){for(;o--;)if(e.CSS.supports(u(n[o]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var i=[];o--;)i.push("("+u(n[o])+":"+r+")");return i=i.join(" or "),d("@supports ("+i+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return t}function v(e,n,o,i){function a(){f&&(delete q.style,delete q.modElem)}if(i=r(i,"undefined")?!1:i,!r(o,"undefined")){var u=p(e,o);if(!r(u,"undefined"))return u}for(var f,d,v,m,h,g=["modernizr","tspan","samp"];!q.style&&g.length;)f=!0,q.modElem=s(g.shift()),q.style=q.modElem.style;for(v=e.length,d=0;v>d;d++)if(m=e[d],h=q.style[m],l(m,"-")&&(m=c(m)),q.style[m]!==t){if(i||r(o,"undefined"))return a(),"pfx"==n?m:!0;try{q.style[m]=o}catch(y){}if(q.style[m]!=h)return a(),"pfx"==n?m:!0}return a(),!1}function m(e,n){return function(){return e.apply(n,arguments)}}function h(e,n,t){var o;for(var i in e)if(e[i]in n)return t===!1?e[i]:(o=n[e[i]],r(o,"function")?m(o,t||n):o);return!1}function g(e,n,t,o,i){var a=e.charAt(0).toUpperCase()+e.slice(1),s=(e+" "+z.join(a+" ")+a).split(" ");return r(n,"string")||r(n,"undefined")?v(s,n,o,i):(s=(e+" "+E.join(a+" ")+a).split(" "),h(s,n,t))}function y(e,n,r){return g(e,t,t,n,r)}var w=[],T=[],C={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,n){var t=this;setTimeout(function(){n(t[e])},0)},addTest:function(e,n,t){T.push({name:e,fn:n,options:t})},addAsyncTest:function(e){T.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=C,Modernizr=new Modernizr,Modernizr.addTest("applicationcache","applicationCache"in e),Modernizr.addTest("svg",!!n.createElementNS&&!!n.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),Modernizr.addTest("localstorage",function(){var e="modernizr";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(n){return!1}}),Modernizr.addTest("sessionstorage",function(){var e="modernizr";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(n){return!1}});var S=C._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];C._prefixes=S;var x;!function(){var e={}.hasOwnProperty;x=r(e,"undefined")||r(e.call,"undefined")?function(e,n){return n in e&&r(e.constructor.prototype[n],"undefined")}:function(n,t){return e.call(n,t)}}();var _=n.documentElement,b="svg"===_.nodeName.toLowerCase();C._l={},C.on=function(e,n){this._l[e]||(this._l[e]=[]),this._l[e].push(n),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},C._trigger=function(e,n){if(this._l[e]){var t=this._l[e];setTimeout(function(){var e,r;for(e=0;e<t.length;e++)(r=t[e])(n)},0),delete this._l[e]}},Modernizr._q.push(function(){C.addTest=a});var P="Moz O ms Webkit",E=C._config.usePrefixes?P.toLowerCase().split(" "):[];C._domPrefixes=E;var z=C._config.usePrefixes?P.split(" "):[];C._cssomPrefixes=z;var $=function(n){var r,o=S.length,i=e.CSSRule;if("undefined"==typeof i)return t;if(!n)return!1;if(n=n.replace(/^@/,""),r=n.replace(/-/g,"_").toUpperCase()+"_RULE",r in i)return"@"+n;for(var a=0;o>a;a++){var s=S[a],c=s.toUpperCase()+"_"+r;if(c in i)return"@-"+s.toLowerCase()+"-"+n}return!1};C.atRule=$;var k=function(){function e(e,n){var o;return e?(n&&"string"!=typeof n||(n=s(n||"div")),e="on"+e,o=e in n,!o&&r&&(n.setAttribute||(n=s("div")),n.setAttribute(e,""),o="function"==typeof n[e],n[e]!==t&&(n[e]=t),n.removeAttribute(e)),o):!1}var r=!("onblur"in n.documentElement);return e}();C.hasEvent=k;var j=function(e,n){var t=!1,r=s("div"),o=r.style;if(e in o){var i=E.length;for(o[e]=n,t=o[e];i--&&!t;)o[e]="-"+E[i]+"-"+n,t=o[e]}return""===t&&(t=!1),t};C.prefixedCSSValue=j,Modernizr.addTest("audio",function(){var e=s("audio"),n=!1;try{(n=!!e.canPlayType)&&(n=new Boolean(n),n.ogg=e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),n.mp3=e.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,""),n.opus=e.canPlayType('audio/ogg; codecs="opus"')||e.canPlayType('audio/webm; codecs="opus"').replace(/^no$/,""),n.wav=e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),n.m4a=(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(t){}return n}),Modernizr.addTest("video",function(){var e=s("video"),n=!1;try{(n=!!e.canPlayType)&&(n=new Boolean(n),n.ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),n.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),n.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""),n.vp9=e.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,""),n.hls=e.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,""))}catch(t){}return n}),Modernizr.addTest("preserve3d",function(){var e=s("a"),n=s("a");e.style.cssText="display: block; transform-style: preserve-3d; transform-origin: right; transform: rotateY(40deg);",n.style.cssText="display: block; width: 9px; height: 1px; background: #000; transform-origin: right; transform: rotateY(40deg);",e.appendChild(n),_.appendChild(e);var t=n.getBoundingClientRect();return _.removeChild(e),t.width&&t.width<4});var A="CSS"in e&&"supports"in e.CSS,N="supportsCSS"in e;Modernizr.addTest("supports",A||N);var L=function(){var n=e.matchMedia||e.msMatchMedia;return n?function(e){var t=n(e);return t&&t.matches||!1}:function(n){var t=!1;return d("@media "+n+" { #modernizr { position: absolute; } }",function(n){t="absolute"==(e.getComputedStyle?e.getComputedStyle(n,null):n.currentStyle).position}),t}}();C.mq=L;var O=C.testStyles=d;Modernizr.addTest("touchevents",function(){var t;if("ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch)t=!0;else{var r=["@media (",S.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");O(r,function(e){t=9===e.offsetTop})}return t});var R={elem:s("modernizr")};Modernizr._q.push(function(){delete R.elem});var q={style:R.elem.style};Modernizr._q.unshift(function(){delete q.style});C.testProp=function(e,n,r){return v([e],t,n,r)};C.testAllProps=g;var B=C.prefixed=function(e,n,t){return 0===e.indexOf("@")?$(e):(-1!=e.indexOf("-")&&(e=c(e)),n?g(e,n,t):g(e,"pfx"))};C.prefixedCSS=function(e){var n=B(e);return n&&u(n)};Modernizr.addTest("fullscreen",!(!B("exitFullscreen",n,!1)&&!B("cancelFullScreen",n,!1))),C.testAllProps=y,Modernizr.addTest("csstransforms",function(){return-1===navigator.userAgent.indexOf("Android 2.")&&y("transform","scale(1)",!0)}),Modernizr.addTest("csstransforms3d",function(){var e=!!y("perspective","1px",!0),n=Modernizr._config.usePrefixes;if(e&&(!n||"webkitPerspective"in _.style)){var t,r="#modernizr{width:0;height:0}";Modernizr.supports?t="@supports (perspective: 1px)":(t="@media (transform-3d)",n&&(t+=",(-webkit-transform-3d)")),t+="{#modernizr{width:7px;height:18px;margin:0;padding:0;border:0}}",O(r+t,function(n){e=7===n.offsetWidth&&18===n.offsetHeight})}return e}),Modernizr.addTest("csstransitions",y("transition","all",!0)),o(),i(w),delete C.addTest,delete C.addAsyncTest;for(var I=0;I<Modernizr._q.length;I++)Modernizr._q[I]();e.Modernizr=Modernizr}(window,document);
\ No newline at end of file
+/*! modernizr 3.6.0 (Custom Build) | MIT *
+ * https://modernizr.com/download/?-applicationcache-audio-csstransforms-csstransforms3d-csstransitions-fullscreen-localstorage-preserve3d-sessionstorage-svg-touchevents-video-webgl-addtest-atrule-domprefixes-hasevent-mq-prefixed-prefixedcss-prefixedcssvalue-prefixes-setclasses-testallprops-testprop-teststyles !*/
+!function(e,t,n){function r(e,t){return typeof e===t}function o(){var e,t,n,o,a,i,s;for(var l in w)if(w.hasOwnProperty(l)){if(e=[],t=w[l],t.name&&(e.push(t.name.toLowerCase()),t.options&&t.options.aliases&&t.options.aliases.length))for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase());for(o=r(t.fn,"function")?t.fn():t.fn,a=0;a<e.length;a++)i=e[a],s=i.split("."),1===s.length?Modernizr[s[0]]=o:(!Modernizr[s[0]]||Modernizr[s[0]]instanceof Boolean||(Modernizr[s[0]]=new Boolean(Modernizr[s[0]])),Modernizr[s[0]][s[1]]=o),C.push((o?"":"no-")+s.join("-"))}}function a(e){var t=E.className,n=Modernizr._config.classPrefix||"";if(z&&(t=t.baseVal),Modernizr._config.enableJSClass){var r=new RegExp("(^|\\s)"+n+"no-js(\\s|$)");t=t.replace(r,"$1"+n+"js$2")}Modernizr._config.enableClasses&&(t+=" "+n+e.join(" "+n),z?E.className.baseVal=t:E.className=t)}function i(e,t){if("object"==typeof e)for(var n in e)P(e,n)&&i(n,e[n]);else{e=e.toLowerCase();var r=e.split("."),o=Modernizr[r[0]];if(2==r.length&&(o=o[r[1]]),"undefined"!=typeof o)return Modernizr;t="function"==typeof t?t():t,1==r.length?Modernizr[r[0]]=t:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=t),a([(t&&0!=t?"":"no-")+r.join("-")]),Modernizr._trigger(e,t)}return Modernizr}function s(e){return e.replace(/([a-z])-([a-z])/g,function(e,t,n){return t+n.toUpperCase()}).replace(/^-/,"")}function l(){return"function"!=typeof t.createElement?t.createElement(arguments[0]):z?t.createElementNS.call(t,"http://www.w3.org/2000/svg",arguments[0]):t.createElement.apply(t,arguments)}function u(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")}function c(){var e=t.body;return e||(e=l(z?"svg":"body"),e.fake=!0),e}function p(e,n,r,o){var a,i,s,u,p="modernizr",f=l("div"),d=c();if(parseInt(r,10))for(;r--;)s=l("div"),s.id=o?o[r]:p+(r+1),f.appendChild(s);return a=l("style"),a.type="text/css",a.id="s"+p,(d.fake?d:f).appendChild(a),d.appendChild(f),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(t.createTextNode(e)),f.id=p,d.fake&&(d.style.background="",d.style.overflow="hidden",u=E.style.overflow,E.style.overflow="hidden",E.appendChild(d)),i=n(f,e),d.fake?(d.parentNode.removeChild(d),E.style.overflow=u,E.offsetHeight):f.parentNode.removeChild(f),!!i}function f(e,t){return!!~(""+e).indexOf(t)}function d(e,t){return function(){return e.apply(t,arguments)}}function v(e,t,n){var o;for(var a in e)if(e[a]in t)return n===!1?e[a]:(o=t[e[a]],r(o,"function")?d(o,n||t):o);return!1}function m(t,n,r){var o;if("getComputedStyle"in e){o=getComputedStyle.call(e,t,n);var a=e.console;if(null!==o)r&&(o=o.getPropertyValue(r));else if(a){var i=a.error?"error":"log";a[i].call(a,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}}else o=!n&&t.currentStyle&&t.currentStyle[r];return o}function y(t,r){var o=t.length;if("CSS"in e&&"supports"in e.CSS){for(;o--;)if(e.CSS.supports(u(t[o]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var a=[];o--;)a.push("("+u(t[o])+":"+r+")");return a=a.join(" or "),p("@supports ("+a+") { #modernizr { position: absolute; } }",function(e){return"absolute"==m(e,null,"position")})}return n}function g(e,t,o,a){function i(){c&&(delete B.style,delete B.modElem)}if(a=r(a,"undefined")?!1:a,!r(o,"undefined")){var u=y(e,o);if(!r(u,"undefined"))return u}for(var c,p,d,v,m,g=["modernizr","tspan","samp"];!B.style&&g.length;)c=!0,B.modElem=l(g.shift()),B.style=B.modElem.style;for(d=e.length,p=0;d>p;p++)if(v=e[p],m=B.style[v],f(v,"-")&&(v=s(v)),B.style[v]!==n){if(a||r(o,"undefined"))return i(),"pfx"==t?v:!0;try{B.style[v]=o}catch(h){}if(B.style[v]!=m)return i(),"pfx"==t?v:!0}return i(),!1}function h(e,t,n,o,a){var i=e.charAt(0).toUpperCase()+e.slice(1),s=(e+" "+$.join(i+" ")+i).split(" ");return r(t,"string")||r(t,"undefined")?g(s,t,o,a):(s=(e+" "+_.join(i+" ")+i).split(" "),v(s,t,n))}function S(e,t,r){return h(e,n,n,t,r)}var C=[],w=[],T={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,t){var n=this;setTimeout(function(){t(n[e])},0)},addTest:function(e,t,n){w.push({name:e,fn:t,options:n})},addAsyncTest:function(e){w.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=T,Modernizr=new Modernizr,Modernizr.addTest("applicationcache","applicationCache"in e),Modernizr.addTest("svg",!!t.createElementNS&&!!t.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect),Modernizr.addTest("localstorage",function(){var e="modernizr";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(t){return!1}}),Modernizr.addTest("sessionstorage",function(){var e="modernizr";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(t){return!1}});var b=T._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];T._prefixes=b;var x="Moz O ms Webkit",_=T._config.usePrefixes?x.toLowerCase().split(" "):[];T._domPrefixes=_;var P,E=t.documentElement,z="svg"===E.nodeName.toLowerCase();!function(){var e={}.hasOwnProperty;P=r(e,"undefined")||r(e.call,"undefined")?function(e,t){return t in e&&r(e.constructor.prototype[t],"undefined")}:function(t,n){return e.call(t,n)}}(),T._l={},T.on=function(e,t){this._l[e]||(this._l[e]=[]),this._l[e].push(t),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},T._trigger=function(e,t){if(this._l[e]){var n=this._l[e];setTimeout(function(){var e,r;for(e=0;e<n.length;e++)(r=n[e])(t)},0),delete this._l[e]}},Modernizr._q.push(function(){T.addTest=i});var $=T._config.usePrefixes?x.split(" "):[];T._cssomPrefixes=$;var j=function(t){var r,o=b.length,a=e.CSSRule;if("undefined"==typeof a)return n;if(!t)return!1;if(t=t.replace(/^@/,""),r=t.replace(/-/g,"_").toUpperCase()+"_RULE",r in a)return"@"+t;for(var i=0;o>i;i++){var s=b[i],l=s.toUpperCase()+"_"+r;if(l in a)return"@-"+s.toLowerCase()+"-"+t}return!1};T.atRule=j;var A=function(){function e(e,t){var o;return e?(t&&"string"!=typeof t||(t=l(t||"div")),e="on"+e,o=e in t,!o&&r&&(t.setAttribute||(t=l("div")),t.setAttribute(e,""),o="function"==typeof t[e],t[e]!==n&&(t[e]=n),t.removeAttribute(e)),o):!1}var r=!("onblur"in t.documentElement);return e}();T.hasEvent=A;var N=function(e,t){var n=!1,r=l("div"),o=r.style;if(e in o){var a=_.length;for(o[e]=t,n=o[e];a--&&!n;)o[e]="-"+_[a]+"-"+t,n=o[e]}return""===n&&(n=!1),n};T.prefixedCSSValue=N,Modernizr.addTest("audio",function(){var e=l("audio"),t=!1;try{t=!!e.canPlayType,t&&(t=new Boolean(t),t.ogg=e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),t.mp3=e.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,""),t.opus=e.canPlayType('audio/ogg; codecs="opus"')||e.canPlayType('audio/webm; codecs="opus"').replace(/^no$/,""),t.wav=e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),t.m4a=(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(n){}return t}),Modernizr.addTest("video",function(){var e=l("video"),t=!1;try{t=!!e.canPlayType,t&&(t=new Boolean(t),t.ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),t.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),t.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""),t.vp9=e.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,""),t.hls=e.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,""))}catch(n){}return t}),Modernizr.addTest("webgl",function(){var t=l("canvas"),n="probablySupportsContext"in t?"probablySupportsContext":"supportsContext";return n in t?t[n]("webgl")||t[n]("experimental-webgl"):"WebGLRenderingContext"in e}),Modernizr.addTest("preserve3d",function(){var t,n,r=e.CSS,o=!1;return r&&r.supports&&r.supports("(transform-style: preserve-3d)")?!0:(t=l("a"),n=l("a"),t.style.cssText="display: block; transform-style: preserve-3d; transform-origin: right; transform: rotateY(40deg);",n.style.cssText="display: block; width: 9px; height: 1px; background: #000; transform-origin: right; transform: rotateY(40deg);",t.appendChild(n),E.appendChild(t),o=n.getBoundingClientRect(),E.removeChild(t),o=o.width&&o.width<4)});var k="CSS"in e&&"supports"in e.CSS,L="supportsCSS"in e;Modernizr.addTest("supports",k||L);var R=function(){var t=e.matchMedia||e.msMatchMedia;return t?function(e){var n=t(e);return n&&n.matches||!1}:function(t){var n=!1;return p("@media "+t+" { #modernizr { position: absolute; } }",function(t){n="absolute"==(e.getComputedStyle?e.getComputedStyle(t,null):t.currentStyle).position}),n}}();T.mq=R;var O=T.testStyles=p;Modernizr.addTest("touchevents",function(){var n;if("ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch)n=!0;else{var r=["@media (",b.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");O(r,function(e){n=9===e.offsetTop})}return n});var q={elem:l("modernizr")};Modernizr._q.push(function(){delete q.elem});var B={style:q.elem.style};Modernizr._q.unshift(function(){delete B.style});T.testProp=function(e,t,r){return g([e],n,t,r)};T.testAllProps=h;var I=T.prefixed=function(e,t,n){return 0===e.indexOf("@")?j(e):(-1!=e.indexOf("-")&&(e=s(e)),t?h(e,t,n):h(e,"pfx"))};T.prefixedCSS=function(e){var t=I(e);return t&&u(t)};Modernizr.addTest("fullscreen",!(!I("exitFullscreen",t,!1)&&!I("cancelFullScreen",t,!1))),T.testAllProps=S,Modernizr.addTest("csstransforms",function(){return-1===navigator.userAgent.indexOf("Android 2.")&&S("transform","scale(1)",!0)}),Modernizr.addTest("csstransforms3d",function(){return!!S("perspective","1px",!0)}),Modernizr.addTest("csstransitions",S("transition","all",!0)),o(),a(C),delete T.addTest,delete T.addAsyncTest;for(var U=0;U<Modernizr._q.length;U++)Modernizr._q[U]();e.Modernizr=Modernizr}(window,document);
\ No newline at end of file
index bfd6cf0b585ea297e00581713bb98ca7eaddb115..07d40912b31ecf59180c776a746604034e3a072f 100644 (file)
@@ -4,7 +4,6 @@ Modernizr.addTest('ftouch', function () {
     }
     var bool;
 
-
     if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch || ('onmsgesturechange' in window)) {
         bool = true;
     } else {
index 16608076b1e896f7e97df08a8517c4263124749d..53e8f3a00e7f4aa5dbf534b126ec418ae65fb4fc 100644 (file)
@@ -2166,7 +2166,7 @@ ul.chapters {
        top: 0;
        left: 0;
        z-index: 12;
-       //background-color: rgba(255, 0, 0, 0.5);
+       pointer-events: none;
 }
 
 /* 3D */