]> _ Git - fluidbook-html5.git/commitdiff
wip #3000 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Sep 2019 13:48:39 +0000 (15:48 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 4 Sep 2019 13:48:39 +0000 (15:48 +0200)
js/libs/fluidbook/fluidbook.interface.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.nav.js

index 736826f391a824402ac7e3eef61b8b9758e99da3..d0435ac82b6e398a66bfa288e16d4ae5c25d7384 100644 (file)
@@ -53,7 +53,7 @@ FluidbookInterface.prototype = {
     },
 
     autoHideArrows: function () {
-        var res = this.arrowsEnabled && this.fluidbook.resize.reduceHorizontalMargins() && this.areArrowsOverlapingPublication() && ($("#helpView:visible").length === 0);
+        var res = this.arrowsEnabled && (this.fluidbook.resize===undefined || this.fluidbook.resize.reduceHorizontalMargins()) && this.areArrowsOverlapingPublication() && ($("#helpView:visible").length === 0);
         return res;
     },
 
@@ -76,10 +76,8 @@ FluidbookInterface.prototype = {
                 $(document).on('click', ':not(a)', function () {
                     var selector = '#fluidbook';
                     if (!$(this).is(selector) && $(this).closest(selector).length === 0) {
-                        console.log('nok', $(this));
                         return true;
                     }
-                    console.log('ok', $(this));
                     $this.toggleInterface(1000);
                     return true;
                 });
index 696df85bb1be8d0b3deea35d607e0c16b0988d90..1fabdfe316b112639f2d22840c0be8bc38cf4dcf 100644 (file)
@@ -101,6 +101,7 @@ Fluidbook.prototype = {
 
         this.contentlock.init();
 
+        this.nav = new FluidbookNav(this);
         this.interface = new FluidbookInterface(this);
         this.resize = new FluidbookResize(this);
         this.pagetransitions = new FluidbookPageTransition(this);
@@ -266,7 +267,6 @@ Fluidbook.prototype = {
 
         $("#main").css('display', 'block');
 
-        this.nav = new FluidbookNav(this);
         if (!this.mobilefirst.enabled) {
             this.slider = new FluidbookSlider(this);
         }
index f0b1b80bef421bee73de02849d7a0991851dd99a..38f2c2e9fc35f0240cbd44c4cffba6e0e418b891 100644 (file)
@@ -69,7 +69,9 @@ FluidbookNav.prototype = {
             $('body').addClass('menu-open');
             $this.menuIsOpen = true;
 
-            setInterval($this.fluidbook.resize.resizeMenu, 500);
+            setInterval(function () {
+                $this.fluidbook.resize.resizeMenu()
+            }, 500);
 
             //$('#q').focus(); // Disabled for now because it triggers the keyboard to open on some mobile devices
         });
@@ -91,7 +93,9 @@ FluidbookNav.prototype = {
         });
 
         // Recalculate available size for menu search results
-        $(this.fluidbook).on('fluidbook.resize', this.fluidbook.resize.resizeMenu);
+        $(this.fluidbook).on('fluidbook.resize', function () {
+            $this.fluidbook.resize.resizeMenu();
+        });
 
         // Handle swipe to close (it's only really practical to have this because swipe to open would interfere with main Fluidbook swipes)
         // We are not using MMenu's "Drag" add-on because it doesn't close the main menu, only submenus on swipe.
@@ -595,10 +599,10 @@ FluidbookNav.prototype = {
             }
         }
 
-        if (navType == 'menu') {
+        if (navType === 'menu') {
 
             // Insert Chapters submenus
-            if (this.chaptersMenuHTML != '') {
+            if (this.chaptersMenuHTML !=='') {
                 $('#menu_chapters').parent().append(this.chaptersMenuHTML);
             }