From: Vincent Vanwaelscappel Date: Fri, 22 Apr 2022 14:50:33 +0000 (+0200) Subject: wait #5251 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=29a7325a1a72f2011a3b8684daefe409787f8e8e;p=fluidbook-html5.git wait #5251 @1.5 --- diff --git a/js/libs/fluidbook/fluidbook.help.js b/js/libs/fluidbook/fluidbook.help.js index 0566dde2..420f3e8b 100644 --- a/js/libs/fluidbook/fluidbook.help.js +++ b/js/libs/fluidbook/fluidbook.help.js @@ -198,7 +198,7 @@ FluidbookHelp.prototype = { $(document).on(this.fluidbook.input.clickEvent, '.icon-help', function (e) { $this.show(); if ($this.fluidbook.nav.menuIsOpen) { - $this.fluidbook.nav.menuAPI.close(); + $this.fluidbook.nav.closeMenu(); } e.preventDefault(); }); diff --git a/js/libs/fluidbook/fluidbook.menu.js b/js/libs/fluidbook/fluidbook.menu.js index ba65882a..f26f34e6 100644 --- a/js/libs/fluidbook/fluidbook.menu.js +++ b/js/libs/fluidbook/fluidbook.menu.js @@ -63,6 +63,7 @@ FluidbookMenu.prototype = { __openView: function (view, param1, param2, callback) { + var closeMenu = true; try { if (typeof param1 === 'string') { param1 = decodeURIComponent(param1); @@ -110,6 +111,7 @@ FluidbookMenu.prototype = { } else if (view === 'freeiframe') { this.openFreeiframe(param1, cb); } else if (view === 'search') { + closeMenu = false; this.openSearch(param1, cb); } else if (view === 'print') { this.openPrint(cb); @@ -121,7 +123,9 @@ FluidbookMenu.prototype = { this['open' + camelView](param1, param2, cb); } - this.fluidbook.nav.closeMenu(); + if (closeMenu) { + this.fluidbook.nav.closeMenu(); + } }, openNotes: function (p1, p2, cb) { this.fluidbook.notes.openMenu(cb); }, openSearch: function (q, cb) { diff --git a/js/libs/fluidbook/fluidbook.nav.js b/js/libs/fluidbook/fluidbook.nav.js index 4203ab68..1b1d1843 100644 --- a/js/libs/fluidbook/fluidbook.nav.js +++ b/js/libs/fluidbook/fluidbook.nav.js @@ -91,7 +91,7 @@ FluidbookNav.prototype = { // Close menu when a search result is clicked $(document).on(this.fluidbook.input.clickEvent, '#menuSearchResults a', function (e) { - $this.menuAPI.close(); + $this.closeMenu(); }); // Recalculate available size for menu search results @@ -113,7 +113,7 @@ FluidbookNav.prototype = { return false; } - $this.menuAPI.close(); + $this.closeMenu(); }); @@ -124,7 +124,8 @@ FluidbookNav.prototype = { $('#menuList > ul, #chapterList').perfectScrollbar({ suppressScrollX: true, minScrollbarLength: 40, //maxScrollbarLength: 60 }); - }, closeMenu: function () { + }, + closeMenu: function () { this.menuAPI.close(); }, // getIcon: function (name) { // var src = 'data/images/' + name + '.'; @@ -376,7 +377,7 @@ FluidbookNav.prototype = { window.location = $($thislink).attr('href'); }, 500); } else { - $this.menuAPI.close(); + $this.closeMenu(); window.location = $(this).attr('href'); } return false; @@ -743,7 +744,7 @@ FluidbookNav.prototype = { // Full screen toggle $(document).on(this.fluidbook.input.clickEvent, '.icon-fullscreen', function () { - $this.menuAPI.close(); + $this.closeMenu(); screenfull.toggle(); return false; }); @@ -777,12 +778,13 @@ FluidbookNav.prototype = { this.menuAPI.closeAllPanels(); // Make sure we're on the main panel with the search box } } - this.menuAPI.open(); + if (q !== undefined) { $("#q").val(q); this.fluidbook.search.submitForm(); } else { + this.menuAPI.open(); $('#q').focus(); // Put cursor in the search field } @@ -803,7 +805,7 @@ FluidbookNav.prototype = { if ($this.fluidbook.search.isSearchActive()) { $this.fluidbook.search.closeSearch(); if ($("#horizontalNav").is(':visible')) { - $this.menuAPI.close(); + $this.closeMenu(); } } else { // If we're closing the menu but the search was open and nothing @@ -816,7 +818,7 @@ FluidbookNav.prototype = { $this.fluidbook.search.closeSearch(); } - $this.menuAPI.close(); + $this.closeMenu(); } }); diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index 62703256..6313808f 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -824,7 +824,7 @@ FluidbookSearch.prototype = { if (gotoPageIfOneResult && spreadEnabled === 1) { setTimeout(function () { fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page')); - fluidbook.nav.menuAPI.close(); + fluidbook.nav.closeMenu(); }, 100); return; }