From: Vincent Vanwaelscappel Date: Tue, 19 Sep 2017 13:28:24 +0000 (+0200) Subject: done #1672 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=90daac95b447158f7fe74287beff7ee99a7c2390;p=fluidbook-html5.git done #1672 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.search.js b/js/libs/fluidbook/fluidbook.search.js index e3333774..9c9b1f99 100644 --- a/js/libs/fluidbook/fluidbook.search.js +++ b/js/libs/fluidbook/fluidbook.search.js @@ -4,6 +4,7 @@ function FluidbookSearch(fluidbook) { this.termsToHighlight = []; this.highlights = []; this.highlightEnabled = fluidbook.datas.highlightResults; + this.resultPages = []; this.init(); } @@ -78,6 +79,7 @@ FluidbookSearch.prototype = { var terms = []; var total = 0; var doublesPages = {}; + this.resultPages = []; // var allPages=Array.apply(null, Array(this.fluidbook.datas.pages)).map(function (_, i) {return i+1;}); @@ -126,10 +128,12 @@ FluidbookSearch.prototype = { occ += doublePageOccurences[ww]; } res[dpNumber] = occ; + this.resultPages.push(parseInt(dpNumber)); total += occ; } } + var returnVal = { total: total, results: res, @@ -213,6 +217,17 @@ FluidbookSearch.prototype = { return; } + // Test if we highlight results + if (!this.fluidbook.datas.highlightAllOccurences) { + var evenPageNumber = pageNr; + if (evenPageNumber % 2 == 1) { + evenPageNumber--; + } + if (this.resultPages.indexOf(evenPageNumber) == -1) { + return; + } + } + var pageNrs = []; if (this.fluidbook.resize.orientation == 'portrait') { pageNrs.push(pageNr); diff --git a/style/fluidbook.less b/style/fluidbook.less index 61d94a17..6ec1922e 100644 --- a/style/fluidbook.less +++ b/style/fluidbook.less @@ -303,25 +303,25 @@ body, html { position: absolute; top: 0px; left: 0px; - z-index:3; + z-index: 3; .highlight { position: absolute; border-width: 2px; border-radius: 2px; border-style: solid; - &[data-color="0"] { + &[data-color="0"], &[data-color="5"], &[data-color="10"] { .highlight-area(#00ff00); } - &[data-color="1"] { + &[data-color="1"], &[data-color="6"], &[data-color="11"] { .highlight-area(#ffff00); } - &[data-color="2"] { + &[data-color="2"], &[data-color="7"], &[data-color="12"] { .highlight-area(#00ffff); } - &[data-color="3"] { + &[data-color="3"], &[data-color="8"], &[data-color="13"] { .highlight-area(#ff00ff); } - &[data-color="4"] { + &[data-color="4"], &[data-color="9"], &[data-color="14"] { .highlight-area(#ff0000); } }