commit | author | age
|
48e9c1
|
1 |
/* Mark-as-Junk plugin script */ |
T |
2 |
|
|
3 |
function rcmail_markasjunk(prop) |
|
4 |
{ |
|
5 |
if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length)) |
|
6 |
return; |
|
7 |
|
|
8 |
var uids = rcmail.env.uid ? rcmail.env.uid : rcmail.message_list.get_selection().join(','), |
|
9 |
lock = rcmail.set_busy(true, 'loading'); |
|
10 |
|
|
11 |
rcmail.http_post('plugin.markasjunk', '_uid='+uids+'&_mbox='+urlencode(rcmail.env.mailbox), lock); |
|
12 |
} |
|
13 |
|
|
14 |
// callback for app-onload event |
|
15 |
if (window.rcmail) { |
|
16 |
rcmail.addEventListener('init', function(evt) { |
|
17 |
|
|
18 |
// register command (directly enable in message view mode) |
|
19 |
rcmail.register_command('plugin.markasjunk', rcmail_markasjunk, rcmail.env.uid); |
|
20 |
|
|
21 |
// add event-listener to message list |
|
22 |
if (rcmail.message_list) |
|
23 |
rcmail.message_list.addEventListener('select', function(list){ |
|
24 |
rcmail.enable_command('plugin.markasjunk', list.get_selection().length > 0); |
|
25 |
}); |
|
26 |
}) |
|
27 |
} |
|
28 |
|