-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
109 lines (92 loc) · 3.48 KB
/
index.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
<!DOCTYPE html>
<html>
<body id="body">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/styles.min.css">
<style>
#demo {
background: #ff4500dd;
text-align: center;
padding: 15px;
border-radius: 17.5px 17.5px 0px 0px;
backdrop-filter: blur(10px);
}
* {
font-family: FuturaBT-Medium;
margin: 0;
padding: 0;
box-sizing: border-box;
background-size: cover !important;
background-repeat: no-repeat !important;
}
center {
background: #ffffffbb;
aspect-ratio: 1/1;
display: flex;
justify-content: center;
place-items: center;
text-align: center;
border-radius: 0px 0px 5px 5px;
backdrop-filter: blur(10px);
}
body {
padding: 25px;
background: black;
height: 100vh;
background-position: center;
display: flex;
}
.calendar {
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.25098);
border-radius: 17.5px 17.5px 5px 5px;
width: 400px;
margin: auto;
}
hr {
width: 100%;
}
</style>
<div class="calendar">
<h2 id="demo">...</h2>
<center>
<div style="padding: 25px;" id="inside">
<h1 id="dayname"></h1>
<br>
<h1 id="date">00</h1><br>
<hr><br>
<h3 id="eventMeter">No events today!</h3><br>
<h4 id="bolosMeter">You might not be able to bolos today, but no one will stop you.</h4>
</div>
</center>
</div>
<script defer>
const d = new Date();
let month = d.getMonth() + 1;
let year = d.getFullYear();
let date = d.getDate();
if (month < 10) {
month = "0" + month;
}
var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
document.getElementById("demo").innerHTML = d.toLocaleString('default', { month: 'long' }) + ' ' + year;
document.getElementById("date").innerText = date
document.getElementById("dayname").innerText = days[d.getDay()]
async function bolosOrNot() {
let fetchedData = await fetch('https://dayoffapi.vercel.app/api')
let data = await fetchedData.json()
let result = data.find(obj => obj.tanggal == (year + "-" + month + "-" + date))
if (result) {
var keteranganbg = 'url("https://source.unsplash.com/1600x900/?' + result.keterangan + '")'
document.getElementById("eventMeter").innerText = result.keterangan;
document.getElementById("bolosMeter").innerText = "You can bolos today!"
document.getElementById("body").style.backgroundImage = keteranganbg
if (result.is_cuti == true) {
document.getElementById("bolosMeter").innerText = "You can bolos today! (Even better, hari cuti!)"
}
} else {
document.getElementById("body").style.backgroundImage = `url("https://source.unsplash.com/1600x900/?landscape")`
}
}
bolosOrNot()
</script>
</body>
</html>