forked from devleague/gee-mail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (57 loc) · 2.09 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
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/mail-generator.js"></script>
<link href="css/style.css" rel="stylesheet" media="screen">
<script>
window.onload = function(){
function newMessage(){
var i =0;
//while loop to generate emails
while(i < window.geemails.length){
var emails = document.createElement("div");
//creates and displays sender
var senderInfo=document.createElement('div');
senderInfo.className='sender';
senderInfo.innerHTML= window.geemails[i].sender;
emails.appendChild(senderInfo);
//creates and displays subject
var subjectInfo=document.createElement('div');
subjectInfo.className='subject';
subjectInfo.innerHTML= window.geemails[i].subject;
emails.appendChild(subjectInfo);
//creates and displays date
var dateInfo=document.createElement('div');
dateInfo.className='date';
dateInfo.innerHTML= window.geemails[i].date;
emails.appendChild(dateInfo);
//creates and displays body
var bodyInfo=document.createElement('div');
bodyInfo.className='body';
bodyInfo.innerHTML= window.geemails[i].body;
emails.appendChild(bodyInfo);
document.getElementById('inbox').innerHTML = "You have " + (document.getElementsByClassName("date").length+1) + " messages";
document.getElementById("main").appendChild(emails);
window.geemails.shift();
}
}
newMessage();
function addNewMessage() {
setInterval(function(){
window.geemails.push(getNewMessage());newMessage();
}, 15000);
}
addNewMessage();
$("body").on('click', 'div', function(){
$(this).children('.body').toggle();
});
};
</script>
</head>
<body>
<header>Gee<img src="geemaillogo.jpg" height="33">ail</header>
<div class="container" id="main">
<div id='inbox'>
</div>
</body>
</html>