]> _ Git - fluidbook-html5.git/commitdiff
#807
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2017 12:30:48 +0000 (14:30 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Oct 2017 12:30:48 +0000 (14:30 +0200)
js/libs/fluidbook/fluidbook.nav.js

index dbeb3271472651765a7999561e3901037c0555b2..7bdf14284f308f3eef2cc134d742308ad0e5fbf0 100644 (file)
@@ -289,19 +289,11 @@ FluidbookNav.prototype = {
             "lang",
         ];
 
-        // Note: no longer necessary to hide icons this way because their event handlers are set in initEventHandlers()
-        // var hide = array_diff(all, this.fluidbook.datas.navOrder); // Array of icons that aren't in the navOrder list and should be hidden
-        // var loop = [].concat(this.fluidbook.datas.navOrder).concat(hide);
-
         // Fallback to default list if navOrder is still empty for some reason
         if (navOrder.length == 0) {
             navOrder = all;
         }
 
-        if (!this.fluidbook.datas.displayChaptersIcon) {
-            hide.push('chapters');
-        }
-
         // If the locales icon is included, it should always be placed last in the list for formatting reasons
         var localeIconIndex;
         if ((localeIconIndex = navOrder.indexOf('lang')) !== -1) {
@@ -360,25 +352,25 @@ FluidbookNav.prototype = {
             } else if (icon == 'index') {
                 link = this.addLink(navType, 'nav-index', '#/index', 'index', 'overview', 'overview');
             } else if (icon == 'chapters') {
-                if (this.fluidbook.datas.displayChaptersIcon) {
-                    if (this.fluidbook.datas.chaptersPage != '') {
-                        link = this.addLink(navType, 'nav-chapters', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters', 'chapters');
-                    } else if (this.fluidbook.datas.chapters.length > 0) {
+                if (!this.fluidbook.datas.displayChaptersIcon) {
+                    continue;
+                }
+                if (this.fluidbook.datas.chaptersPage != '') {
+                    link = this.addLink(navType, 'nav-chapters', '#/page/' + this.fluidbook.datas.chaptersPage, 'chapters', 'chapters', 'chapters');
+                } else if (this.fluidbook.datas.chapters.length > 0) {
 
-                        // NOTE: Currently the MMenu breaks when the non-cascading chapter UL HTML is inserted so it will
-                        // be opened in a popup for now. Todo: fix this so it works as a sub panel of it's own
-                        if (navType == 'menu' && this.fluidbook.datas.chaptersCascade && !this.fluidbook.datas.displayChaptersPopup) {
-                            link = this.addLink(navType, 'nav-chapters', '', 'chapters', 'chapters', 'chapters');
+                    // NOTE: Currently the MMenu breaks when the non-cascading chapter UL HTML is inserted so it will
+                    // be opened in a popup for now. Todo: fix this so it works as a sub panel of it's own
+                    if (navType == 'menu' && this.fluidbook.datas.chaptersCascade && !this.fluidbook.datas.displayChaptersPopup) {
+                        link = this.addLink(navType, 'nav-chapters', '', 'chapters', 'chapters', 'chapters');
 
-                            // Get HTML for submenus (appended later)
-                            this.chaptersMenuHTML = this.makeChapterLists(this.fluidbook.datas.chapters);
+                        // Get HTML for submenus (appended later)
+                        this.chaptersMenuHTML = this.makeChapterLists(this.fluidbook.datas.chapters);
 
-                        } else {
-                            link = this.addLink(navType, 'nav-chapters', '#/chapters', 'chapters', 'chapters', 'chapters');
-                        }
+                    } else {
+                        link = this.addLink(navType, 'nav-chapters', '#/chapters', 'chapters', 'chapters', 'chapters');
                     }
                 }
-
                 // Sharing icons - this may contain many different icons
             } else if (icon == 'friend') {
                 if (this.fluidbook.share.isEnabled()) {
@@ -874,7 +866,7 @@ FluidbookNav.prototype = {
         return html;
     },
 
-    burgerActive:function(){
+    burgerActive: function () {
         return $('#menuOpener').is(':visible');
     }
 };