Skip to content

Commit

Permalink
bugfix keyword highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
Jörg Schlötterer committed Nov 16, 2015
1 parent 52b4010 commit 34bf67c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eexcess",
"version": "0.0.1",
"version": "1.3.1",
"authors": [
"eexcess consortium <eexcess@joanneum.at>"
],
Expand All @@ -20,7 +20,7 @@
],
"dependencies": {
"bootstrap": "3.3.4",
"c4": ">=6.1.3",
"c4": ">=6.1.4",
"jquery": "~2.1.4",
"jquery-ui": "~1.11.4",
"peas": "https://github.com/EEXCESS/peas.git",
Expand Down
8 changes: 5 additions & 3 deletions js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,14 @@ require(['c4/searchBar/searchBar', 'c4/APIconnector', 'util', 'c4/iframes', 'up/
$(document).on('c4_keywordMouseEnter', function(e) {
var offsets = focusedParagraph.offsets[e.originalEvent.detail.text];
var map = paragraphDetection.getOffsetMap($('#' + focusedParagraph.id).get(0));
offsets.sort;
offsets.sort(function(a,b){
return a-b;
});
var idx = 0;
var current = map[0];
for (var i = 0; i < offsets.length; i++) {
for (var j = idx; j < map.length; j++) {
if (offsets[i] < map[j].offset) {
if (offsets[i] < map[j].offset || j === map.length -1) {
var word = e.originalEvent.detail.text.toLowerCase();
var text = current.el.nodeValue.toLowerCase();
if (text.indexOf(word, offsets[i] - current.offset) !== offsets[i] - current.offset) {
Expand All @@ -245,7 +247,7 @@ require(['c4/searchBar/searchBar', 'c4/APIconnector', 'util', 'c4/iframes', 'up/
for (var k = 0; k < word.length; k++) {
var char = word.charAt(k);
if (char === text.charAt(k)) {
comparison += char
comparison += char;
} else {
break;
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "EEXCESS",
"version": "1.3.0",
"version": "1.3.1",
"background": {
"page": "html/background.html"
},
Expand Down

0 comments on commit 34bf67c

Please sign in to comment.