From 861c766009acf06dd86a2760b9af0971b23661e0 Mon Sep 17 00:00:00 2001 From: soufiane Date: Sun, 8 Feb 2026 22:14:04 +0100 Subject: [PATCH] wait #7989 @1:00 --- js/libs/fluidbook/fluidbook.burger.js | 6 ++---- js/libs/fluidbook/fluidbook.search.js | 29 ++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.burger.js b/js/libs/fluidbook/fluidbook.burger.js index 9c1a2a16..dfced6ee 100644 --- a/js/libs/fluidbook/fluidbook.burger.js +++ b/js/libs/fluidbook/fluidbook.burger.js @@ -66,8 +66,6 @@ FluidbookBurger.prototype = { // Add holder list element for menu items $("#menu").append(''); - console.log("flooooat", this.floatmode) - if(this.floatmode) { $('body').append(this.initSearch()); } else { @@ -274,9 +272,9 @@ FluidbookBurger.prototype = { var res = '
'; res += ''; res += ''; - res += ''; + res += ''; res += '
'; res += ''; res += ''; diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index c3936a29..d1ba4d47 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -1,5 +1,6 @@ function FluidbookSearch(fluidbook) { this.fluidbook = fluidbook; + //this.searchfloat = new FluidbookSearchFloat(fluidbook); this.indexLoaded = false; this.indexLoading = false; this.termsToHighlight = []; @@ -39,8 +40,6 @@ FluidbookSearch.prototype = { }); this.initResultsNav(); - - console.log("search",$this.fluidbook.nav) }, debugSearch: function (keyword) { @@ -85,6 +84,12 @@ FluidbookSearch.prototype = { this.resultsNav = $('#' + this.resultsNavID); //=== Event handlers + $(document).on(this.fluidbook.input.clickEvent, 'body.floatmode #menuSearchHints a', function () { + // Find the page number of the result so we can see where it sits in the list of returned results + var pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb').attr('page')); + $this.openResultsNav(pageNumber); + }); + $(document).on(this.fluidbook.input.clickEvent, '#menuSearchResults a', function () { // Find the page number of the result so we can see where it sits in the list of returned results var pageNumber = parseInt($(this).find('.doubleThumb').attr('page')); @@ -157,6 +162,10 @@ FluidbookSearch.prototype = { this.updateResultsNav(resultPage); this.hideableElements.addClass('hidden'); this.resultsNav.removeClass('hidden'); + $('body.floatmode #menuSearch').hide(); + setTimeout(function () { + $('body.floatmode #menuSearch').addClass('hidden').show(); + }, 100); $('body').addClass(this.resultsActiveClass); setTimeout(function () { if ($this.fluidbook.input.isUsingKeyboard()) { @@ -833,7 +842,7 @@ FluidbookSearch.prototype = { this.fluidbook.nav.burger.hideMenuItems(); // Hide menu items to give space for hints div this.menuSearchHints.fadeIn(300); - $("#menuSearch").fadeIn(300); + $("#menuSearch").removeClass("hidden") }, getSearchHints: function (q) { @@ -970,7 +979,7 @@ FluidbookSearch.prototype = { var $this = this; this.find(q, function (results) { - $this.openResults(results); + $this.openResults(results, this.fluidbook.floatmode); }); }, @@ -1070,12 +1079,22 @@ FluidbookSearch.prototype = { this.highlightSearchTerms(this.fluidbook.currentPage); // Redirect to the only result page if the flag is enabled - if (gotoPageIfOneResult && spreadEnabled === 1) { + if(this.fluidbook.nav.burger.floatmode && gotoPageIfOneResult) { setTimeout(function () { fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page')); + var pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb').attr('page')); + $this.openResultsNav(pageNumber); fluidbook.nav.burger.close(); }, 100); return; + } else { + if (gotoPageIfOneResult && spreadEnabled === 1) { + setTimeout(function () { + fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page')); + fluidbook.nav.burger.close(); + }, 100); + return; + } } this.menuSearchResults.fadeIn(300).scrollTop(0); -- 2.39.5