-
Notifications
You must be signed in to change notification settings - Fork 2
/
ident_switch-switch.js
71 lines (59 loc) · 1.54 KB
/
ident_switch-switch.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* This is part of identity_imap plugin
*/
$(function() {
$sw = $('#plugin-ident_switch-account');
isOk = false;
switch (rcmail.env['skin']) {
case 'larry':
isOk = plugin_switchIdent_addCbLarry($sw);
break;
case 'classic':
isOk = plugin_switchIdent_addCbClassic($sw);
break;
case 'elastic':
isOk = plugin_switchIdent_addCbElastic($sw);
break;
}
if (isOk)
$sw.show();
});
function plugin_switchIdent_addCbLarry($sw) {
var $truName = $('.topright .username');
if ($truName.length > 0) {
if ($sw.length > 0) {
$sw.prependTo('.topright');
$truName.hide();
return true;
}
}
return false;
}
function plugin_switchIdent_addCbClassic($sw) {
var $taskBar = $('#taskbar');
if ($taskBar.length > 0) {
$taskBar.prepend($sw);
return true;
}
return false;
}
function plugin_switchIdent_addCbElastic($sw) {
var $taskBar = $('.header-title.username');
$sw.css("background-color", "transparent").css("border","none");
$sw.css("background-position-x","left 0.75rem").css("padding","0 0 0 2rem");
$sw.css("font-weight","bold").css("box-shadow","none");
if ($taskBar.length > 0) {
$taskBar.prepend($sw);
return true;
}
return false;
}
function plugin_switchIdent_switch(val) {
rcmail.env.unread_counts = {};
console.log(rcmail.env.unread_counts);
rcmail.http_post('plugin.ident_switch.switch', { '_ident-id': val, '_mbox': rcmail.env.mailbox });
}
function plugin_switchIdent_fixIdent(iid) {
if (parseInt(iid) > 0)
$("#_from").val(iid);
}