]> _ Git - fluidbook-html5.git/commitdiff
fix #1683 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Sep 2017 15:26:32 +0000 (17:26 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Sep 2017 15:26:32 +0000 (17:26 +0200)
js/libs/fluidbook/fluidbook.js
js/libs/fluidbook/fluidbook.nav.js
js/libs/fluidbook/fluidbook.search.js
js/main.js
style/fluidbook.less

index 06ebb9b58fd04054835a76c4d6138b4759382dc6..4b0824190dc24a84d6b34c1d496cdf7845312716 100644 (file)
@@ -58,9 +58,7 @@ Fluidbook.prototype = {
         this.privacy = new FluidbookPrivacy(this);
         this.refw = 0;
         this.refh = 0;
-        this.searchHintXHR = null;
         this.searchString = '';
-
         this.vectorTexts = !this.support.imagesVersion;
         this.displayOnePage = false;
         this.indexHTML = '';
@@ -726,39 +724,6 @@ Fluidbook.prototype = {
         return i + 1;
     },
 
-    getSearchHints: function (q) {
-
-        var $this = this;
-        this.killLastSearchHint();
-        this.search.getHints(q, function (r) {
-            $this.displaySearchHints(r);
-        });
-    },
-    displaySearchHints: function (hints) {
-
-        this.hideSearchHints();
-        if (hints.length == 0) {
-            return;
-        }
-        $.each(hints, function (k, v) {
-            $("#searchHints").append('<a class="hint" term="' + v[0] + '" href="#/search/' + v[0] + '">' + v[0] + ' <em>(' + v[1] + ')</em></a>');
-        });
-        var qoffset = $("#q").offset();
-        var top = qoffset.top + $("#q").outerHeight() + 5;
-        var left = qoffset.left;
-        if (this.l10n.dir == 'rtl') {
-            left = -1 * ($(window).width() - left - $("#q").outerWidth());
-        }
-        $("#searchHints").css({top: top, left: left}).show();
-    },
-    killLastSearchHint: function () {
-        this.search.kill();
-    },
-    hideSearchHints: function () {
-        this.killLastSearchHint();
-        $("#searchHints").html('');
-        $("#searchHints").hide();
-    },
     print: function () {
         var $this = this;
         var pdf;
@@ -897,9 +862,6 @@ Fluidbook.prototype = {
         return a.cloneNode(false).href;
     },
 
-    highlightSearchTerms: function (pageNr) {
-        return;
-    },
     touchOffset: function (offset) {
         offset *= $("#currentDoublePage").width();
         $("#currentDoublePage").addClass('sliding');
index d0edb2796c4267dc5d042f90356c38ef07fbec72..9bbe46748be1d0f5c2542fdc3e956812f952c2d2 100644 (file)
@@ -255,7 +255,7 @@ FluidbookNav.prototype = {
 
         $("#q").blur(function (e) {
             setTimeout(function () {
-                $this.fluidbook.hideSearchHints();
+               $this.fluidbook.search.hideSearchHints();
             }, 250);
         });
         $("#nav").append($("#search"));
index a40e4aedf262281cb96dc0be28d72bf649646a09..cd6faccc13c0b8afeffcd30d4f4a0f66c7fa60c0 100644 (file)
@@ -290,6 +290,37 @@ FluidbookSearch.prototype = {
         $(h).attr('data-hash', hash);
         $(h).css(coords);
         $("#searchHighlights").append(h);
-    }
+    },
+    getSearchHints: function (q) {
+        var $this = this;
+        this.killLastSearchHint();
+        this.getHints(q, function (r) {
+            $this.displaySearchHints(r);
+        });
+    },
+    displaySearchHints: function (hints) {
+        this.hideSearchHints();
+        if (hints.length == 0) {
+            return;
+        }
+        $.each(hints, function (k, v) {
+            $("#searchHints").append('<a class="hint" term="' + v[0] + '" href="#/search/' + v[0] + '">' + v[0] + ' </a>');
+        });
+        var qoffset = $("#q").offset();
+        var top = qoffset.top + $("#q").outerHeight() + 5;
+        var left = qoffset.left;
+        if (this.fluidbook.l10n.dir == 'rtl') {
+            left = -1 * ($(window).width() - left - $("#q").outerWidth());
+        }
+        $("#searchHints").css({top: top, left: left}).show();
+    },
+    killLastSearchHint: function () {
+        this.kill();
+    },
+    hideSearchHints: function () {
+        this.killLastSearchHint();
+        $("#searchHints").html('');
+        $("#searchHints").hide();
+    },
 };
 
index 5c8334b8f4e81417a8daa7ba9684425035d82677..d3c08a450c07ec1fb650c5420dc0b826f2b98308 100644 (file)
@@ -1,6 +1,7 @@
 var DEVICE_READY_BEFORE_JQUERY = false;
 var JQUERY_READY = false;
 document.addEventListener('deviceready', _onDeviceReady, false);
+
 function _onDeviceReady() {
     if (JQUERY_READY) {
         onDeviceReady();
@@ -502,13 +503,12 @@ function setBackground(page, resolution) {
 }
 
 function searchHints() {
-    if ($("#q").val().length >= 3) {
-        fluidbook.getSearchHints($("#q").val());
+    if ($("#q").val().length >= 1) {
+        fluidbook.search.getSearchHints($("#q").val());
     } else {
         try {
-            fluidbook.hideSearchHints();
+            fluidbook.search.hideSearchHints();
         } catch (err) {
-
         }
     }
 }
index 6ec1922e373bc0dc7665c936b258e5ce3d769133..1b102042ea6097958b4a276d0838602cd453f4d0 100644 (file)
@@ -681,7 +681,7 @@ header {
        padding: 5px;
        display: none;
        z-index: 25;
-       position: relative;
+       position: absolute;
 }
 
 #logo {