commit | author | age
|
b34d67
|
1 |
/** |
TB |
2 |
* Mark-as-Junk plugin script |
|
3 |
* |
|
4 |
* @licstart The following is the entire license notice for the |
|
5 |
* JavaScript code in this file. |
|
6 |
* |
|
7 |
* Copyright (c) 2013, The Roundcube Dev Team |
|
8 |
* |
|
9 |
* The JavaScript code in this page is free software: you can redistribute it |
|
10 |
* and/or modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation, either version 3 of |
|
12 |
* the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* @licend The above is the entire license notice |
|
15 |
* for the JavaScript code in this file. |
|
16 |
*/ |
48e9c1
|
17 |
|
T |
18 |
function rcmail_markasjunk(prop) |
|
19 |
{ |
|
20 |
if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length)) |
|
21 |
return; |
|
22 |
|
|
23 |
var uids = rcmail.env.uid ? rcmail.env.uid : rcmail.message_list.get_selection().join(','), |
|
24 |
lock = rcmail.set_busy(true, 'loading'); |
|
25 |
|
|
26 |
rcmail.http_post('plugin.markasjunk', '_uid='+uids+'&_mbox='+urlencode(rcmail.env.mailbox), lock); |
|
27 |
} |
|
28 |
|
|
29 |
// callback for app-onload event |
|
30 |
if (window.rcmail) { |
|
31 |
rcmail.addEventListener('init', function(evt) { |
|
32 |
|
|
33 |
// register command (directly enable in message view mode) |
|
34 |
rcmail.register_command('plugin.markasjunk', rcmail_markasjunk, rcmail.env.uid); |
|
35 |
|
|
36 |
// add event-listener to message list |
|
37 |
if (rcmail.message_list) |
|
38 |
rcmail.message_list.addEventListener('select', function(list){ |
|
39 |
rcmail.enable_command('plugin.markasjunk', list.get_selection().length > 0); |
|
40 |
}); |
|
41 |
}) |
|
42 |
} |
|
43 |
|