summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete/Autocomplete.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-23 09:45:22 -0400
committerEvan Prodromou <evan@status.net>2009-09-23 09:45:22 -0400
commit8284b3cb82f4dec6e0f2bf74dea6e1a3bc7f4eac (patch)
tree09b8c466df2476f9219550464eb73f6ecaa54e1c /plugins/Autocomplete/Autocomplete.js
parent2cabfba767ba0d92d34a6ea4e4cf91c7325f3e95 (diff)
parentbef4a8b6ba9e19f2ec629031444279ca76f17bcf (diff)
Merge branch '0.8.x' into 0.9.x
Conflicts: actions/requesttoken.php classes/File.php install.php lib/noticeform.php
Diffstat (limited to 'plugins/Autocomplete/Autocomplete.js')
-rw-r--r--plugins/Autocomplete/Autocomplete.js51
1 files changed, 25 insertions, 26 deletions
diff --git a/plugins/Autocomplete/Autocomplete.js b/plugins/Autocomplete/Autocomplete.js
index dfadea004..3eff685a8 100644
--- a/plugins/Autocomplete/Autocomplete.js
+++ b/plugins/Autocomplete/Autocomplete.js
@@ -1,38 +1,37 @@
$(document).ready(function(){
- $.getJSON($('address .url')[0].href+'/api/statuses/friends.json?user_id=' + current_user['id'] + '&lite=true&callback=?',
- function(friends){
- $('#notice_data-text').autocomplete(friends, {
+ $('#notice_data-text').autocomplete($('address .url')[0].href+'/plugins/Autocomplete/autocomplete.json', {
multiple: true,
multipleSeparator: " ",
minChars: 1,
formatItem: function(row, i, max){
- return '@' + row.screen_name + ' (' + row.name + ')';
+ 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){
- return '@' + row.screen_name;
+ row = eval("(" + row + ")");
+ switch(row.type)
+ {
+ case 'user':
+ return row.nickname;
+ case 'group':
+ return row.nickname;
+ }
},
formatResult: function(row){
- return '@' + row.screen_name;
+ row = eval("(" + row + ")");
+ switch(row.type)
+ {
+ case 'user':
+ return '@' + row.nickname;
+ case 'group':
+ return '!' + row.nickname;
+ }
}
});
- }
- );
- $.getJSON($('address .url')[0].href+'/api/statusnet/groups/list.json?user_id=' + current_user['id'] + '&callback=?',
- function(groups){
- $('#notice_data-text').autocomplete(groups, {
- multiple: true,
- multipleSeparator: " ",
- minChars: 1,
- formatItem: function(row, i, max){
- return '!' + row.nickname + ' (' + row.fullname + ')';
- },
- formatMatch: function(row, i, max){
- return '!' + row.nickname;
- },
- formatResult: function(row){
- return '!' + row.nickname;
- }
- });
- }
- );
});