-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathz.js
58 lines (48 loc) · 1.76 KB
/
z.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
52
53
54
55
56
57
const IMAGE_COUNT = 10;
const links = {
"presence": {
"github": "https://github.com/tomauty",
"twitter": "https://twitter.com/seasonsreverse",
"instagram": "https://instagram.com/seasonsreverse",
"this site": "https://tomauty.cc",
},
"work": {
"resume": "",
"linked in": "https://www.linkedin.com/in/tom-auty-71648430/",
},
"writing": {
"soon": "",
},
};
function init() {
// good morning
const hour = new Date().getHours();
let hourString = 'morning';
if (hour >= 12 && hour < 18) { hourString = 'afternoon'; }
if (hour >= 18) { hourString = 'evening'; }
document.getElementById("hourText").textContent = 'good ' + hourString;
// what are you seeing
const image = document.getElementById('look');
const imageIndex = Math.ceil(Math.random() * IMAGE_COUNT);
const src = 'mages/' + imageIndex + '.png';
image.setAttribute('src', src);
// where are you going
const linkList = document.getElementById("links");
let section;
Object.keys(links).forEach(sectionName => {
const sectionContainer = document.createElement('div');
sectionContainer.setAttribute('style', 'display: flex; flex-direction: column; margin-right: 50px;');
linkList.appendChild(sectionContainer);
section = document.createElement('h2');
section.innerHTML = sectionName;
sectionContainer.appendChild(section);
Object.keys(links[sectionName]).forEach(linkName => {
const link = document.createElement('a');
link.setAttribute('href', links[sectionName][linkName]);
link.innerHTML = linkName;
link.setAttribute('target', '_blank');
sectionContainer.appendChild(link);
});
});
}
setTimeout(init, 1);