-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime.html
More file actions
211 lines (193 loc) · 8.08 KB
/
time.html
File metadata and controls
211 lines (193 loc) · 8.08 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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!doctype html>
<html>
<head>
<title>Time Stuff</title>
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta charset="UTF-8" />
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/vars.css" />
<link rel="stylesheet" type="text/css" href="/css/sitewide.css" />
<link rel="stylesheet" type="text/css" href="/css/time.css" />
</head>
<body>
<div id="clock">
<span id="year"></span>
<span id="month"></span>
<span id="day"></span>
<span id="hour"></span>
<span id="minute"></span>
<span id="second"></span>
</div>
<div id="ogham-switch-container">
<span id="ogham-label">᚛ᚑᚌᚆᚐᚋ</span>
<div id="toggle-button-holder"><div class="slider"></div></div>
<span id="seanchlo-label">seanċló</span>
</div>
<div id="countdown-container">
<div id="imbolc-countdown">
<span class="ogham">᚛ᚃᚓᚓᚔᚂᚓ ᚁᚏᚔᚔᚇᚓ</span
><span class="seanchlo hidden">féile bríde</span><span id="imbolc-days"></span>
</div>
<div id="paddys-countdown">
<span class="ogham">᚛ᚂᚐᚐ ᚃᚆᚓᚓᚔᚂᚓ ᚚᚐᚐᚇᚏᚐᚔᚌ</span
><span class="seanchlo hidden">lá ḟéile pádraig</span><span id="paddys-days"></span>
</div>
<div id="spring_equinox-countdown">
<span class="ogham">᚛ᚉᚑᚑᚅᚑᚉᚆᚈ ᚐᚅ ᚓᚐᚏᚏᚐᚔᚌᚆ</span
><span class="seanchlo hidden">cónoċt an earraiġ</span><span id="spring_equinox-days"></span>
</div>
<div id="bealtaine-countdown">
<span class="ogham">᚛ᚁᚓᚐᚂᚈᚐᚔᚅᚓ</span
><span class="seanchlo hidden">bealtaine</span><span id="bealtaine-days"></span>
</div>
<div id="jos_birthday-countdown">
<span class="ogham">᚛ᚁᚏᚓᚔᚈᚆᚂᚐᚐ ᚔᚑᚑ</span
><span class="seanchlo hidden">breiṫlá ió</span><span id="jos_birthday-days"></span>
</div>
</div>
<script>
let useOgham = true;
function toggleOgham() {
useOgham = !useOgham;
if(useOgham){
document.querySelectorAll('.ogham').forEach((item) => {
item.classList.remove("hidden");
});
document.querySelectorAll('.seanchlo').forEach((item) => {
item.classList.add("hidden");
});
document.querySelector('#toggle-button-holder').classList.add('ogham-selected');
document.querySelector('#toggle-button-holder').classList.remove('seanchlo-selected');
} else {
document.querySelectorAll('.ogham').forEach((item) => {
item.classList.add("hidden");
});
document.querySelectorAll('.seanchlo').forEach((item) => {
item.classList.remove("hidden");
});
document.querySelector('#toggle-button-holder').classList.remove('ogham-selected');
document.querySelector('#toggle-button-holder').classList.add('seanchlo-selected');
}
}
// define some bits:
let countDowns = [
{
target: document.querySelector("#imbolc-days"),
start_time: new Date("2026-02-02T00:00:00Z"),
end_time: new Date("2026-02-03T00:00:00Z")
},
{
target: document.querySelector("#paddys-days"),
start_time: new Date("2026-03-17T00:00:00Z"),
end_time: new Date("2026-03-18T00:00:00Z")
},
{
target: document.querySelector("#spring_equinox-days"),
start_time: new Date("2026-03-20T14:46:00Z"),
end_time: new Date("2026-03-20T14:46:59Z")
},
{
target: document.querySelector("#bealtaine-days"),
start_time: new Date("2026-05-01T00:00:00Z"),
end_time: new Date("2026-05-02T00:00:00Z")
},
{
target: document.querySelector("#jos_birthday-days"),
start_time: new Date("2026-06-19T00:00:00Z"),
end_time: new Date("2026-06-20T01:00:00Z")
}
];
let year = document.querySelector("#year");
let month =document.querySelector("#month");
let day =document.querySelector("#day");
let hour =document.querySelector("#hour");
let minute =document.querySelector("#minute");
let second =document.querySelector("#second");
function update_countdown(days_element, start_time, end_time, now){
let event_duration = end_time - start_time;
let millisInASecond = 1000;
let millisInAMinute = 60 * millisInASecond;
let millisInAnHour = 60 * millisInAMinute;
let millisInADay = 24 * millisInAnHour;
let now_label = event_duration >= millisInADay ? "😄INNIU😄": "😄ANOIS😄";
let timeDiffToStart = start_time - now;
let timeDiffToEnd = end_time - now;
if (timeDiffToEnd < 0) {
days_element.innerHTML = "😄Done😄";
return;
}
if (timeDiffToStart <= 0 && timeDiffToEnd > 0) {
days_element.innerHTML = now_label;
return;
}
let days = Math.floor(timeDiffToStart / millisInADay);
let hours = Math.floor((timeDiffToStart - (days * millisInADay)) / millisInAnHour);
let minutes = Math.floor((timeDiffToStart - (hours * millisInAnHour)) / millisInAMinute);
let seconds = Math.floor((timeDiffToStart - (minutes * millisInAMinute)) / millisInASecond);
if (days > 0) {
days_element.innerHTML = `${days} lá`;
return;
}
if (hours > 0){
days_element.innerHTML = `${hours} n-uaire`;
return;
}
if (minutes > 0) {
days_element.innerHTML = `${minutes} nóiméad`;
return;
}
days_element.innerHTML = `${seconds} soicind`;
}
function update_clock(y, mo, d, h, min, s, now) {
let day = now.getDate();
let hours = now.getHours();
if (hours < 10) {
hours = `0${hours}`;
}
let minutes = now.getMinutes();
if (minutes < 10) {
minutes = `0${minutes}`;
}
let seconds = now.getSeconds();
if (seconds < 10) {
seconds = `0${seconds}`;
}
let year = now.getFullYear();
let month = now.getMonth() + 1;
if (month < 10) {
month = `0${month}`;
}
y.innerHTML = year;
mo.innerHTML = month;
d.innerHTML = day;
h.innerHTML = hours;
min.innerHTML = minutes;
s.innerHTML = seconds;
}
function tick() {
let now = new Date();
// clock bits:
update_clock(year, month, day, hour, minute, second, now);
countDowns.forEach((cd) => {
update_countdown(cd.target, cd.start_time, cd.end_time, now);
});
}
setInterval(tick, 1000);
document.querySelector("#toggle-button-holder").addEventListener("click", toggleOgham);
</script>
<div class="footer">
<a href="/">
<div class="woa-home-button"></div>
</a>
<ul>
<li><a class="footer-link" href="/about.html">About</a></li>
<li><a class="footer-link" href="/blog.html">Blog</a></li>
<li><a class="footer-link" href="/music.html">Music</a></li>
<li><a class="footer-link" href="/ogham.html">Ogham</a></li>
<li><a class="footer-link" href="/grimoire.html">The Grimoire</a></li>
<li><a class="footer-link" href="/friends.html">Friends</a></li>
<li><a class="footer-link" href="/contact.html">Contact</a></li>
</ul>
</div>
</body>
</html>