forked from devleague/gee-mail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (104 loc) · 4.33 KB
/
index.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
<html>
<head>
<script src="js/mail-generator.js"></script>
<link href="css/style.css" rel="stylesheet" media="screen">
<script>
window.onload = function(){
function emailSubject(){
for (var i=0; i<window.geemails.length; i++){
var emailBox = document.createElement("div");
emailBox.className = "emails";
main.appendChild(emailBox);
emailBox.addEventListener("click", bodyToggle);
console.log(emailBox);
var printSender = document.createElement("div");
printSender.className = "sender";
printSender.innerHTML = "Sender: " + geemails[i].sender;
emailBox.appendChild(printSender);
console.log(printSender);
var printSubject = document.createElement("div");
printSubject.className = "subject";
printSubject.innerHTML = "Subject: " + geemails[i].subject;
emailBox.appendChild(printSubject);
console.log(printSubject);
var printDate = document.createElement("div");
printDate.className = "date";
printDate.innerHTML = "Date: " + geemails[i].date;
emailBox.appendChild(printDate);
console.log(printDate);
var printBody = document.createElement("div");
printBody.className = "body";
printBody.innerHTML = "Body: " + geemails[i].body;
printBody.style.display = "none";
emailBox.appendChild(printBody);
console.log(body);
}
}
emailSubject();
function bodyToggle(){
var showBody = this.querySelectorAll('.body')[0];
console.log(this);
if(showBody.style.display === 'none'){
showBody.style.display = 'block';
}else{
showBody.style.display = 'none';
}
}
setInterval(newMessage, 5000);
var x = 0;
var totalEmails = document.getElementById("total");
totalEmails.innerHTML = "Inbox: " + geemails.length;
var emailCounter = document.getElementById("counter");
emailCounter.innerHTML = "New Emails: " + x;
function newMessage(){
emailCounter.innerHTML = "New Emails: " + ++x;
totalEmails.innerHTML = "Inbox: " + ++geemails.length;
var getMessage = getNewMessage();
var newEmailBox = document.createElement("div");
newEmailBox.className = "newEmails";
main.appendChild(newEmailBox);
newEmailBox.addEventListener("click",newBodyToggle);
console.log(newEmailBox);
var newPrintSender = document.createElement("div");
newPrintSender.className = "newSender";
newPrintSender.innerHTML = "Sender: " + getMessage.sender;
newEmailBox.appendChild(newPrintSender);
console.log(newPrintSender);
var newPrintSubject = document.createElement("div");
newPrintSubject.className = "newSubject";
newPrintSubject.innerHTML = "Subject: " + getMessage.subject;
newEmailBox.appendChild(newPrintSubject);
console.log(newPrintSubject);
var newPrintDate = document.createElement("div");
newPrintDate.className = "newDate";
newPrintDate.innerHTML = "Date: " + getMessage.date;
newEmailBox.appendChild(newPrintDate);
console.log(newPrintDate);
var newPrintBody = document.createElement("div");
newPrintBody.className = "newBody";
newPrintBody.innerHTML = "Body: " + getMessage.body;
newPrintBody.style.display = "none";
newEmailBox.appendChild(newPrintBody);
console.log(newPrintBody);
}
function newBodyToggle(){
var newShowBody = this.querySelectorAll('.newbody')[0];
console.log(this);
if(newShowBody.style.display === 'none'){
newShowBody.style.display = 'block';
}else{
newShowBody.style.display = 'none';
}
}
};
</script>
</head>
<body>
<title>Aw Gee! Mail</title>
<h1 id="title">Aww Gee! Mail</h1>
<div class="container" id="total"></div>
<div class="container" id="counter"></div>
<div id="overlay"></div>
<div class="container" id="main"></div>
</body>
</html>