},
_find: function (q, callback) {
+ this.resultPages = [];
if (this.robust) {
return this._findRobust(q, callback);
}
var terms = [];
var total = 0;
var doublePages = [];
- this.resultPages = [];
+
var matchedWord, indexWord, searchTerm, term, page;
var maxPage = this.fluidbook.contentlock.getMaxPage();
setRobustHighlightTerms: function (terms) {
let term = terms.join('');
- let firstLetter = term.split('')[0];
- var h = {occurences: HIGHLIGHTS[firstLetter], color: 0, word: firstLetter, term: term};
- this.highlights.push(h);
+ let letters = term.split('');
+
+ let occurences = [];
+
+ for (let i = 0; i < letters.length; i++) {
+ let letter = letters[i];
+ if (i === 0) {
+ occurences = HIGHLIGHTS[letter];
+ } else {
+ let filteredOccurences = [];
+ for (let j in occurences) {
+ let o = occurences[j];
+ for (let k in HIGHLIGHTS[letter]) {
+ if (HIGHLIGHTS[letter][k].o === o.o + i) {
+ if (o.next === undefined) {
+ o.next = [];
+ }
+ o.next.push(HIGHLIGHTS[letter][k]);
+ filteredOccurences.push(o);
+ }
+ }
+ }
+ occurences = filteredOccurences;
+ }
+ }
+
+ if (!occurences.length) {
+ return;
+ }
+
+ for (let i in occurences) {
+ let o = occurences[i];
+ this.highlights.push({occurences: [o], color: 0, word: term, term: term});
+ this.highlights.push({occurences: o.next, color: 0, word: term, term: term});
+ }
},
clearHighlights: function () {
width: (width + 2 * padding) * z,
height: (position.height + padding * 3) * z
};
- if (this.robust) {
- coords.width = coords.height;
- }
var transform = {};
if (position.rotation) {
transform.rotate = -position.rotation + 'deg';
left: 0px;
z-index: 6;
pointer-events: none;
+ opacity: 0.3;
.highlight {
position: absolute;
transform-origin: 0 0;
- &.robust {
- border-radius: 50% 50%;
- animation: pulse 1s infinite alternate linear;
- transform-origin: 50% 50%;
- }
+ //&.robust {
+ // border-radius: 50% 50%;
+ // animation: pulse 1s infinite alternate linear;
+ // transform-origin: 50% 50%;
+ //}
&[data-color="0"], &[data-color="5"], &[data-color="10"] {
.highlight-area(#00ff00);