From cdb1005f8aab5ee9d8a505f3341d4038cb53f1bf Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 28 Aug 2017 11:14:01 +0200 Subject: [PATCH] done #1625 @0:20 --- js/libs/fluidbook/fluidbook.search.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index b5d1829e..14dea886 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -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; -- 2.39.5