From: Vincent Vanwaelscappel Date: Wed, 26 Jan 2022 16:35:58 +0000 (+0100) Subject: wait #5057 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ccf1df7db1bd013152e4349e7dc8543496ab2fc0;p=fluidbook-html5.git wait #5057 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 0ac66d16..06306006 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -22,8 +22,7 @@ function FluidbookNav(fluidbook) { FluidbookNav.prototype = { initMenu: function () { - var $this = this, - dir = this.fluidbook.l10n.dir, + var $this = this, dir = this.fluidbook.l10n.dir, inverted = this.fluidbook._boolean(this.fluidbook.settings.invertMenuPosition), side = ((dir === 'ltr' && inverted) || (dir === 'rtl' && !inverted)) ? 'right' : 'left'; @@ -42,22 +41,17 @@ FluidbookNav.prototype = { return !$(this).is('#menu_download,#menu_print'); } return true; - }, - preventDefault: function () { + }, preventDefault: function () { return false; }, }, - "extensions": extensions, - "offCanvas": { - "position": side, - "zposition": "front", - }, - "navbar": { + "extensions": extensions, "offCanvas": { + "position": side, "zposition": "front", + }, "navbar": { //add: false // Removes main title bars completely title: "" // Hides the default "Menu" text - }, - "rtl": { + }, "rtl": { "use": "detect" // Auto detect when in RTL mode based on html dir attribute }, @@ -127,15 +121,11 @@ FluidbookNav.prototype = { // Add scrollbar to main menu $('#menuList > ul, #chapterList').perfectScrollbar({ - suppressScrollX: true, - minScrollbarLength: 40, - //maxScrollbarLength: 60 + suppressScrollX: true, minScrollbarLength: 40, //maxScrollbarLength: 60 }); - }, - closeMenu: function () { + }, closeMenu: function () { this.menuAPI.close(); - }, - // getIcon: function (name) { + }, // getIcon: function (name) { // var src = 'data/images/' + name + '.'; // if (this.fluidbook.support.SVG) { // src += 'svg'; @@ -148,8 +138,7 @@ FluidbookNav.prototype = { // return this.fluidbook.loader.getImage(src, this._dimensions[name][0], this._dimensions[name][1]); // }, addLink: function (navType, name, href, id, title, help, keyboardShortcut, before, className, showIcon) { - var $nav = this.getNavFromType(navType), - elementID = navType + '_' + id; + var $nav = this.getNavFromType(navType), elementID = navType + '_' + id; if ($nav.find('#' + elementID).length > 0) { return; @@ -162,8 +151,7 @@ FluidbookNav.prototype = { $nav.find("ul #" + before).before(li); } return $("#" + elementID).get(0); - }, - getLink: function (name, href, id, title, help, className, showIcon, navType, keyboardShortcut) { + }, getLink: function (name, href, id, title, help, className, showIcon, navType, keyboardShortcut) { if (showIcon === undefined) { showIcon = true; } @@ -238,8 +226,7 @@ FluidbookNav.prototype = { } else { return ''; } - }, - getNavFromType: function (navType) { + }, getNavFromType: function (navType) { switch (navType) { case 'horizontalNav': return this.horizontalNav; @@ -251,8 +238,7 @@ FluidbookNav.prototype = { console.error('navType ' + navType + ' not found!'); return false; } - }, - setNav: function (navType) { + }, setNav: function (navType) { if (typeof navType === 'undefined') { return false; @@ -277,8 +263,7 @@ FluidbookNav.prototype = { * __('switch on the sound') * __('notes') */ - var $this = this, - navOrder = this.fluidbook.settings.navOrder; // Default desktop order, maybe be overridden later + var $this = this, navOrder = this.fluidbook.settings.navOrder; // Default desktop order, maybe be overridden later var v2 = ''; if (this.fluidbook.settings.iconSet < 15) { @@ -326,29 +311,7 @@ FluidbookNav.prototype = { // All possible icons and default ordering - var all = [ - "extra", - "index", - "chapters", - "search", - "friend", - "print", - "pdf", - 'notes', - "bookmark", - "archives", - "basket", - "fullscreen", - "sound", - "3d", - "help", - "lang", - "extra1", - "extra2", - "extra3", - "extra4", - "extra5", - ]; + var all = ["extra", "index", "chapters", "search", "friend", "print", "pdf", 'notes', "bookmark", "archives", "basket", "fullscreen", "sound", "3d", "help", "lang", "extra1", "extra2", "extra3", "extra4", "extra5",]; // Fallback to default list if navOrder is still empty for some reason if (navOrder.length === 0) { @@ -522,10 +485,7 @@ FluidbookNav.prototype = { } } else if (icon === 'extra') { - var id = 'extra', - $nav = this.getNavFromType(navType), - elementID = navType + '_' + id, - navExtraImage, + var id = 'extra', $nav = this.getNavFromType(navType), elementID = navType + '_' + id, navExtraImage, navLinkTarget = ''; // Check to see if navExtraLink is external or not and set target accordingly @@ -572,10 +532,7 @@ FluidbookNav.prototype = { var url = 'data/images/' + extraIcon; extraNPerURL[url] = n; $.ajax({ - url: url, - type: 'GET', - dataType: 'xml', - success: function (data) { + url: url, type: 'GET', dataType: 'xml', success: function (data) { var n1 = extraNPerURL[this.url]; var svg = $(data).find('svg'); // Fix #2111 @@ -840,8 +797,7 @@ FluidbookNav.prototype = { }, getMenuCloseButton: function () { - var $this = this, - buttonID = 'menuClose'; + var $this = this, buttonID = 'menuClose'; // Click handler to close menu $(document).on(this.fluidbook.input.clickEvent, '#' + buttonID, function (e) { @@ -851,9 +807,8 @@ FluidbookNav.prototype = { // and return the user to the main menu instead of closing the menu if ($this.fluidbook.search.isSearchActive()) { $this.fluidbook.search.closeSearch(); - if (!$("#horizontalNav").is(':visible')) { + if ($("#horizontalNav").is(':visible')) { $this.menuAPI.close(); - } } else { // If we're closing the menu but the search was open and nothing @@ -940,9 +895,7 @@ FluidbookNav.prototype = { // Build nested lists from chapters makeChapterLists: function (chapters) { - var currentLevel = 0, - loopIndex = 0, - html = '