summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-12-06 16:20:54 -0800
committerBrion Vibber <brion@pobox.com>2010-12-06 16:20:54 -0800
commitdaae13df1c2d202cba0769803a9ef03892495ccb (patch)
tree068ce6fd8b3f937217eef94ee93fff2121be2387 /plugins/Autocomplete
parent851dbf1361071bebe34900a6802724b017c68cfc (diff)
Start tweaking Autocomplete js
Diffstat (limited to 'plugins/Autocomplete')
-rw-r--r--plugins/Autocomplete/Autocomplete.js23
1 files changed, 9 insertions, 14 deletions
diff --git a/plugins/Autocomplete/Autocomplete.js b/plugins/Autocomplete/Autocomplete.js
index 3eff685a8..f39c1a7a7 100644
--- a/plugins/Autocomplete/Autocomplete.js
+++ b/plugins/Autocomplete/Autocomplete.js
@@ -1,27 +1,22 @@
$(document).ready(function(){
+ function fullName(row) {
+ if (typeof row.fullname == "string" && row.fullname != '') {
+ return row.nickname + ' (' + row.fullname + ')';
+ } else {
+ return row.nickname;
+ }
+ }
$('#notice_data-text').autocomplete($('address .url')[0].href+'/plugins/Autocomplete/autocomplete.json', {
multiple: true,
multipleSeparator: " ",
minChars: 1,
formatItem: function(row, i, max){
row = eval("(" + row + ")");
- switch(row.type)
- {
- case 'user':
- return row.nickname + ' (' + row.fullname + ')';
- case 'group':
- return row.nickname + ' (' + row.fullname + ')';
- }
+ return fullName(row);
},
formatMatch: function(row, i, max){
row = eval("(" + row + ")");
- switch(row.type)
- {
- case 'user':
- return row.nickname;
- case 'group':
- return row.nickname;
- }
+ return row.nickname;
},
formatResult: function(row){
row = eval("(" + row + ")");