-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
493 lines (421 loc) · 18.4 KB
/
index.html
File metadata and controls
493 lines (421 loc) · 18.4 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PolyTime</title>
<meta property="og:title" content="PolyTime">
<meta property="og:type" content="website">
<meta property="og:url" content="https://polyextended.github.io/time/">
<meta property="og:image" content="https://github.com/polyextender.png">
<meta property="og:site_name" content="PolyTime">
<link rel="icon" href="https://github.com/polyextender.png" type="image/x-icon">
<!-- CSS Libraries -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #15ebd2;
--primary-dark: #12d0b9;
--accent-color: #FF5722;
--dark-bg: #1a1a1a;
--card-bg: #2a2a2a;
--text-color: #f5f5f5;
}
body {
font-family: 'Roboto', sans-serif;
background-color: var(--dark-bg);
color: var(--text-color);
min-height: 100vh;
display: flex;
flex-direction: column;
}
main {
flex: 1 0 auto;
padding-bottom: 2rem;
}
.brand-logo {
display: flex;
align-items: center;
}
.brand-logo img {
height: 40px;
margin-right: 10px;
}
nav {
background-color: var(--primary-dark);
}
nav ul a:hover {
background-color: rgba(0,0,0,0.1);
}
.page-title {
font-weight: 300;
letter-spacing: 1px;
color: var(--primary-color);
text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
margin-bottom: 0;
}
.time-card {
background-color: var(--card-bg);
border-radius: 8px;
padding: 20px;
margin-top: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
position: relative;
overflow: hidden;
border-left: 4px solid var(--primary-color);
}
.time-display {
font-size: 2.8rem;
font-weight: 300;
margin: 0;
color: var(--primary-color);
text-align: center;
}
.time-label {
font-size: 1.2rem;
color: #bbb;
margin-bottom: 10px;
display: flex;
align-items: center;
}
.time-label i {
margin-right: 10px;
color: var(--primary-color);
}
.schedule-card {
background-color: var(--card-bg);
border-radius: 8px;
padding: 20px;
margin-top: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.schedule-title {
font-size: 1.5rem;
color: var(--primary-color);
margin-bottom: 20px;
border-bottom: 1px solid #444;
padding-bottom: 10px;
}
.schedule-day {
display: flex;
justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid #333;
}
.day-name {
font-weight: 500;
flex: 1;
}
.day-status {
padding: 2px 10px;
border-radius: 12px;
font-size: 0.9rem;
font-weight: 500;
}
.day-status.on {
background-color: #4CAF50;
color: white;
}
.day-status.off {
background-color: #F44336;
color: white;
}
.day-status.maybe {
background-color: orange;
color: white;
}
.active-day {
background-color: rgba(21, 235, 210, 0.1);
border-radius: 4px;
}
.footer {
background-color: var(--dark-bg);
color: #888;
padding: 15px 0;
text-align: center;
border-top: 1px solid #333;
margin-top: 40px;
}
.footer a {
color: var(--primary-color);
}
.timer-section {
text-align: center;
margin-top: 30px;
}
.timer-title {
font-size: 1.2rem;
color: #bbb;
margin-bottom: 10px;
}
.timer-display {
font-size: 2rem;
font-weight: 300;
color: var(--accent-color);
}
.whippy-status {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20px;
padding: 10px;
border-radius: 4px;
background-color: rgba(0,0,0,0.2);
}
.status-dot {
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 10px;
}
.online {
background-color: #4CAF50;
}
.offline {
background-color: #F44336;
}
@media (max-width: 600px) {
.time-display {
font-size: 2rem;
}
.timer-display {
font-size: 1.5rem;
}
}
</style>
</head>
<body>
<header>
<nav>
<div class="nav-wrapper container">
<a href="#" class="brand-logo">
<img src="https://github.com/polyextender.png" alt="PolyTime Logo">
PolyTime
</a>
<a href="#" data-target="mobile-nav" class="sidenav-trigger"><i class="fas fa-bars"></i></a>
<ul class="right hide-on-med-and-down">
<li><a href="https://polyextender.github.io/"><i class="fas fa-home"></i> Home</a></li>
<li><a href="https://polyextender.github.io/live/"><i class="fas fa-video"></i> PolyLive</a></li>
<li><a href="https://polyextender.github.io/PolyStreamLookup/"><i class="fas fa-search"></i> PolyLookup</a></li>
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-nav">
<li><a href="https://polyextender.github.io/"><i class="fas fa-home"></i> Home</a></li>
<li><a href="https://polyextender.github.io/live/"><i class="fas fa-video"></i> PolyLive</a></li>
<li><a href="https://polyextender.github.io/PolyStreamLookup/"><i class="fas fa-search"></i> PolyLookup</a></li>
</ul>
</header>
<main class="container">
<h1 class="page-title">PolyTime</h1>
<p class="flow-text">Time conversion for North America to Brisbane (AEST)</p>
<div class="row">
<div class="col s12 m6">
<div class="time-card">
<div class="time-label"><i class="fas fa-map-marker-alt"></i> Your Local Time</div>
<h2 class="time-display" id="local-time">Loading...</h2>
<div class="time-label" id="local-date">Loading date...</div>
</div>
</div>
<div class="col s12 m6">
<div class="time-card">
<div class="time-label"><i class="fas fa-globe-asia"></i> Brisbane Time (AEST)</div>
<h2 class="time-display" id="brisbane-time">Loading...</h2>
<div class="time-label" id="brisbane-date">Loading date...</div>
</div>
</div>
</div>
<div class="whippy-status">
<span class="status-dot offline" id="status-indicator"></span>
<span id="whippy-status-text">Whippy usually starts on Mondays (time may vary)</span>
</div>
<div class="timer-section" id="countdown-section">
<div class="timer-title">Time until next Monday stream:</div>
<div class="timer-display" id="countdown">Calculating...</div>
</div>
<div class="schedule-card">
<h3 class="schedule-title"><i class="fas fa-calendar-alt"></i> North American Schedule</h3>
<div class="schedule-day" id="monday">
<span class="day-name">Monday</span>
<span class="day-status maybe">Maybe</span>
</div>
<div class="schedule-day" id="tuesday">
<span class="day-name">Tuesday</span>
<span class="day-status on">Yes</span>
</div>
<div class="schedule-day" id="wednesday">
<span class="day-name">Wednesday</span>
<span class="day-status off">Off</span>
</div>
<div class="schedule-day" id="thursday">
<span class="day-name">Thursday</span>
<span class="day-status on">Yes</span>
</div>
<div class="schedule-day" id="friday">
<span class="day-name">Friday</span>
<span class="day-status on">Yes</span>
</div>
<div class="schedule-day" id="saturday">
<span class="day-name">Saturday</span>
<span class="day-status on">Yes</span>
</div>
<div class="schedule-day" id="sunday">
<span class="day-name">Sunday</span>
<span class="day-status off">Off</span>
</div>
</div>
</main>
<footer class="footer">
<div class="container">
<p>PolyTime | Created for the Poly community | <a href="https://github.com/polyextender" target="_blank">GitHub</a></p>
</div>
</footer>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script>
// Initialize Materialize components
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.sidenav');
var instances = M.Sidenav.init(elems);
});
// Function to format time with leading zeros
function formatTime(num) {
return num < 10 ? "0" + num : num;
}
// Function to update times
function updateTimes() {
// Get current local time
const now = new Date();
// Format local time display in 12-hour format
let localHours = now.getHours();
const localAmPm = localHours >= 12 ? 'PM' : 'AM';
localHours = localHours % 12;
localHours = localHours ? localHours : 12; // Convert 0 to 12
const localMinutes = formatTime(now.getMinutes());
const localSeconds = formatTime(now.getSeconds());
const localTimeStr = `${localHours}:${localMinutes}:${localSeconds} ${localAmPm}`;
// Format local date
const localOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
const localDateStr = now.toLocaleDateString(undefined, localOptions);
// Update local time display
document.getElementById('local-time').textContent = localTimeStr;
document.getElementById('local-date').textContent = localDateStr;
// Get Brisbane time (AEST)
const brisbaneTime = new Date(now.toLocaleString("en-US", {timeZone: "Australia/Brisbane"}));
// Format Brisbane time display in 12-hour format
let brisbaneHours = brisbaneTime.getHours();
const brisbaneAmPm = brisbaneHours >= 12 ? 'PM' : 'AM';
brisbaneHours = brisbaneHours % 12;
brisbaneHours = brisbaneHours ? brisbaneHours : 12; // Convert 0 to 12
const brisbaneMinutes = formatTime(brisbaneTime.getMinutes());
const brisbaneSeconds = formatTime(brisbaneTime.getSeconds());
const brisbaneTimeStr = `${brisbaneHours}:${brisbaneMinutes}:${brisbaneSeconds} ${brisbaneAmPm}`;
// Format Brisbane date
const brisbaneOptions = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
const brisbaneDateStr = brisbaneTime.toLocaleDateString(undefined, brisbaneOptions);
// Update Brisbane time display
document.getElementById('brisbane-time').textContent = brisbaneTimeStr;
document.getElementById('brisbane-date').textContent = brisbaneDateStr;
// Highlight current day in schedule
const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
const localDay = days[now.getDay()];
// Remove active class from all days
document.querySelectorAll('.schedule-day').forEach(el => el.classList.remove('active-day'));
// Add active class to current day
document.getElementById(localDay).classList.add('active-day');
// Calculate time to next stream
updateCountdown(brisbaneTime);
}
// Function to update the countdown
function updateCountdown(brisbaneTime) {
// Stream usually starts on Mondays (time may vary)
// Default time if needed
let streamHour = 19;
let streamMinute = 30;
// Get day of week in Brisbane (0 = Sunday, 1 = Monday, etc.)
const brisbaneDayOfWeek = brisbaneTime.getDay();
// Define days when streams happen (Monday, Tuesday, Thursday, Friday, Saturday)
const streamDays = [1, 2, 4, 5, 6]; // Monday=1, Tuesday=2, etc.
// Monday is special - primary stream day
const isMonday = brisbaneDayOfWeek === 1;
// Check if today is a stream day
const isTodayStreamDay = streamDays.includes(brisbaneDayOfWeek);
// Set up the target time for today's stream
let targetDate = new Date(brisbaneTime);
targetDate.setHours(streamHour, streamMinute, 0);
// If the stream already happened today or it's not a stream day
if (brisbaneTime > targetDate || !isTodayStreamDay) {
// Find the next stream day (prioritize finding Monday)
let daysToAdd = 1;
let nextStreamDay = (brisbaneDayOfWeek + daysToAdd) % 7;
// First try to find next Monday
let daysToMonday = 1;
while ((brisbaneDayOfWeek + daysToMonday) % 7 !== 1) {
daysToMonday++;
}
// If it's closer to find the next stream day, do that
// Otherwise, target the next Monday
if (daysToMonday > 3 && streamDays.includes(nextStreamDay)) {
while (!streamDays.includes(nextStreamDay)) {
daysToAdd++;
nextStreamDay = (brisbaneDayOfWeek + daysToAdd) % 7;
}
// Set target date to next stream day
targetDate = new Date(brisbaneTime);
targetDate.setDate(targetDate.getDate() + daysToAdd);
targetDate.setHours(streamHour, streamMinute, 0, 0);
} else {
// Set target date to next Monday
targetDate = new Date(brisbaneTime);
targetDate.setDate(targetDate.getDate() + daysToMonday);
targetDate.setHours(streamHour, streamMinute, 0, 0);
}
}
// Calculate time difference
const timeToStream = targetDate - brisbaneTime;
// Convert to hours, minutes, seconds
const days = Math.floor(timeToStream / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeToStream % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeToStream % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeToStream % (1000 * 60)) / 1000);
// Format countdown string
let countdownStr = '';
if (days > 0) {
countdownStr += `${days}d `;
}
// Format hours in 12-hour format for the countdown
let displayHours = hours;
countdownStr += `${formatTime(displayHours)}:${formatTime(minutes)}:${formatTime(seconds)}`;
// Update countdown display
document.getElementById('countdown').textContent = countdownStr;
// Check for Whippy's stream time (for demo purposes)
const isStreamTime = isMonday &&
brisbaneTime.getHours() >= streamHour &&
((brisbaneTime.getHours() === streamHour && brisbaneTime.getMinutes() >= streamMinute) ||
brisbaneTime.getHours() > streamHour) &&
brisbaneTime.getHours() < 23;
// Update status indicator
const statusDot = document.getElementById('status-indicator');
if (isStreamTime) {
statusDot.classList.remove('offline');
statusDot.classList.add('online');
document.getElementById('whippy-status-text').textContent = "Whippy might be LIVE!";
} else {
statusDot.classList.remove('online');
statusDot.classList.add('offline');
if (isMonday) {
document.getElementById('whippy-status-text').textContent = "Whippy usually streams today (Monday)";
} else {
document.getElementById('whippy-status-text').textContent = "Whippy usually starts on Mondays";
}
}
}
// Call the update function immediately
updateTimes();
// Then update every second
setInterval(updateTimes, 1000);
</script>
</body>
</html>