-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeline.html
174 lines (157 loc) · 6.12 KB
/
timeline.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Christopher Robison Work History Timeline</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<link title="timeline-styles" rel="stylesheet" href="https://cdn.knightlab.com/libs/timeline3/latest/css/timeline.css">
<style>
body {
font-family: 'Lexend', sans-serif;
margin: 0;
padding: 0;
font-size: 16px;
}
header {
background-color: #333;
color: #eee;
height: 6vh;
}
main {
background-color: #eee;
color: #ddd;
height: 95vh;
overflow: scroll;
margin:2.5vh 0px;
}
footer {
background-color: #666;
color: #eee;
height: 5vh;
}
.tl-timemarker .tl-timemarker-content-container .tl-timemarker-content .tl-timemarker-text h2.tl-headline, .tl-timemarker .tl-timemarker-content-container .tl-timemarker-content .tl-timemarker-text h2.tl-headline p {
font-size: 16px;
text-align:center;
line-height: 1rem;
}
.tl-timenav span.company {
font-weight:bold;
font-size:18px;
line-height:18px;
}
.tl-text h3.tl-headline-date {
font-size: 24px;
color: #900;
}
.tl-timenav span.position {
font-size:16px;
}
.tl-timemarker .tl-timemarker-content-container .tl-timemarker-content .tl-timemarker-media-container {
max-width:64px;
max-height:64px;
}
.tl-timemarker .tl-timemarker-content-container .tl-timemarker-content .tl-timemarker-media-container .tl-timemarker-media {
max-width:64px;
}
div.tl-slidenav-icon {
animation: bounce1 3s infinite 5s ;
font-size:3em;
}
@keyframes bounce1 {
0%, 20%, 50%, 80%, 100% { transform: scale(1); }
40% { transform: scale(1.5); }
60% { transform: scale(2); }
}
header h2 {
font-size: 2em;
line-height: 2em;
text-shadow: 2px 2px 0px #000;
text-transform: uppercase;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" integrity="sha512-c42qTSw/wPZ3/5LBzD+Bw5f7bSF2oxou6wEb+I/lqeaKV5FDIfMvvRp772y4jcJLKuGUOpbJMdg/BTl50fJYAw==" crossorigin="anonymous" />
</head>
<body id="home">
<header>
<h2 class='tl-headline tl-headline-title'>Work History Timeline for Christopher Robison</h2>
</header>
<main>
<div id='timeline-embed' style="width: 100%; height: 90vh"></div>
</main>
<script src="https://cdn.knightlab.com/libs/timeline3/latest/js/timeline.js"></script>
<script>
function $(str) {
return document.querySelector(str);
}
function $$(str) {
return document.querySelectorAll(str);
}
(function() {
const app = {
init: function() {
app.state.loaded = true;
app.getResume();
},
state: {
loaded: false,
timeline: {},
resume: {}
},
getResume: function() {
fetch("resume.json").then(response => response.json()).then(data => {
app.state.resume = data;
console.log("resume");
console.dir(data);
app.makeTimeline(data);
// setTimeout(function() { $(".tl-slidenav-icon").classList.add("animate__shakeX"); }, 1000);
});
},
makeTimeline: function(resume) {
let opts = {
initial_zoom: 3
};
let json = app.resume2timeline(resume);
app.state.timeline = new TL.Timeline('timeline-embed', json, opts);
},
resume2timeline: function(resume) {
let out = {};
out.title = {
"text": {
"headline": "Christopher Robison",
"text": "This is the work history for Christopher Robison"
}
};
out.events = [];
for (let i in resume.work) {
let job = resume.work[i];
let sdate = new Date(job.startDate);
let edate = new Date(job.endDate);
let evt = {
"start_date": {"month":sdate.getMonth(),"year":sdate.getFullYear(), "day":sdate.getDate() },
"end_date": {"month":edate.getMonth(),"year":edate.getFullYear(), "day":edate.getDate() },
"text": {
"headline": "<span class='company'>" + job.company + "</span><br><span class='position'>" + job.position + "</span>",
"text": job.summary.replace(/\n\n/g, "<br><br>")
}
};
if (job.media) {
evt["media"] = {
"url": job.media.url,
"thumbnail": job.media.thumbnail,
"caption": job.media.caption,
"credit": job.media.credit
}
}
out.events.push(evt);
}
return out;
}
}
window.app = app;
app.init();
})();
</script>
</body>
</html>