]> _ Git - fluidbook-html5.git/commitdiff
wait #7989 @1:00
authorsoufiane <soufiane@cubedesigners.com>
Sun, 8 Feb 2026 21:14:04 +0000 (22:14 +0100)
committersoufiane <soufiane@cubedesigners.com>
Sun, 8 Feb 2026 21:14:04 +0000 (22:14 +0100)
js/libs/fluidbook/fluidbook.burger.js
js/libs/fluidbook/fluidbook.search.js

index 9c1a2a16960f5e760ec1ecf9fc281e17f0bbe4a4..dfced6ee039c4674bbd41fcbdfd1046ce5dc9bf7 100644 (file)
@@ -66,8 +66,6 @@ FluidbookBurger.prototype = {
         // Add holder list element for menu items
         $("#menu").append('<div id="menuList"' + v2 + '><ul></ul></div>');
 
-        console.log("flooooat", this.floatmode)
-
         if(this.floatmode) {
             $('body').append(this.initSearch());
         } else {
@@ -274,9 +272,9 @@ FluidbookBurger.prototype = {
         var res = '<form action="#" id="searchForm" method="post">';
         res += '<input id="q" name="q" type="search" value="" aria-label="' + this.fluidbook.l10n.__('search keywords or reference') + '" placeholder="' + this.fluidbook.l10n.__('search keywords or reference') + '" autocorrect="off" autocomplete="off" autocapitalize="off" />';
         res += '<a href="#" id="submitSearch" class="icon-submitSearch" role="button" tabindex="-1" aria-label="' + this.fluidbook.l10n.__('submit search') + '"><svg viewBox="0 0 512 512" class="nav-search nav-icon svg-icon" aria-hidden="true"><use xlink:href="#nav-search"></use></svg></a>';
-        res += '<button id="menuSearchClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
+        res += '<div id="menuSearchClose" role="button" aria-label="' + this.fluidbook.l10n.__('close') + '" aria-keyshortcuts="Escape">';
         res += getSpriteIcon('interface-close');
-        res += '</button>';
+        res += '</div>';
         res += '</form>';
         res += '<div id="menuSearchHints" class="mm-nopanel"></div>';
         res += '<div id="menuSearchResults" class="mm-nopanel"></div>';
index c3936a298d8b02e8116b06868fd9f1f386fef9bf..d1ba4d47ce7259e0c95c8110f0a975a4ac00eae2 100644 (file)
@@ -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);