Show More
@@ -1063,8 +1063,12 b' var autocompleteMatchGroups = function (' | |||||
1063 | return matches; |
|
1063 | return matches; | |
1064 | }; |
|
1064 | }; | |
1065 |
|
1065 | |||
1066 | // Helper highlight function for the formatter |
|
1066 | // Highlight the snippet if it is found in the full text. | |
1067 | var autocompleteHighlightMatch = function (full, snippet, matchindex) { |
|
1067 | // Snippet must be lowercased already. | |
|
1068 | var autocompleteHighlightMatch = function (full, snippet) { | |||
|
1069 | var matchindex = full.toLowerCase().indexOf(snippet); | |||
|
1070 | if (matchindex <0) | |||
|
1071 | return full; | |||
1068 | return full.substring(0, matchindex) |
|
1072 | return full.substring(0, matchindex) | |
1069 | + "<span class='match'>" |
|
1073 | + "<span class='match'>" | |
1070 | + full.substr(matchindex, snippet.length) |
|
1074 | + full.substr(matchindex, snippet.length) | |
@@ -1104,14 +1108,10 b' var autocompleteFormatter = function (oR' | |||||
1104 | if (oResultData.grname != undefined) { |
|
1108 | if (oResultData.grname != undefined) { | |
1105 | var grname = oResultData.grname; |
|
1109 | var grname = oResultData.grname; | |
1106 | var grmembers = oResultData.grmembers; |
|
1110 | var grmembers = oResultData.grmembers; | |
1107 | var grnameMatchIndex = grname.toLowerCase().indexOf(query); |
|
|||
1108 | var grprefix = "{0}: ".format(_TM['Group']); |
|
1111 | var grprefix = "{0}: ".format(_TM['Group']); | |
1109 | var grsuffix = " ({0} {1})".format(grmembers, _TM['members']); |
|
1112 | var grsuffix = " ({0} {1})".format(grmembers, _TM['members']); | |
1110 |
|
1113 | |||
1111 | if (grnameMatchIndex > -1) { |
|
1114 | return autocompleteGravatar(grprefix + autocompleteHighlightMatch(grname, query) + grsuffix, null, null, true); | |
1112 | return autocompleteGravatar(grprefix + autocompleteHighlightMatch(grname, query, grnameMatchIndex) + grsuffix, null, null, true); |
|
|||
1113 | } |
|
|||
1114 | return autocompleteGravatar(grprefix + oResultData.grname + grsuffix, null, null, true); |
|
|||
1115 |
|
1115 | |||
1116 | // users |
|
1116 | // users | |
1117 | } else if (oResultData.nname != undefined) { |
|
1117 | } else if (oResultData.nname != undefined) { | |
@@ -1120,30 +1120,13 b' var autocompleteFormatter = function (oR' | |||||
1120 | var nname = oResultData.nname; |
|
1120 | var nname = oResultData.nname; | |
1121 |
|
1121 | |||
1122 | // Guard against null value |
|
1122 | // Guard against null value | |
1123 | var fnameMatchIndex = fname.toLowerCase().indexOf(query), |
|
1123 | var displayfname = autocompleteHighlightMatch(fname, query); | |
1124 | lnameMatchIndex = lname.toLowerCase().indexOf(query), |
|
|||
1125 | nnameMatchIndex = nname.toLowerCase().indexOf(query), |
|
|||
1126 | displayfname, displaylname, displaynname, displayname; |
|
|||
1127 |
|
1124 | |||
1128 | if (fnameMatchIndex > -1) { |
|
1125 | var displaylname = autocompleteHighlightMatch(lname, query); | |
1129 | displayfname = autocompleteHighlightMatch(fname, query, fnameMatchIndex); |
|
|||
1130 | } else { |
|
|||
1131 | displayfname = fname; |
|
|||
1132 | } |
|
|||
1133 |
|
1126 | |||
1134 | if (lnameMatchIndex > -1) { |
|
1127 | var displaynname = autocompleteHighlightMatch(nname, query); | |
1135 | displaylname = autocompleteHighlightMatch(lname, query, lnameMatchIndex); |
|
|||
1136 | } else { |
|
|||
1137 | displaylname = lname; |
|
|||
1138 | } |
|
|||
1139 |
|
1128 | |||
1140 | if (nnameMatchIndex > -1) { |
|
1129 | var displayname = displaynname; | |
1141 | displaynname = autocompleteHighlightMatch(nname, query, nnameMatchIndex); |
|
|||
1142 | } else { |
|
|||
1143 | displaynname = nname; |
|
|||
1144 | } |
|
|||
1145 |
|
||||
1146 | displayname = displaynname; |
|
|||
1147 | if (displayfname && displaylname) { |
|
1130 | if (displayfname && displaylname) { | |
1148 | displayname = "{0} {1} ({2})".format(displayfname, displaylname, displayname); |
|
1131 | displayname = "{0} {1} ({2})".format(displayfname, displaylname, displayname); | |
1149 | } |
|
1132 | } |
General Comments 0
You need to be logged in to leave comments.
Login now