-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (22 loc) · 983 Bytes
/
index.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
window.onload = function() {
const date = new Date();
const christmastreesize = (date.getMonth() === 11 && date.getFullYear() === 2021) ? new Date().getDate() : 30;
const days = document.getElementById('days');
const christmastree = document.getElementById('christmastree');
var daystext = '';
for (var i = 0; i < dayscompleted; i++) {
var ip1 = i + 1;
daystext += `<a class='Link' href="./${ip1}/index.html">day ${ip1}</a>`;
if (ip1 !== dayscompleted) {
daystext += '\n';
}
}
var christmastreetext = ' '.repeat(christmastreesize - 1) + '♡\n';
for (var i = 0; i < christmastreesize; i++) {
var ip1 = i + 1;
christmastreetext += ' '.repeat(christmastreesize - ip1) + '*'.repeat(2 * ip1 - 1) + '\n';
}
christmastreetext += ' '.repeat(christmastreesize - 1) + '|';
days.innerHTML = daystext;
christmastree.innerHTML = christmastreetext;
};