]> _ Git - fluidbook-html5.git/commitdiff
wait #7995
authorsoufiane <soufiane@cubedesigners.com>
Mon, 9 Feb 2026 18:48:15 +0000 (19:48 +0100)
committersoufiane <soufiane@cubedesigners.com>
Mon, 9 Feb 2026 18:48:15 +0000 (19:48 +0100)
js/libs/fluidbook/fluidbook.burger.js
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.nav.js
js/libs/fluidbook/fluidbook.search.float.js [new file with mode: 0644]
js/libs/fluidbook/fluidbook.search.js

index 5023f0b2bcd406e0b2b8a397220a901fdc578c58..1388d320efb0d36e0376a6234e16ba85335a3e8d 100644 (file)
@@ -3,7 +3,6 @@ function FluidbookBurger(nav) {
     this.fluidbook = nav.fluidbook;
     this.closeTimeout;
     this.isOpened = false;
-    this.floatmode = this.fluidbook.floatmode;
 }
 
 FluidbookBurger.prototype = {
@@ -66,7 +65,7 @@ FluidbookBurger.prototype = {
         // Add holder list element for menu items
         $("#menu").append('<div id="menuList"' + v2 + '><ul></ul></div>');
 
-        if(this.floatmode) {
+        if(this.fluidbook.search.isSearchfloatActive) {
             $('body').append(this.initSearch());
         } else {
             this.searchHTML = this.initSearch()
@@ -133,7 +132,7 @@ FluidbookBurger.prototype = {
         if (!this.isOpened) {
             $('body').addClass('menu-open');
             $("#menuOverlay").show();
-            if(!this.floatmode) {
+            if(!this.fluidbook.search.isSearchfloatActive) {
                 $("#menu").show()
             }
             setTimeout(function () {
@@ -216,7 +215,7 @@ FluidbookBurger.prototype = {
         } else {
             this.open(false);
 
-            if(this.floatmode && !floatSearchVisible) {
+            if(this.fluidbook.search.isSearchfloatActive && !floatSearchVisible) {
                 $("#menuSearch").hide().removeClass('hidden')
                 setTimeout(function(){
                     $("#menuSearch").show()
@@ -298,7 +297,7 @@ FluidbookBurger.prototype = {
         let $this = this;
 
         let res = this.getSearchHtml();
-        if(this.floatmode) {
+        if(this.fluidbook.search.isSearchfloatActive) {
             res = this.getFloatSearchHTML()
         }
         search.append(res);
@@ -338,7 +337,7 @@ FluidbookBurger.prototype = {
 
         // Close floatSearch
         const menuSearchClose = $("#menuSearchClose")
-        if(!this.floatmode) {
+        if(!this.fluidbook.search.isSearchfloatActive) {
             menuSearchClose.hide()
         }
 
index 1898e0ec1cd754a11946b1eb290debd6ba452b89..131c1d214ec1f362f673623273ed4dca5fa5f67e 100644 (file)
@@ -180,6 +180,7 @@ Fluidbook.prototype = {
         this.help = new FluidbookHelp(this);
         this.articles = new FluidbookArticles(this);
 
+
         try {
             $('head').append('<style>#shadow > .shadow{' + new Solver(new Color(this.settings.bookShadeColor[0], this.settings.bookShadeColor[1], this.settings.bookShadeColor[2])).solve().filter + '}</style>');
         } catch (e) {
@@ -235,6 +236,11 @@ Fluidbook.prototype = {
         this.datas = this.settings;
         $('html').addClass('linksanimation-' + this.settings.linksAnimation);
         $('html').addClass('linksanimationlayer-' + this.settings.linksAnimationLayer);
+
+        // Add class if search is float
+        if(this.settings.search_field === "float") {
+            $('body').addClass('floatmode');
+        }
     },
 
     setMaxPage: function (p, allowbackwards) {
index d2a9015e2e29bc5f19e7ef08c91ea8fbdfc53bb9..fe9381cd65204341060978a74217ca2109382c27 100644 (file)
@@ -197,7 +197,6 @@ FluidbookNav.prototype = {
         // MMenu specific elements
         if (navType === 'menu') {
             this.burger.initNav();
-            this.burger.initSearch();
             if (this.fluidbook.settings.navOrderH.length > 0) {
                 navOrder = this.fluidbook.settings.navOrderH;
             }
@@ -546,7 +545,7 @@ FluidbookNav.prototype = {
 
         // Search icon in horizontal menu
         $(document).on(this.fluidbook.input.clickEvent, '#horizontalNav_searchIcon', function (event) {
-            event.preventDefault()
+            event.preventDefault();
             $this.burger.openSearch();
         });
 
diff --git a/js/libs/fluidbook/fluidbook.search.float.js b/js/libs/fluidbook/fluidbook.search.float.js
new file mode 100644 (file)
index 0000000..c0b35cd
--- /dev/null
@@ -0,0 +1,10 @@
+function FluidbookSearchFloat(fluidbook) {
+    this.fluidbook = fluidbook;
+    this.init();
+}
+
+FluidbookSearchFloat.prototype = {
+    init: function() {
+        console.log('ok search float')
+    }
+}
\ No newline at end of file
index afc69bfcf207e8a681294ece810a284e8f420b9c..dbecec4f638c8cba8cb73de13b9b73cc642c5204 100644 (file)
@@ -1,6 +1,6 @@
 function FluidbookSearch(fluidbook) {
     this.fluidbook = fluidbook;
-    //this.searchfloat = new FluidbookSearchFloat(fluidbook);
+    this.isSearchfloatActive = null;
     this.indexLoaded = false;
     this.indexLoading = false;
     this.termsToHighlight = [];
@@ -40,6 +40,12 @@ FluidbookSearch.prototype = {
         });
 
         this.initResultsNav();
+
+        if($('body').hasClass('floatmode')) {
+            this.isSearchfloatActive = true;
+        }
+
+        this.searchfloat = new FluidbookSearchFloat(this.fluidbook);
     },
 
     debugSearch: function (keyword) {
@@ -110,7 +116,7 @@ FluidbookSearch.prototype = {
         });
 
         $(document).on(this.fluidbook.input.clickEvent, '.searchResultsNavClose', function () {
-            if($this.fluidbook.floatmode) {
+            if($this.fluidbook.search.isSearchfloatActive) {
                 $this.closeResultsNavInFloatMode();
             }else {
                 $this.closeResultsNav();
@@ -993,7 +999,7 @@ FluidbookSearch.prototype = {
 
         var $this = this;
         this.find(q, function (results) {
-            $this.openResults(results, this.fluidbook.floatmode);
+            $this.openResults(results);
         });
     },
 
@@ -1093,7 +1099,7 @@ FluidbookSearch.prototype = {
         this.highlightSearchTerms(this.fluidbook.currentPage);
 
         // Redirect to the only result page if the flag is enabled
-        if(this.fluidbook.nav.burger.floatmode && gotoPageIfOneResult) {
+        if(this.fluidbook.search.isSearchfloatActive && $this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').length > 0) {
             setTimeout(function () {
                 fluidbook.setCurrentPage($this.menuSearchResults.find('.doubleThumb[data-enabled="1"]').attr('page'));
                 var pageNumber = parseInt($("#menuSearchResults a").find('.doubleThumb').attr('page'));
@@ -1111,7 +1117,9 @@ FluidbookSearch.prototype = {
             }
         }
 
+        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
         // keyboard being open and reducing the available window height. We need to wait until