gnu-social/plugins/Autocomplete/Autocomplete.js

38 lines
1.4 KiB
JavaScript
Raw Normal View History

2009-08-06 19:39:59 +01:00
$(document).ready(function(){
$('#notice_data-text').autocomplete($('address .url')[0].href+'/plugins/Autocomplete/autocomplete.json', {
2009-08-06 19:39:59 +01:00
multiple: true,
multipleSeparator: " ",
minChars: 1,
2009-08-06 19:39:59 +01:00
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 + ')';
}
2009-08-06 19:39:59 +01:00
},
formatMatch: function(row, i, max){
row = eval("(" + row + ")");
switch(row.type)
{
case 'user':
return row.nickname;
case 'group':
return row.nickname;
}
2009-08-06 19:39:59 +01:00
},
formatResult: function(row){
row = eval("(" + row + ")");
switch(row.type)
{
case 'user':
return '@' + row.nickname;
case 'group':
return '!' + row.nickname;
}
2009-08-06 19:39:59 +01:00
}
});
});