-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompose.js
More file actions
26 lines (25 loc) · 1.18 KB
/
compose.js
File metadata and controls
26 lines (25 loc) · 1.18 KB
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
function sendCheck(e) {
var body = document.getElementById('compose-body').value;
if (body.indexOf('attach') !== -1 || body.indexOf('Attach') !== -1) {
/* Message body includes a word with the prefix attach, did the user forget an attachment? */
var attachfiles = document.getElementById('compose-attachments').files;
console.debug(attachfiles.length + " attachment(s) detected");
if (attachfiles.length === 0) {
if (confirm("Looks like you might have forgotten an attachment - send anyways?") !== true) {
e.preventDefault();
return;
}
}
}
}
document.getElementById('btn-send').addEventListener('click', sendCheck, true);
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('from-addr-select').addEventListener("change", (event) => {
if (event.target.value === "custom-addr") {
var oldAddress = document.getElementById('from-addr-current').innerText;
document.getElementById('from-addr-picker').innerHTML = "<label for='from'>From</label><input type='text' id='from' name='from' value='" + oldAddress + "'></input>";
} else {
document.getElementById('from-addr-current').innerText = event.target.value;
}
});
});