-
Notifications
You must be signed in to change notification settings - Fork 0
/
JoshSadieDash.html
510 lines (457 loc) Β· 33.2 KB
/
JoshSadieDash.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
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
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
<!DOCTYPE html>
<html style="height: 100%;margin: 0;padding: 0;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/suncalc/1.9.0/suncalc.min.js"></script>
<script type="text/javascript" src="https://livejs.com/live.js"></script>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>Josh & Sadie Dashboard</title>
<style>
@font-face {
font-family: 'Droid Sans Mono';
src: url(DroidSansMono.ttf);
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
background: hsla(0, 0%, 80%, 1);
font-family: 'Droid Sans Mono', monospace;
}
</style>
</head>
<body>
<div style="display: flex; justify-content: center; height: 100%;">
<svg id="svgContent" height="100%" width="100%" style="max-width: 100%;max-height: 100%;" version="1.1" viewBox="0 0 1600 900" xmlns="http://www.w3.org/2000/svg">
<rect width="100%" height="100%" fill="hsla(0, 0%, 0%, 1)" />
<svg id="clok" x=0 y=0 width="900" height="900" viewBox="0 0 900 900">
<circle cx="450" cy="450" r="600" fill="hsla(38, 0%, 15%, 1)" />
<circle cx="450" cy="450" r="550" fill="hsla(38, 0%, 25%, 1)" />
<circle cx="450" cy="450" r="500" fill="hsla(38, 0%, 50%, 1)" />
<circle cx="450" cy="450" r="450" fill="hsla(38, 0%, 100%, 1)" />
<text id="timey" fill="hsla(0, 0%, 0%, .9)" x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" style="font-size: 130px;font-weight: bold;"></text>
<path id="sun" fill="none" stroke="hsla(194, 0%, 50%, 0.5)" stroke-width="450" />
<line x1="450" y1="450" x2="450" y2="0" stroke="hsla(200, 100%, 50%, 1)" stroke-width="3" stroke-linecap="round" />
<path id="nightSleep" fill="none" stroke="hsla(194, 100%, 50%, 0.2)" stroke-width="200" />
<path id="napSleep" fill="none" stroke="hsla(194, 100%, 50%, 0.2)" stroke-width="200" />
<path id="activities" fill="none" stroke="hsla(32, 100%, 50%, 0.3)" stroke-width="50" />
<path id="activities2" fill="none" stroke="hsla(32, 100%, 50%, 0.3)" stroke-width="50" />
<text fill="hsla(0, 0%, 0%, .5)" x="450" y="20" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">12</text>
<line stroke-width="1" x1="450" y1="400" x2="450" y2="50" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="561.292189394084" y="34.651894695700605" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">1</text>
<line stroke-width="1" x1="462.94095225512604" y1="401.7037086855466" x2="553.5276180410083" y2="63.6296694843727" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="665" y="77.60907637269139" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">2</text>
<line stroke-width="1" x1="475" y1="406.69872981077805" x2="650" y2="103.58983848622455" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="754.0559159102154" y="145.9440840897846" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">3</text>
<line stroke-width="1" x1="485.3553390593274" y1="414.6446609406726" x2="732.842712474619" y2="167.15728752538104" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="822.3909236273087" y="235.00000000000003" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">4</text>
<line stroke-width="1" x1="493.30127018922195" y1="425" x2="796.4101615137755" y2="250.00000000000003" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="865.3481053042995" y="338.70781060591605" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">5</text>
<line stroke-width="1" x1="498.2962913144534" y1="437.05904774487396" x2="836.3703305156273" y2="346.4723819589917" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="880" y="450" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">6</text>
<line stroke-width="1" x1="500" y1="450" x2="850" y2="450" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="865.3481053042995" y="561.292189394084" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">7</text>
<line stroke-width="1" x1="498.2962913144534" y1="462.94095225512604" x2="836.3703305156273" y2="553.5276180410083" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="822.3909236273087" y="665" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">8</text>
<line stroke-width="1" x1="493.30127018922195" y1="475" x2="796.4101615137755" y2="650" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="754.0559159102154" y="754.0559159102154" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">9</text>
<line stroke-width="1" x1="485.3553390593274" y1="485.3553390593274" x2="732.842712474619" y2="732.842712474619" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="665" y="822.3909236273087" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">10</text>
<line stroke-width="1" x1="475" y1="493.30127018922195" x2="650" y2="796.4101615137754" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="561.292189394084" y="865.3481053042995" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">11</text>
<line stroke-width="1" x1="462.94095225512604" y1="498.2962913144534" x2="553.5276180410083" y2="836.3703305156273" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="450" y="880" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">12</text>
<line stroke-width="1" x1="450" y1="500" x2="450" y2="850" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="338.70781060591605" y="865.3481053042995" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">1</text>
<line stroke-width="1" x1="437.05904774487396" y1="498.2962913144534" x2="346.47238195899166" y2="836.3703305156273" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="235.00000000000009" y="822.3909236273087" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">2</text>
<line stroke-width="1" x1="425" y1="493.30127018922195" x2="250.00000000000009" y2="796.4101615137755" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="145.9440840897846" y="754.0559159102154" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">3</text>
<line stroke-width="1" x1="414.6446609406726" y1="485.3553390593274" x2="167.15728752538104" y2="732.842712474619" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="77.60907637269133" y="665" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">4</text>
<line stroke-width="1" x1="406.69872981077805" y1="475" x2="103.5898384862245" y2="650" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="34.65189469570066" y="561.2921893940841" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">5</text>
<line stroke-width="1" x1="401.7037086855466" y1="462.94095225512604" x2="63.6296694843727" y2="553.5276180410084" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="20" y="450.00000000000006" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">6</text>
<line stroke-width="1" x1="400" y1="450" x2="50" y2="450.00000000000006" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="34.651894695700605" y="338.7078106059163" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">7</text>
<line stroke-width="1" x1="401.7037086855466" y1="437.05904774487396" x2="63.62966948437264" y2="346.47238195899183" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="77.60907637269139" y="234.99999999999994" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">8</text>
<line stroke-width="1" x1="406.69872981077805" y1="425" x2="103.58983848622455" y2="249.99999999999994" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="145.9440840897845" y="145.9440840897846" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">9</text>
<line stroke-width="1" x1="414.6446609406726" y1="414.6446609406726" x2="167.15728752538092" y2="167.15728752538104" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="234.9999999999998" y="77.6090763726915" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">10</text>
<line stroke-width="1" x1="425" y1="406.6987298107781" x2="249.99999999999983" y2="103.58983848622466" stroke="hsla(0, 0%, 0%, 1)"></line><text fill="hsla(0, 0%, 0%, .5)" x="338.7078106059161" y="34.651894695700605" dominant-baseline="middle" text-anchor="middle" style="font-size: 17px;">11</text>
<line stroke-width="1" x1="437.05904774487396" y1="401.7037086855466" x2="346.4723819589917" y2="63.6296694843727" stroke="hsla(0, 0%, 0%, 1)"></line>
<path id="ptime" d="" fill="hsla(0, 100%, 40%, .9)" />
</svg>
<svg id="calBox" x=900 y=0 width="700" height="900" viewBox="0 0 700 900" style="overflow: visible;">
<rect width="100%" height="100%" fill="white" stroke="black" stroke-width="1px" />
<svg id="calendar2Svg" style="overflow: visible;" x="0" y="0" width="100%" height="100%" viewBox="0 0 245 400" preserveAspectRatio="xMinYMin meet" />
</svg>
<svg id="tempy" x="900" y="886" width="1000" height="30" viewBox="0 0 1200 30" display="none" style="overflow: visible;">
<defs>
<linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stop-color="white" stop-opacity="0" />
<stop offset="50%" stop-color="white" />
<stop offset="100%" stop-color="white" />
</linearGradient>
</defs>
<rect x="0" y="-100" width="1200" height="200" fill="url(#Gradient2)" />
<rect id="tsquare" x="600" y="-425" width="580" height="600" rx="15" fill="hsla(0, 0%, 100%, .75)" />
<text id="tempt" fill="black" x="900" y="-250" dominant-baseline="middle" text-anchor="middle" style="font-size: 200px;"></text>
<rect x="0" y="-30" width="100" height="300" fill="hsla(194, 100%, 45%, 1)" /> <!-- -10 -->
<rect x="100" y="-30" width="100" height="300" fill="hsla(194, 100%, 50%, 1)" /> <!-- 00 -->
<rect x="200" y="-30" width="100" height="300" fill="hsla(194, 100%, 55%, 1)" /> <!-- 10 -->
<rect x="300" y="-30" width="100" height="300" fill="hsla(194, 100%, 60%, 1)" /> <!-- 20 -->
<rect x="400" y="-30" width="100" height="300" fill="hsla(194, 100%, 70%, 1)" /> <!-- 30 -->
<rect x="500" y="-30" width="100" height="300" fill="hsla(194, 100%, 80%, 1)" /> <!-- 40 -->
<rect x="600" y="-30" width="100" height="300" fill="hsla(194, 100%, 90%, 1)" /> <!-- 50 -->
<rect x="700" y="-30" width="100" height="300" fill="hsla(194, 100%, 95%, 1)" /> <!-- 60 -->
<rect x="800" y="-30" width="100" height="300" fill="hsla(194, 100%, 100%, 1)" /> <!-- 70 -->
<rect x="900" y="-30" width="100" height="300" fill="hsla(0, 100%, 90%, 1)" /> <!-- 70 -->
<rect x="1000" y="-30" width="100" height="300" fill="hsla(0, 100%, 80%, 1)" />
<rect x="1100" y="-30" width="100" height="300" fill="hsla(0, 100%, 70%, 1)" />
<text fill="#00000055" x="100" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">0</text>
<text fill="#00000055" x="200" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">10</text>
<text fill="#00000055" x="300" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">20</text>
<text fill="#00000055" x="400" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">30</text>
<text fill="#00000055" x="500" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">40</text>
<text fill="#00000055" x="600" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">50</text>
<text fill="#00000055" x="700" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">60</text>
<text fill="#00000055" x="800" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">70</text>
<text fill="#00000055" x="900" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">80</text>
<text fill="#00000055" x="1000" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">90</text>
<text fill="#00000055" x="1100" y="25" dominant-baseline="middle" text-anchor="middle" style="font-size: 35px;">100</text>
<rect id="merc" x="0" y="-110" width="0" height="100" fill="hsla(296, 100%, 50%, .85)" />
<text id="tin10" fill="black" x="050" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🥶️</text>
<text id="ti0" fill="black" x="150" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">❄️</text>
<text id="ti10" fill="black" x="250" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">❄️</text>
<text id="ti20" fill="black" x="350" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">❄️</text>
<text id="ti30" fill="black" x="450" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🧣️</text>
<text id="ti40" fill="black" x="550" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🧣️</text>
<text id="ti50" fill="black" x="650" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🧣️</text>
<text id="ti60" fill="black" x="750" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🧥️</text>
<text id="ti70" fill="black" x="850" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">☀️</text>
<text id="ti80" fill="black" x="950" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🌵️</text>
<text id="ti90" fill="black" x="1050" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🥵️</text>
<text id="ti100" fill="black" x="1150" y="-45" dominant-baseline="middle" text-anchor="middle" style="font-size: 80px;">🔥️</text>
</svg>
</svg>
</div>
<script>
//window.addEventListener("error", handleError, true);
const momentProxy = (arg1) => moment(arg1).add(0, 'hour');
var svgcon = document.getElementById("svgContent");
var calBox = document.getElementById("calBox");
var clok = document.getElementById("clok");
var tempy = document.getElementById("tempy");
var easters = ["4/17/2022", "4/9/2023", "3/31/2024", "4/20/2025", "4/5/2026", "3/28/2027", "4/16/2028", "4/1/2029", "4/21/2030", "4/13/2031", "3/28/2032", "4/17/2033", "4/9/2034", "3/25/2035", "4/13/2036", "4/5/2037", "4/25/2038", "4/10/2039", "4/1/2040", "4/21/2041", "4/6/2042", "3/29/2043", "4/17/2044", "4/9/2045", "3/25/2046", "4/14/2047", "4/5/2048", "4/18/2049", "4/10/2050", "4/2/2051", "4/21/2052", "4/6/2053", "3/29/2054", "4/18/2055", "4/2/2056", "4/22/2057", "4/14/2058", "3/30/2059", "4/18/2060", "4/10/2061", "3/26/2062", "4/15/2063", "4/6/2064", "3/29/2065", "4/11/2066", "4/3/2067", "4/22/2068", "4/14/2069", "3/30/2070", "4/19/2071", "4/10/2072", "3/26/2073", "4/15/2074", "4/7/2075", "4/19/2076", "4/11/2077", "4/3/2078", "4/23/2079", "4/7/2080", "3/30/2081", "4/19/2082", "4/4/2083", "3/26/2084", "4/15/2085", "3/31/2086", "4/20/2087", "4/11/2088", "4/3/2089", "4/16/2090", "4/8/2091", "3/30/2092", "4/12/2093", "4/4/2094", "4/24/2095", "4/15/2096", "3/31/2097", "4/20/2098", "4/12/2099", "3/28/2100"].map(e => moment(e));
let weeks = 31;
// The wake lock sentinel.
let wakeLock = null;
// Function that attempts to request a wake lock.
const requestWakeLock = async () => {
try {
wakeLock = await navigator.wakeLock.request('screen');
wakeLock.addEventListener('release', () => {
console.log('Wake Lock was released');
});
console.log('Wake Lock is active');
} catch (err) {
console.error(`${err.name}, ${err.message}`);
}
};
requestWakeLock();
document.onclick = function() {
document.documentElement.requestFullscreen();
}
addEventListener("resize", resize);
function resize() {
var natW = 1600;
var natH = 900;
var natR = natW / natH;
var now = momentProxy();
var newR = window.innerWidth / window.innerHeight;
var wider = newR > natR;
var newW = wider ? natW * ((window.innerWidth / window.innerHeight) / (natW / natH)) : natW;
var newH = !wider ? natH * ((window.innerHeight / window.innerWidth) / (natH / natW)) : natH;
svgcon.setAttribute("viewBox", `0 0 ${newW} ${newH}`);
var clockZoom = 1.0;
var clockScale = newH / 900 * clockZoom;
var shiftOff = (900 * clockZoom - 900)/clockZoom;
var leftSide = now.hour() >= 12;
var top = now.hour() < 6 || now.hour() > 17;
clok.setAttribute("width", 900 * clockScale);
clok.setAttribute("height", 900 * clockScale);
clok.setAttribute("x", -(leftSide ? 0 : shiftOff) * clockScale);
clok.setAttribute("y", -(top ? 0 : shiftOff) * clockScale);
calBox.setAttribute("x", newH);
var calScale = (newW - newH) / 700;
calBox.setAttribute("width", 700 * calScale);
calBox.setAttribute("height", 100 * calScale * weeks);
calBox.setAttribute("viewBox", `0 0 700 ${weeks * 100}`);
var temptx = newH*.83
tempy.setAttribute("x", temptx);
tempy.setAttribute("y", newH - 34);
tempy.setAttribute("width", newW - temptx);
}
resize();
function handleError(evt) {
if (evt.message) { // Chrome sometimes provides this
alert("error: " + evt.message + " at linenumber: " + evt.lineno + " of file: " + evt.filename);
} else {
alert("error: " + evt.type + " from element: " + (evt.srcElement || evt.target));
}
}
(function() {
var mouseTimer = null,
cursorVisible = true;
function disappearCursor() {
mouseTimer = null;
document.body.style.cursor = "none";
cursorVisible = false;
}
document.onmousemove = function() {
if (mouseTimer) {
window.clearTimeout(mouseTimer);
}
if (!cursorVisible) {
document.body.style.cursor = "default";
cursorVisible = true;
}
mouseTimer = window.setTimeout(disappearCursor, 500);
};
})();
var fridayOffset = momentProxy().day() == 5 ? 0.9 : 0;
document.getElementById("nightSleep")
.setAttribute("d", describeArc(450, 450, 350, (-4.25 + fridayOffset) * 15, 7 * 15));
document.getElementById("napSleep")
.setAttribute("d", describeArc(450, 450, 350, 12.25 * 15, 15.25 * 15));
if (momentProxy().day() != 0 && momentProxy().day() != 6)
document.getElementById("activities")
.setAttribute("d", describeArc(450, 450, 350, 8.75 * 15, 17 * 15));
if (momentProxy().day() === 0) {
document.getElementById("activities")
.setAttribute("d", describeArc(450, 450, 350, 8.75 * 15, 11 * 15));
document.getElementById("activities2")
.setAttribute("d", describeArc(450, 450, 350, 16.25 * 15, 19.75 * 15));
}
var oldTime = momentProxy().hour();
function getTime() {
let now = momentProxy();
let thruDay = now.hour() + now.minute() / 60 + now.second() / 60 / 60;
let angle = thruDay * 15;
var lineEnd = polarToCartesian(450, 450, 450, angle);
var lineb1 = polarToCartesian(450, 450, 100, angle + 25);
var lineb2 = polarToCartesian(450, 450, 20, angle + 5);
var lineb3 = polarToCartesian(450, 450, 20, angle - 5);
var lineb4 = polarToCartesian(450, 450, 100, angle - 25);
document.getElementById("ptime").setAttribute('d', `M 450 450 C ${lineb1.x} ${lineb1.y}, ${lineb2.x} ${lineb2.y}, ${lineEnd.x} ${lineEnd.y} C ${lineb3.x} ${lineb3.y}, ${lineb4.x} ${lineb4.y}, 450 450`);
let timey = document.getElementById("timey");
timey.textContent = now.format('h:mm');
var nowTime = momentProxy().hour();
if (nowTime < oldTime) location.reload();
oldTime = nowTime;
}
getTime();
setInterval(getTime, 400);
function getTextColors(dayToDraw) {
let color = `transparent`;
let textColor = `hsla(0, 0%, 0%, .3)`;
color = monthColor(dayToDraw.month());
switch (dayToDraw.day()) {
case 0: //Sunday hsl(17deg 31% 76%)
color = `hsla(23, 0%, 70%, 0.5)`;
break;
case 1: //Monday
color = `hsla(250, 20%, 100%, 0.2)`;
break;
case 2: //Tuesday
color = `hsla(83, 50%, 100%, 0.3)`;
break;
case 3: //Wednesday
color = `hsla(83, 50%, 100%, 0.3)`;
break;
case 4: //Thursday
color = `hsla(83, 50%, 100%, 0.3)`;
break;
case 5: //Friday
color = `hsla(83, 50%, 100%, 0.3)`;
break;
case 6: //Saturday
color = `hsla(23, 0%, 70%, 0.5)`;
break;
default:
// code block
}
if (dayToDraw.isSame(moment("2022-11-24"))) color = `hsla(23, 0%, 70%, 0.5)`;
if (dayToDraw.isSame(moment("2022-11-25"))) color = `hsla(23, 0%, 70%, 0.5)`;
if (dayToDraw.isSame(moment("2022-12-26"))) color = `hsla(23, 0%, 70%, 0.5)`;
if (dayToDraw.isSame(moment("2023-1-2"))) color = `hsla(23, 0%, 70%, 0.5)`;
//if (dayToDraw.isSame(moment("2022-12-30"))) color = `hsla(23, 0%, 70%, 0.5)`;
if (dayToDraw.dayOfYear() === momentProxy().dayOfYear()) {
textColor = "hsla(0, 0%, 100%, 1)";
color = "hsla(0, 0%, 0%, 1)";
}
return {
color: color,
textColor: textColor
};
}
function monthColor(monthNumber) {
switch (monthNumber) {
case 0: //January
return `hsla(10, 0%, 50%, .5)`;
case 1: //February
return `hsla(250, 20%, 50%, .5)`;
case 2: //March
return `hsla(40, 40%, 50%, .5)`;
case 3: //April
return `hsla(83, 50%, 50%, .5)`;
case 4: //May
return `hsla(208, 60%, 50%, .5)`;
case 5: //June
return `hsla(60, 100%, 50%, .5)`;
case 6: //July
return `hsla(50, 100%, 50%, .5)`;
case 7: //August
return `hsla(40, 80%, 50%, .5)`;
case 8: //September
return `hsla(200, 50%, 50%, .5)`;
case 9: //October
return `hsla(25, 100%, 50%, .5)`;
case 10: //November
return `hsla(330, 50%, 50%, .5)`;
case 11: //December
return `hsla(355, 100%, 50%, .5)`;
default:
return `hsla(10, 0%, 50%, 0.1)`;
}
}
function drawCalendar() {
let innerHTML = "";
let startDate = momentProxy().clone().startOf('week').add(-(7 * 1), 'days');
let dayToDraw = startDate.clone();
let sunTimes = SunCalc.getTimes(new Date(), 40.910345, -81.399921);
let ss = sunTimes.sunset;
let sunsetHour = ss.getHours() + ss.getMinutes() / 60 + ss.getSeconds() / 60 / 60;
let sunsetAngle = (24 - sunsetHour) * -15;
let sr = sunTimes.sunrise;
let sunriseHour = sr.getHours() + sr.getMinutes() / 60 + sr.getSeconds() / 60 / 60;
let sunriseAngle = (sunriseHour) * 15;
document.getElementById("sun")
.setAttribute("d", describeArc(450, 450, 225, sunsetAngle, sunriseAngle));
for (let i = 0; i < (7 * weeks); i++) {
let colors = getTextColors(dayToDraw);
let color = colors.color;
let textColor = colors.textColor;
var cellText = dayToDraw.date();
if (dayToDraw.month() == 10 &&
dayToDraw.date() > 21 &&
dayToDraw.date() < 29 &&
dayToDraw.day() === 4) cellText = "π¦";
if (dayToDraw.month() == 3 &&
dayToDraw.date() == 22) cellText = "π";
if (dayToDraw.month() == 9 &&
dayToDraw.date() == 31) cellText = "π";
if (dayToDraw.month() == 11 &&
dayToDraw.date() == 25) cellText = "π";
if (dayToDraw.month() == 6 &&
dayToDraw.date() == 4) cellText = "πΊπΈ";
if (dayToDraw.month() == 11 &&
dayToDraw.date() == 31) cellText = "π";
if (dayToDraw.month() == 3 &&
dayToDraw.date() == 20) cellText = "π";
if (dayToDraw.month() == 4 &&
dayToDraw.date() > 24 &&
dayToDraw.day() === 1) cellText = "π·";
if (dayToDraw.month() == 0 &&
dayToDraw.date() == 1) cellText = "π";
if (dayToDraw.month() == 2 &&
dayToDraw.date() == 17) cellText = "π";
if (dayToDraw.month() == 8 &&
dayToDraw.date() > 0 &&
dayToDraw.date() < 8 &&
dayToDraw.day() === 1) cellText = "π";
if (easters.some((item) => item.isSame(dayToDraw))) cellText = "βοΈ";
if (easters.some((item) => item.isSame(dayToDraw.clone().add(2, 'days')))) cellText = "✝️";
if (easters.some((item) => item.isSame(dayToDraw.clone().add(7, 'days')))) cellText = "π΄";
if (dayToDraw.month() === 2 && dayToDraw.date() > 7 && dayToDraw.date() < 15 && dayToDraw.day() === 0)
cellText = "π";
if (dayToDraw.month() === 10 && dayToDraw.date() < 8 && dayToDraw.day() === 0)
cellText = "π";
if (dayToDraw.isSame("2024-8-22")) cellText = "π«";
if (dayToDraw.isSame("2024-3-24")) cellText = "π΄";
if (dayToDraw.isSame("2024-3-25")) cellText = "π΄";
if (dayToDraw.isSame("2024-3-26")) cellText = "π΄";
if (dayToDraw.isSame("2024-3-27")) cellText = "π΄";
if (!isNumeric(cellText)) textColor = `hsla(0, 0%, 0%, 1)`;
innerHTML += `<rect x="${(i * 35) % (7*35)}" y="${Math.floor(i/7)*35}" width="35" height="35" fill="${color}" stroke="black" stroke-width=".1" />`;
innerHTML += `<text fill="${textColor}" x="${((i * 35) % (7*35))+17.5}" y="${(Math.floor(i/7)*35)+17.5}" dominant-baseline="middle" text-anchor="middle" style="font-size: 20px;">${cellText}</text>`;
dayToDraw.add(1, 'days');
}
for (var i = -1; i < 10; i++) {
dayToDraw = momentProxy().clone().add(i, 'months');
var pad = 2;
var mStart = dayToDraw.clone().startOf('month');
var mswEnd = mStart.clone().endOf('week').startOf('day');
var mewEnd = mswEnd.clone().endOf('month').startOf('day');
var mowbld = mewEnd.clone().add(-7, 'days');
var mslwEnd = mowbld.clone().endOf('week').startOf('day');
var mewStart = mewEnd.clone().startOf('week');
var mowaStart = mStart.clone().add(7, 'days');
var mowawStart = mowaStart.clone().startOf('week');
innerHTML += `<path d="M ${mStart.day()*35 + pad} ${35 * Math.floor(mStart.diff(startDate, "days") / 7) + pad} ` +
`L ${mswEnd.day()*35 + 35 - pad} ${35 * Math.floor(mswEnd.diff(startDate, "days") / 7) + pad} ` +
`L ${mslwEnd.day()*35+35-pad} ${35 * Math.floor(mslwEnd.diff(startDate, "days") / 7)+35 - pad} ` +
`L ${mowbld.day()*35+35-pad} ${35 * Math.floor(mowbld.diff(startDate, "days") / 7)+35 - pad} ` +
`L ${mewEnd.day()*35+35-pad} ${35 * Math.floor(mewEnd.diff(startDate, "days") / 7)+35 - pad} ` +
`L ${mewStart.day()*35+pad} ${35 * Math.floor(mewStart.diff(startDate, "days") / 7)+35 - pad} ` +
`L ${mowawStart.day()*35+pad} ${35 * Math.floor(mowawStart.diff(startDate, "days") / 7) + pad} ` +
`L ${mowaStart.day()*35+pad} ${35 * Math.floor(mowaStart.diff(startDate, "days") / 7) + pad} ` +
`Z" fill="transparent" stroke-width="2" stroke-linejoin="round" stroke="${monthColor(mewStart.month())}"/>`;
}
document.getElementById(`calendar2Svg`).innerHTML = innerHTML;
document.getElementById(`calendar2Svg`).setAttribute(`viewBox`, `0 0 245 ${weeks*35}`);
}
drawCalendar();
const urlParams = new URLSearchParams(window.location.search);
const appid = urlParams.get('appid');
function getWeather() {
resize();
if (appid) fetch(`https://api.openweathermap.org/data/2.5/weather?zip=44720,US&appid=${appid}&units=imperial`)
.then(response => response.json())
.then(data => {
var feelsLike = Math.round(data.main.feels_like);
console.log(feelsLike);
var merc = document.getElementById("merc");
tempy.setAttribute("display", "inline");
merc.setAttribute('width', feelsLike * 10 + 100);
document.getElementById("tin10").style.visibility = feelsLike < 0 ? "visible" : "hidden";
document.getElementById("ti0").style.visibility = feelsLike < 10 ? "visible" : "hidden";
document.getElementById("ti10").style.visibility = feelsLike < 20 ? "visible" : "hidden";
document.getElementById("ti20").style.visibility = feelsLike < 30 ? "visible" : "hidden";
document.getElementById("ti30").style.visibility = feelsLike < 40 ? "visible" : "hidden";
document.getElementById("ti40").style.visibility = feelsLike < 50 ? "visible" : "hidden";
document.getElementById("ti50").style.visibility = feelsLike < 60 ? "visible" : "hidden";
document.getElementById("ti60").style.visibility = feelsLike < 70 ? "visible" : "hidden";
document.getElementById("ti70").style.visibility = feelsLike > 70 ? "visible" : "hidden";
document.getElementById("ti80").style.visibility = feelsLike > 80 ? "visible" : "hidden";
document.getElementById("ti90").style.visibility = feelsLike > 90 ? "visible" : "hidden";
document.getElementById("ti100").style.visibility = feelsLike > 100 ? "visible" : "hidden";
document.getElementById("tempt").textContent = `${feelsLike}Β°`;
var hue = 6+Math.abs(feelsLike-70)/15;
if (feelsLike < 70) hue = 220 - (Math.abs(feelsLike-70)/2);
var sat = 100-Math.abs(feelsLike-70)/2;
if (feelsLike < 70) sat = 100-Math.abs(feelsLike-70)/3;
document.getElementById("tsquare").style.fill = `hsla(${hue}, 100%, ${sat}%, .75)`;
});
}
getWeather();
setInterval(getWeather, 1000 * 60 * 20);
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;
return {
x: centerX + (radius * Math.cos(angleInRadians)),
y: centerY + (radius * Math.sin(angleInRadians))
};
}
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function describeArc(x, y, radius, startAngle, endAngle) {
var start = polarToCartesian(x, y, radius, endAngle);
var end = polarToCartesian(x, y, radius, startAngle);
var largeArcFlag = endAngle - startAngle <= 180 ? "0" : "1";
var d = [
"M", start.x, start.y,
"A", radius, radius, 0, largeArcFlag, 0, end.x, end.y
].join(" ");
return d;
}
</script>
</body>
</html>