-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusers.js
47 lines (40 loc) · 1.33 KB
/
users.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
var bg = chrome.extension.getBackgroundPage();
function makeGmailWin(user) {
// Ensure this is the active window
var body = '';
var subject = "";
if (localStorage["subjectPrefix"]) {
subject += localStorage["subjectPrefix"] + " - ";
}
subject += bg.title;
if (bg.selectedText == '') {
body = bg.url;
} else {
body = bg.selectedText + "\n" + bg.url;
}
var gmailURL = bg.makeGmailDomainUrl() +
"&su=" + encodeURIComponent(subject) +
"&body=" + encodeURIComponent(body) +
"&authuser=" + user;
console.log(gmailURL);
window.location = gmailURL;
}
document.addEventListener('DOMContentLoaded', function() {
var aList = window.localStorage["emailAddresses"].split(",").map(
function(s) { return s.trim()}
);
console.log("Addresses: " + aList.length + " found");
var c = document.getElementById("alist-container");
aList.forEach(function(s) {
var li = document.createElement("LI");
var a = document.createElement("A");
a.setAttribute('href', '#');
a.setAttribute('id', s);
a.appendChild(document.createTextNode(s));
li.appendChild(a);
c.appendChild(li);
a.addEventListener('click', function(e) {
makeGmailWin(e.target.id);
});
});
});