forked from Archives/Athou_commafeed
fix jslint warning
This commit is contained in:
@@ -412,9 +412,8 @@ module.directive('droppable', ['CategoryService', 'FeedService', function(Catego
|
|||||||
module.filter('highlight', function() {
|
module.filter('highlight', function() {
|
||||||
return function(html, keywords) {
|
return function(html, keywords) {
|
||||||
if (keywords) {
|
if (keywords) {
|
||||||
var tokens = keywords.split(' ');
|
var handleKeyword = function(token, html) {
|
||||||
for ( var i = 0; i < tokens.length; i++) {
|
var expr = new RegExp(token, 'gi');
|
||||||
var expr = new RegExp(tokens[i], 'gi');
|
|
||||||
var container = $('<span>').html(html);
|
var container = $('<span>').html(html);
|
||||||
var elements = container.find('*').addBack();
|
var elements = container.find('*').addBack();
|
||||||
var textNodes = elements.not('iframe').contents().not(elements);
|
var textNodes = elements.not('iframe').contents().not(elements);
|
||||||
@@ -424,6 +423,11 @@ module.filter('highlight', function() {
|
|||||||
$(this).remove();
|
$(this).remove();
|
||||||
});
|
});
|
||||||
return container.html();
|
return container.html();
|
||||||
|
};
|
||||||
|
|
||||||
|
var tokens = keywords.split(' ');
|
||||||
|
for ( var i = 0; i < tokens.length; i++) {
|
||||||
|
html = handleKeyword(tokens[i], html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return html;
|
return html;
|
||||||
|
|||||||
Reference in New Issue
Block a user