]> _ Git - fluidbook-html5.git/commitdiff
done #1625 @0:20
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 28 Aug 2017 09:14:01 +0000 (11:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 28 Aug 2017 09:14:01 +0000 (11:14 +0200)
js/libs/fluidbook/fluidbook.search.js

index b5d1829eae1175b923440c73eee94caed57ab4cd..14dea88654cff44e5cd3b343ae563effcd8e3e28 100644 (file)
@@ -3,6 +3,7 @@ function FluidbookSearch(fluidbook) {
     this.indexLoaded = false;
     this.termsToHighlight = [];
     this.highlights = [];
+    this.highlightEnabled = fluidbook.datas.highlightResults;
     this.init();
 }
 
@@ -37,10 +38,15 @@ FluidbookSearch.prototype = {
         var $this = this;
         loadJSLibrary('data/search.index.js', function () {
             loadJSLibrary('data/search.texts.js', function () {
-                loadJSLibrary('data/search.highlight.js', function () {
+                if ($this.highlightEnabled) {
+                    loadJSLibrary('data/search.highlight.js', function () {
+                        $this.indexLoaded = true;
+                        callback();
+                    });
+                } else {
                     $this.indexLoaded = true;
                     callback();
-                });
+                }
             });
         });
     },
@@ -137,6 +143,9 @@ FluidbookSearch.prototype = {
         return source;
     },
     setHighlightTerms: function (terms) {
+        if(!this.highlightEnabled){
+            return;
+        }
         this.termsToHighlight = terms;
         this.highlights = [];
         if (terms.length == 0) {
@@ -156,6 +165,9 @@ FluidbookSearch.prototype = {
         $("#searchHighlights").html('');
     },
     highlightSearchTerms: function (pageNr) {
+        if(!this.highlightEnabled){
+            return;
+        }
         this.clearHighlights();
         if (this.termsToHighlight.length == 0) {
             return;