Skip to content

Commit

Permalink
Highlight the matched porton of the search
Browse files Browse the repository at this point in the history
Fixed #1409
  • Loading branch information
coke committed Jul 5, 2017
1 parent 6582ed0 commit b7d08b5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions template/search_template.js
Expand Up @@ -6,6 +6,13 @@ $(function(){
this._super();
this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
},
_renderItem: function( ul, item) {
var regex = new RegExp('(' + current_search + ')', 'ig');
var text = item.label.replace(regex, '<b>$1</b>');
return $( "<li>" )
.append( $( "<div>" ).html(text) )
.appendTo( ul );
},
_renderMenu: function( ul, items ) {
var that = this,
currentCategory = "";
Expand Down

0 comments on commit b7d08b5

Please sign in to comment.