summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete/Autocomplete.js
blob: 3eff685a8dff5c002e5a161f48de506764992760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(document).ready(function(){
            $('#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 + ')';
                    }
                },
                formatMatch: function(row, i, max){
                    row = eval("(" + row + ")");
                    switch(row.type)
                    {
                        case 'user':
                            return row.nickname;
                        case 'group':
                            return row.nickname;
                    }
                },
                formatResult: function(row){
                    row = eval("(" + row + ")");
                    switch(row.type)
                    {
                        case 'user':
                            return '@' + row.nickname;
                        case 'group':
                            return '!' + row.nickname;
                    }
                }
            });
});