From d50155cfb554b989699eb7f163c827c113543646 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 11 Oct 2017 14:30:48 +0200 Subject: [PATCH] #807 --- js/libs/fluidbook/fluidbook.nav.js | 38 ++++++++++++------------------ 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index dbeb3271..7bdf1428 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -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'); } }; -- 2.39.5