diff --git a/src/main/webapp/js/directives.js b/src/main/webapp/js/directives.js index 33099cb9..65207f88 100644 --- a/src/main/webapp/js/directives.js +++ b/src/main/webapp/js/directives.js @@ -424,4 +424,26 @@ module.directive('droppable', [ 'CategoryService', 'FeedService', }); } }; - } ]); \ No newline at end of file + } ]); + + +module.filter('highlight', function() { + return function(html, keywords) { + if (keywords) { + var tokens = keywords.split(' '); + for (var i = 0; i < tokens.length; i++) { + var expr = new RegExp(tokens[i], 'gi'); + var container = $('').html(html); + var elements = container.find('*').addBack(); + var textNodes = elements.not('iframe').contents().not(elements); + textNodes.each(function() { + var replaced = this.nodeValue.replace(expr, '$&'); + $('').html(replaced).insertBefore(this); + $(this).remove(); + }); + return container.html(); + } + } + return html; + }; +}); \ No newline at end of file diff --git a/src/main/webapp/sass/components/_entry-list.scss b/src/main/webapp/sass/components/_entry-list.scss index b32cf85c..cc81f98f 100644 --- a/src/main/webapp/sass/components/_entry-list.scss +++ b/src/main/webapp/sass/components/_entry-list.scss @@ -234,4 +234,9 @@ #feed-accordion .current.entry-font-size-5 { font-size: 19px; +} + +#feed-accordion .highlight-search { + background-color: rgba(255, 255, 140, 0.5); + color: #333; } \ No newline at end of file diff --git a/src/main/webapp/templates/feeds.view.html b/src/main/webapp/templates/feeds.view.html index 690ed2f8..2bd246cb 100644 --- a/src/main/webapp/templates/feeds.view.html +++ b/src/main/webapp/templates/feeds.view.html @@ -32,7 +32,7 @@ {{entry.feedName}} {{entry.date | entryDate}} - + @@ -42,7 +42,7 @@ ng-class="{rtl: entry.rtl}">
- +
${view.entry_source} @@ -57,7 +57,7 @@
-
+