]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Autocomplete/Autocomplete.js
Merge branch 'master' of git@gitorious.org:statusnet/mainline
[quix0rs-gnu-social.git] / plugins / Autocomplete / Autocomplete.js
1 $(document).ready(function(){
2             $('#notice_data-text').autocomplete($('address .url')[0].href+'/plugins/Autocomplete/autocomplete.json', {
3                 multiple: true,
4                 multipleSeparator: " ",
5                 minChars: 1,
6                 formatItem: function(row, i, max){
7                     row = eval("(" + row + ")");
8                     switch(row.type)
9                     {
10                         case 'user':
11                             return row.nickname + ' (' + row.fullname + ')';
12                         case 'group':
13                             return row.nickname + ' (' + row.fullname + ')';
14                     }
15                 },
16                 formatMatch: function(row, i, max){
17                     row = eval("(" + row + ")");
18                     switch(row.type)
19                     {
20                         case 'user':
21                             return row.nickname;
22                         case 'group':
23                             return row.nickname;
24                     }
25                 },
26                 formatResult: function(row){
27                     row = eval("(" + row + ")");
28                     switch(row.type)
29                     {
30                         case 'user':
31                             return '@' + row.nickname;
32                         case 'group':
33                             return '!' + row.nickname;
34                     }
35                 }
36             });
37 });