From: Vincent Vanwaelscappel Date: Wed, 25 Feb 2026 17:43:16 +0000 (+0100) Subject: wip #8009 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6356ea56c5aa6958f4ce80372ee66ecaf3521fe0;p=fluidbook-html5.git wip #8009 @1 --- diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index 1bef2bfe..e7efcea3 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -42,7 +42,7 @@ FluidbookSearch.prototype = { this.initResultsNav(); - if($('body').hasClass('floatmode')) { + if ($('body').hasClass('floatmode')) { this.isSearchfloatActive = true; } @@ -110,9 +110,9 @@ FluidbookSearch.prototype = { }); $(document).on(this.fluidbook.input.clickEvent, '.searchResultsNavClose', function () { - if($this.fluidbook.search.isSearchfloatActive) { + if ($this.fluidbook.search.isSearchfloatActive) { $this.closeResultsNavInFloatMode(); - }else { + } else { $this.closeResultsNav(); } }); @@ -131,14 +131,14 @@ FluidbookSearch.prototype = { updateResultsNav: function (resultPage) { // To avoid double calls causing problems - if(!this.isSearchfloatActive) { + if (!this.isSearchfloatActive) { this.callNumber = 0; } // If we are in landscape view, there are 2 pages visible, // so we only want even pages in our results. The resultPages // includes all pages by default so we need to convert odd pages // to even and remove duplicates created. - if(this.callNumber < 1) { + if (this.callNumber < 1) { if (this.fluidbook.resize.orientation === "landscape") { const noOddPages = this.resultPages.map(function (page) { @@ -218,7 +218,7 @@ FluidbookSearch.prototype = { $('body').removeClass(this.resultsActiveClass); }, - closeResultsNavInFloatMode: function() { + closeResultsNavInFloatMode: function () { this.hideableElements.removeClass('hidden'); this.resultsNav.addClass('hideUp').addClass('hidden'); setTimeout(() => { @@ -377,7 +377,10 @@ FluidbookSearch.prototype = { if (k.indexOf(q) !== 0) { continue; } - res.push([k, v.t]); + for (var w in v.w){ + break; + } + res.push([w, v.t]); } for (var p in this.plugins) { @@ -1114,12 +1117,12 @@ FluidbookSearch.prototype = { this.highlightSearchTerms(this.fluidbook.currentPage); // Redirect to the only result page if the flag is enabled - if(this.fluidbook.search.isSearchfloatActive && $this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').length > 0) { + if (this.fluidbook.search.isSearchfloatActive && $this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').length > 0) { this.callNumber = 0; setTimeout(function () { let page = referencePage; - let pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb[data-enabled="1"][data-pages*='+parseInt(referencePage)+']').attr('page')); - if($this.fluidbook.resize.orientation === "landscape") { + let pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb[data-enabled="1"][data-pages*=' + parseInt(referencePage) + ']').attr('page')); + if ($this.fluidbook.resize.orientation === "landscape") { page = pageNumber; } fluidbook.setCurrentPage(page); @@ -1137,8 +1140,8 @@ FluidbookSearch.prototype = { } } - if(!this.fluidbook.search.isSearchfloatActive) { - this.menuSearchResults.fadeIn(300).scrollTop(0); + if (!this.fluidbook.search.isSearchfloatActive) { + this.menuSearchResults.fadeIn(300).scrollTop(0); } // On some phones, the height of the search results is miscalculated due to the