summaryrefslogtreecommitdiff
path: root/plugins/Autocomplete/Autocomplete.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Autocomplete/Autocomplete.js')
-rw-r--r--plugins/Autocomplete/Autocomplete.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/Autocomplete/Autocomplete.js b/plugins/Autocomplete/Autocomplete.js
new file mode 100644
index 000000000..3eff685a8
--- /dev/null
+++ b/plugins/Autocomplete/Autocomplete.js
@@ -0,0 +1,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;
+ }
+ }
+ });
+});