-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
51 lines (43 loc) · 1.39 KB
/
popup.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
47
48
49
50
51
var myArray2 = [
{'class':'Spainsh', 'work':'Read 20 mins', 'due':'11:00 AM'},
{'class':'English', 'work':'Write Essay', 'due':'11:00 PM'},
{'class':'Math', 'work':'Trig functions and parallel lines using math stuff', 'due':'11:00 PM'},
{'class':'Science', 'work':'Study whales', 'due':'11:00 AM'},
]
buildTable2(myArray2)
function addElipses(x){
var y;
var z;
if (x.length > 37) {
y = x.substr(0, 37);
z = y.substr(0, y.lastIndexOf(" "));
return(z + "...");
} else {
return(x);
}
}
function buildTable2(data){
var table = document.getElementById('myTable2')
for (var i = 0; i < data.length; i++){
var row = `<tr>
<td class="classcolumn">${addElipses(data[i].class)}</td>
<td class="workcolumn">${addElipses(data[i].work)}</td>
<td class="duecolumn">${data[i].due}</td>
</tr>`
table.innerHTML += row
}
}
var myArray = [
{'day':'Today', 'asignments':'You Have 5 Assignments'},
]
buildTable(myArray)
function buildTable(data){
var table = document.getElementById('myTable')
for (var i = 0; i < data.length; i++){
var row = `<tr>
<td class="daybox">${data[i].day}</td>
<td class="dayhead">${data[i].asignments}</td>
</tr>`
table.innerHTML += row
}
}