forked from AndersSahlin/MailCheckerPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
notify.html
172 lines (155 loc) · 5.87 KB
/
notify.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen" href="popup.css" />
<style type="text/css">
html, body { margin: 0; padding: 0; width: 100%; overflow: hidden; min-height: 120px; }
.border, .rounded { border: 0; }
.indicator { border-radius: 0; border: none; }
.address {
background-image: -webkit-gradient(linear,
left bottom,
left top,
color-stop(0.1, #79B),
color-stop(0.8, #7090B0)
);
}
.address div {
width: 100%;
text-align: center;
}
.address div a {
color: White;
font-weight: bold;
font-size: 100%;
}
.hiddenSummaryActions {
position: absolute;
bottom: 0;
right: 0;
width: 100%;
float: right;
}
.summary {
opacity: 1;
}
a { cursor: pointer; }
}
</style>
<script type="text/javascript" src="src/i18n.js"></script>
<script type="text/javascript" src="src/date.js"></script>
<script type="text/javascript" src="src/jquery-1.4.2.js"></script>
<script type="text/javascript" src="src/template-engine.js"></script>
<script type="text/javascript" src="src/mailaccount.class.js"></script>
<script type="text/javascript">
var mailAccount;
$(document).ready(function () {
var backgroundPage = chrome.extension.getBackgroundPage();
mailAccount = backgroundPage.accountWithNewestMail;
mailAccount.id = backgroundPage.accounts.indexOf(mailAccount);
var mail = backgroundPage.accountWithNewestMail.getNewestMail();
var mailURL = backgroundPage.accountWithNewestMail.getURL();
var profilePhotos = backgroundPage.profilePhotos;
var fullDateTime = mail.issued.toLocaleString();
var datetime = formatDateTime(mail.issued, i18n.selected_lang.months);
var mailHtml = parseTemplate($("#MailTemplate").html(), {
account: mailAccount,
mail: mail,
i18n: i18n
});
$('body').append(mailHtml);
$('body').hover(function () {
$(this).find('.hiddenSummaryActions').fadeIn('fast');
}, function () {
$(this).find('.hiddenSummaryActions').fadeOut('fast');
});
$('body').find(".readLink").click(function () { readMail(); });
$('body').find(".deleteLink").click(function () { deleteMail(); });
$('body').find(".spamLink").click(function () { spamMail(); });
$('body').find(".archiveLink").click(function () { archiveMail(); });
$('body').find(".openLink").click(function () { openMail(); });
$('body').find(".inboxLink").click(function () { openInbox(); });
$('body').find(".starLink").click(function () {
$(this).css('opacity', '1');
starMail();
});
});
// Opens a mail and closes this window
function openMail() {
window.close();
mailAccount.openNewestMail();
}
// Marks mail as read and closes this window
function readMail() {
window.close();
mailAccount.readNewestMail();
}
// Deletes mail and closes this window
function deleteMail() {
window.close();
mailAccount.deleteNewestMail();
}
// Marks mail as spam and closes this window
function spamMail() {
window.close();
mailAccount.spamNewestMail();
}
// Archives mail and closes this window
function archiveMail() {
window.close();
mailAccount.archiveNewestMail();
}
// Star mail
function starMail() {
mailAccount.starNewestMail();
}
// Star mail
function openInbox() {
mailAccount.openInbox();
}
</script>
</head>
<body id="body">
<!-- Template for a mail !-->
<script id="MailTemplate" type="text/html">
<div class="indicator i<#= account.id % 4 #>">
<div id="inbox_<#= account.id #>" class="vbox rounded">
<div class="vbox" id="<#= mail.id #>">
<div class="hbox address padded">
<div><a class="inboxLink" title="<#= account.getInboxLink() #>"><#= account.getAddress() #></a></div>
</div>
<div class="hbox sender">
<div class="hbox wide padded">
<a class="author" href="mailto:<#= mail.authorMail #>" title="<#= mail.authorMail #>"><#= mail.authorName #></a>
</div>
<div class="hbox padded">
<label><#= formatDateTime(mail.issued, i18n.selected_lang.months) #></label>
</div>
</div>
<div class="hbox title">
<div class="hbox wide padded">
<a class="starLink imageLink" mailId="<#= mail.id #>" href="#" title="<#= i18n.get('starLinkTitle') #>"><img src="img/star.png" /></a>
<a class="openLink" mailId="<#= mail.id #>" href="#" title="<#= mail.title #>"><#= mail.shortTitle #></a>
</div>
</div>
<div class="hbox">
<div class="hbox wide border-top padded summary" mailId="<#= mail.id #>">
<#= mail.summary #>
</div>
</div>
<div class="hbox padded hiddenSummaryActions">
<a class="readLink" mailId="<#= mail.id #>" title="<#= i18n.get('readLinkTitle') #>"><#= i18n.get('readLink') #></a>
<a class="deleteLink" mailId="<#= mail.id #>" title="<#= i18n.get('deleteLinkTitle') #>"><#= i18n.get('deleteLink') #></a>
<a class="spamLink" mailId="<#= mail.id #>" title="<#= i18n.get('spamLinkTitle') #>"><#= i18n.get('spamLink') #></a>
<a class="archiveLink" mailId="<#= mail.id #>" title="<#= i18n.get('archiveLinkTitle') #>"><#= i18n.get('archiveLink') #></a>
</div>
</div>
</div>
</div>
</script>
</body>
</html>