-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadData.js
More file actions
62 lines (61 loc) · 2.33 KB
/
Copy pathloadData.js
File metadata and controls
62 lines (61 loc) · 2.33 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
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
$(function () {
let timeType = "daily";
let previousTime = "Yesterday - ";
$('.time-select').click(function() {
$('.time-select').removeClass("active");
timeType = $(this).val().toLowerCase();
switch(timeType) {
case "daily":
previousTime = "Yesterday - ";
break;
case "weekly":
previousTime = "Last week - ";
break;
case "monthly":
previousTime = "Last month - ";
break;
default:
previousTime = "Yesterday - ";
break;
}
$("#content").children().slideUp();
let oldTimes = $( "body" ).find( ":hidden" ).not( "script" )
oldTimes.remove();
$.getJSON("./data.json", function (data) {
data.map((value) => {
let titleForHTML = value.title.toString().toLowerCase().replace(' ', '-');
$("#content").append(
"<article><div class='icon-wrapper' id='" + titleForHTML +
"'><img src='.\/images\/icon-" + titleForHTML +
".svg' alt='" + value.title +
"'></div><div class='wrapper'><div class='row'><span>" + value.title +
"</span><img src='./images/icon-ellipsis.svg' width='21' height='5'" +
"alt='Obligatory sandwich menu imitation' ></img></div><div class='row' id='col'><h1>" +
value.timeframes[timeType].current +
" hrs</h1><h2 class='inactive'>" +
previousTime +
value.timeframes[timeType].previous +
" hrs</h2></div></div></article>"
);
});
});
});
$.getJSON("./data.json", function (data) {
data.map((value) => {
let titleForHTML = value.title.toString().toLowerCase().replace(' ', '-');
$("#content").append(
"<article><div class='icon-wrapper' id='" + titleForHTML +
"'><img src='.\/images\/icon-" + titleForHTML +
".svg' alt='" + value.title +
"'></div><div class='wrapper'><div class='row'><span>" + value.title +
"</span><img src='./images/icon-ellipsis.svg' width='21' height='5'" +
"alt='Obligatory sandwich menu imitation' ></img></div><div class='row' id='col'><h1>" +
value.timeframes[timeType].current +
" hrs</h1><h2 class='inactive'>" +
previousTime +
value.timeframes[timeType].previous +
" hrs</h2></div></div></article>"
);
});
});
});