-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
2670 lines (2563 loc) · 164 KB
/
Copy pathindex.html
File metadata and controls
2670 lines (2563 loc) · 164 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
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="theme-color" content="#000000">
<link rel="manifest" href='data:application/manifest+json,{"name":"Mini Mirror","short_name":"Mini Mirror","display":"fullscreen","orientation":"any","background_color":"%23000000","theme_color":"%23000000","start_url":"."}'>
<script>/*! NoSleep.min.js v0.12.0 - git.io/vfn01 - Rich Tibbett - MIT license */
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.NoSleep=e():A.NoSleep=e()}(this,(function(){return function(A){var e={};function B(g){if(e[g])return e[g].exports;var o=e[g]={i:g,l:!1,exports:{}};return A[g].call(o.exports,o,o.exports,B),o.l=!0,o.exports}return B.m=A,B.c=e,B.d=function(A,e,g){B.o(A,e)||Object.defineProperty(A,e,{enumerable:!0,get:g})},B.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},B.t=function(A,e){if(1&e&&(A=B(A)),8&e)return A;if(4&e&&"object"==typeof A&&A&&A.__esModule)return A;var g=Object.create(null);if(B.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:A}),2&e&&"string"!=typeof A)for(var o in A)B.d(g,o,function(e){return A[e]}.bind(null,o));return g},B.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return B.d(e,"a",e),e},B.o=function(A,e){return Object.prototype.hasOwnProperty.call(A,e)},B.p="",B(B.s=0)}([function(A,e,B){"use strict";var g=function(){function A(A,e){for(var B=0;B<e.length;B++){var g=e[B];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(A,g.key,g)}}return function(e,B,g){return B&&A(e.prototype,B),g&&A(e,g),e}}();var o=B(1),E=o.webm,n=o.mp4,C=function(){return"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream},Q=function(){return"wakeLock"in navigator},i=function(){function A(){var e=this;if(function(A,e){if(!(A instanceof e))throw new TypeError("Cannot call a class as a function")}(this,A),this.enabled=!1,Q()){this._wakeLock=null;var B=function(){null!==e._wakeLock&&"visible"===document.visibilityState&&e.enable()};document.addEventListener("visibilitychange",B),document.addEventListener("fullscreenchange",B)}else C()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",E),this._addSourceToVideo(this.noSleepVideo,"mp4",n),this.noSleepVideo.addEventListener("loadedmetadata",(function(){e.noSleepVideo.duration<=1?e.noSleepVideo.setAttribute("loop",""):e.noSleepVideo.addEventListener("timeupdate",(function(){e.noSleepVideo.currentTime>.5&&(e.noSleepVideo.currentTime=Math.random())}))})))}return g(A,[{key:"_addSourceToVideo",value:function(A,e,B){var g=document.createElement("source");g.src=B,g.type="video/"+e,A.appendChild(g)}},{key:"enable",value:function(){var A=this;return Q()?navigator.wakeLock.request("screen").then((function(e){A._wakeLock=e,A.enabled=!0,console.log("Wake Lock active."),A._wakeLock.addEventListener("release",(function(){console.log("Wake Lock released.")}))})).catch((function(e){throw A.enabled=!1,console.error(e.name+", "+e.message),e})):C()?(this.disable(),console.warn("\n NoSleep enabled for older iOS devices. This can interrupt\n active or long-running network requests from completing successfully.\n See https://github.com/richtr/NoSleep.js/issues/15 for more details.\n "),this.noSleepTimer=window.setInterval((function(){document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))}),15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then((function(e){return A.enabled=!0,e})).catch((function(e){throw A.enabled=!1,e}))}},{key:"disable",value:function(){Q()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):C()?this.noSleepTimer&&(console.warn("\n NoSleep now disabled for older iOS devices.\n "),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}},{key:"isEnabled",get:function(){return this.enabled}}]),A}();A.exports=i},function(A,e,B){"use strict";A.exports={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgL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AADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"}}])}));</script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.css">
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.min.js"></script>
<title>Mini Mirror</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;700&family=Roboto+Condensed:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.10/css/weather-icons.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,300,0,0">
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator@1.4.4/qrcode.js"></script>
<script>
// Firestore config sync: paste the Firebase web config here to move pushes off
// the relay Worker onto Firestore — instant sync (no polling) and the free
// Spark plan hard-stops at its daily quota instead of ever billing.
// null = relay Worker (?config=get/set), exactly as before.
var FIREBASE_CONFIG = {
apiKey: "AIzaSyB1c_oaSHoLS5f7rpGGgd2VgHF6zvwlpk8",
authDomain: "reflekt-mirror.firebaseapp.com",
projectId: "reflekt-mirror",
appId: "1:358119410050:web:3ab46f877304ffc339a79b"
};
if (FIREBASE_CONFIG) {
document.write('<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-app-compat.js"><\/script>');
document.write('<script src="https://www.gstatic.com/firebasejs/10.12.2/firebase-firestore-compat.js"><\/script>');
}
</script>
<style>
:root{
--bg:#000;
--bright:#ffffff;
--dim:#ffffff;
--faint:#ffffff;
--line:rgba(255,255,255,.12);
--accent:#e9c98a;
--disp:'Roboto', system-ui, sans-serif;
--label:'Roboto Condensed', system-ui, sans-serif;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%;background:#000}
body{
background:var(--bg);color:var(--bright);
font-family:var(--disp);
-webkit-font-smoothing:antialiased;
overflow:hidden;
height:100dvh;
touch-action:none;
user-select:none;-webkit-user-select:none;
}
.label{font-family:var(--label);text-transform:uppercase;letter-spacing:.18em;color:var(--faint);font-weight:300}
/* ---------- SETUP ---------- */
#setup{
position:fixed;inset:0;overflow-y:auto;
display:flex;align-items:flex-start;justify-content:center;
padding:max(28px,6vh) 22px;
background:radial-gradient(120% 80% at 50% -10%, #0d0d0d 0%, #000 60%);
}
#setup.hidden{display:none}
.card{width:100%;max-width:440px;padding-bottom:40px}
.brand{font-weight:100;font-size:34px;letter-spacing:.02em;margin-bottom:4px}
.brand b{font-weight:400}
.tagline{font-family:var(--label);color:var(--faint);letter-spacing:.14em;text-transform:uppercase;font-size:12px;margin-bottom:30px}
.field{margin-bottom:20px}
.field > .label{display:block;font-size:11px;margin-bottom:8px}
.input,.select{
width:100%;background:#1b1b1b;border:1px solid #2c2c2c;
color:var(--bright);font-family:var(--disp);font-weight:300;font-size:17px;
padding:13px 14px;border-radius:10px;outline:none;
}
.input:focus,.select:focus{border-color:#ffdd00}
.input::placeholder{color:var(--faint)}
.row{display:flex;gap:12px}
.row .field{flex:1}
.hint{font-family:var(--label);color:var(--faint);font-size:12px;margin-top:7px;line-height:1.5}
.seg{display:flex;border:1px solid #2c2c2c;border-radius:10px;overflow:hidden}
.seg button{flex:1;background:#1b1b1b;border:none;color:var(--dim);
font-family:var(--label);text-transform:uppercase;letter-spacing:.12em;font-size:13px;
padding:13px 0;cursor:pointer}
.seg button.on{background:#ffdd00;color:#000}
.swatches{display:flex;gap:12px}
.swatches button{width:38px;height:38px;border-radius:50%;border:2px solid transparent;
background:var(--c);cursor:pointer;padding:0;transition:transform .12s}
.swatches button.on{border-color:#fff;transform:scale(1.08)}
.swatches button[data-v="#ffffff"]{box-shadow:inset 0 0 0 1px rgba(0,0,0,.25)}
.adv-toggle{background:none;border:none;color:var(--dim);font-family:var(--label);
text-transform:uppercase;letter-spacing:.14em;font-size:12px;cursor:pointer;
padding:6px 0;margin:6px 0 14px;display:flex;align-items:center;gap:8px}
.adv-toggle .chev{transition:transform .2s}
.adv-toggle.open .chev{transform:rotate(90deg)}
#adv{display:none}
#adv.open{display:block}
#haAdv{display:none}
#haAdv.open{display:block}
.start{width:100%;margin-top:14px;background:#ffdd00;color:#000;border:none;
font-family:var(--label);text-transform:uppercase;letter-spacing:.18em;font-weight:700;font-size:15px;
padding:16px;border-radius:10px;cursor:pointer}
.start:active{opacity:.85}
/* Mirror 3-style collapsible settings sections */
.m3sec{margin-bottom:12px}
.m3sec-h{width:100%;display:flex;align-items:center;gap:9px;background:none;border:none;cursor:pointer;
font-family:var(--label);text-transform:uppercase;letter-spacing:.1em;font-size:13px;font-weight:700;
color:#ffdd00;padding:10px 2px;text-align:left}
.m3sec-h .chev{transition:transform .2s;display:inline-block}
.m3sec.open .m3sec-h .chev{transform:rotate(90deg)}
.m3sec-b{display:none;background:#131313;border:1px solid #222222;border-radius:14px;padding:20px 18px 6px}
.m3sec.open .m3sec-b{display:block}
.status{font-family:var(--label);font-size:12px;margin-top:12px;min-height:16px;color:var(--faint);letter-spacing:.04em}
.status.err{color:#ff8a8a}
.status.ok{color:#8affb0}
/* ---------- MIRROR ---------- */
#mirror{position:fixed;inset:0;display:none;padding:clamp(22px,5vw,60px)}
#mirror.show{display:block}
.region{position:absolute}
.r-tl{top:clamp(22px,5vw,60px);left:clamp(22px,5vw,60px)}
.r-tr{top:clamp(22px,5vw,60px);right:clamp(22px,5vw,60px);text-align:right}
.r-bl{bottom:clamp(22px,5vw,60px);left:clamp(22px,5vw,60px)}
.r-br{bottom:clamp(22px,5vw,60px);right:clamp(22px,5vw,60px);text-align:right}
.r-mc{inset:0;display:flex;align-items:center;justify-content:center;padding:0 6vw;pointer-events:none}
.compliment{font-weight:300;font-style:italic;font-size:clamp(29px,calc(4.4vmin + 10px),42px);line-height:1.35;
text-align:center;max-width:680px;color:var(--bright);opacity:0;transition:opacity .6s ease}
.compliment.emoji{font-style:normal;font-size:clamp(64px,20vmin,180px);line-height:1}
.compliment .comp-eye{max-width:min(58vw,440px);max-height:42vh;object-fit:contain;filter:contrast(1.4) brightness(1.15)}
.compliment .comp-user{max-width:min(70vw,560px);max-height:46vh;object-fit:contain}
.stock{width:94vw;text-align:left;font-family:var(--label)}
.stock .stk-top{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:10px}
.stock .stk-sym{font-weight:600;letter-spacing:.04em;color:var(--bright);font-size:clamp(28px,5.6vw,54px)}
.stock .stk-price{font-weight:300;color:var(--bright);font-size:clamp(32px,7vw,72px)}
.stock .stk-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:18px}
.stock .stk-metrics div{color:var(--faint);letter-spacing:.14em;text-transform:uppercase;font-size:clamp(13px,2.2vw,18px)}
.stock .stk-metrics b{display:block;color:var(--bright);font-weight:300;letter-spacing:0;text-transform:none;font-size:clamp(20px,4vw,34px);margin-top:4px}
.stock .stk-canvas{display:block;width:94vw;height:46vh;margin-top:22px}
.stock .stk-range{color:var(--faint);letter-spacing:.14em;margin-top:10px;font-size:clamp(13px,2.2vw,16px)}
.stock .stk-msg{color:var(--faint);font-size:clamp(13px,2.4vw,18px)}
.stockrows{display:flex;flex-direction:column;gap:clamp(10px,1.8vh,20px);align-items:center;font-family:var(--label);width:94vw}
.stockrows .srow{width:100%;box-sizing:border-box;border:1px solid var(--line);border-radius:14px;padding:14px 20px}
.stockrows .srow-top{display:flex;align-items:baseline;justify-content:center;gap:clamp(14px,2.4vw,28px)}
.stockrows .ssym{font-weight:600;letter-spacing:.04em;color:var(--bright);font-size:clamp(18px,3.2vw,30px);min-width:3.6em;text-align:right}
.stockrows .sprice{font-weight:300;color:var(--bright);font-size:clamp(20px,3.6vw,34px);min-width:4.4em;text-align:right}
.stockrows .schg{font-size:clamp(12px,2vw,17px);min-width:7em;text-align:left}
.stockrows .srow-canvas{display:block;width:100%;height:9vh;margin-top:8px}
.stockrows .stk-msg{color:var(--faint);font-size:clamp(13px,2.4vw,18px);text-align:center}
.hadash{display:flex;flex-direction:column;align-items:center;gap:16px;font-family:Arial,sans-serif;width:94vw;
transform:scale(var(--hadash-scale,1.43))}
.hadash-msg{color:#fff;font-family:var(--label);font-size:clamp(13px,2.4vw,18px);text-align:center}
.hadash-title{font-size:clamp(16px,2.6vw,22px);color:#fff}
.hadash-title .msym{color:#ffdd00;vertical-align:-2px;margin-right:6px}
.hadash-columns{display:inline-flex;align-items:center;justify-content:center;gap:clamp(14px,3vw,30px);flex-wrap:wrap}
/* "Fartstrecken" gauge, same design as the main mirror's MMM-EVDashboard:
real car photo over 14 skewed speed-stripe cells, % + range below.
Wheels are circular cutouts of the same photo that always spin; the
charging animations only run with .hadash-charging so idle is static. */
.hadash-stage{width:304px;display:flex;align-items:center;justify-content:center}
.hadash-carstage{display:flex;flex-direction:column;align-items:center;width:304px}
.hadash-carwrap{position:relative;width:288px;margin-bottom:16px}
.hadash-carimg{width:288px;display:block}
.hadash-wheel{position:absolute;border-radius:50%;background-repeat:no-repeat;
animation:hadash-wheelspin 1s linear infinite}
@keyframes hadash-wheelspin{to{transform:rotate(-360deg)}}
.hadash-stripes{display:flex;gap:6px}
.hadash-cell{width:14px;height:25px;transform:skewX(-18deg);display:inline-block;box-sizing:border-box}
.hadash-cell:not(.on):not(.part){border:1.5px solid #55555e}
.hadash-cell.part{opacity:.45}
.hadash-carpct{font-size:53px;font-weight:bold;color:#fff;font-variant-numeric:tabular-nums;line-height:1.2;margin-top:9px}
.hadash-carkm{font-size:22px;font-weight:bold;color:#888;line-height:1.1}
.hadash-carbolt{font-size:30px;margin-left:9px;display:none;color:#ffdd00}
.hadash-charging .hadash-carbolt{display:inline-block;animation:hadash-boltpulse 1.4s ease-in-out infinite}
.hadash-charging .hadash-cell.on{animation:hadash-cellshine 2.4s ease-in-out infinite;animation-delay:calc(var(--i)*.15s)}
.hadash-charging .hadash-cell.part{opacity:1;animation:hadash-cellblink 1.1s ease-in-out infinite}
@keyframes hadash-cellshine{0%,100%{opacity:.6}50%{opacity:1}}
@keyframes hadash-cellblink{0%,100%{opacity:.15}50%{opacity:.9}}
@keyframes hadash-boltpulse{0%,100%{opacity:.55}50%{opacity:1}}
@media (prefers-reduced-motion:reduce){
.hadash-wheel,.hadash-charging .hadash-carbolt,
.hadash-charging .hadash-cell.on,.hadash-charging .hadash-cell.part{animation:none}
}
.hadash-info{min-width:260px;white-space:nowrap;text-align:left}
.hadash-rows{font-size:16px;line-height:1.3}
.hadash-row{display:flex;justify-content:space-between;gap:24px;border-bottom:1px solid #222;padding:2px 0}
.hadash-row span:first-child{color:#fff}
.hadash-row .msym{font-size:1.1em;color:#ffdd00;vertical-align:-2px}
.hadash-tires{margin-top:12px;font-size:13px;color:#fff}
@media (max-width:820px){ .hadash{--hadash-scale:1.03} }
.time{font-weight:700;font-size:clamp(56px,16vmin,160px);line-height:1;letter-spacing:-.01em}
.time .sec{font-size:.32em;color:var(--accent);font-weight:300;margin-left:.12em;vertical-align:.55em}
.date{font-family:var(--label);font-weight:400;font-size:clamp(15px,4.2vw,26px);color:var(--accent);
text-transform:uppercase;letter-spacing:.14em;margin-top:10px}
.greet{font-weight:300;font-size:clamp(18px,5vw,30px);color:var(--bright);margin-top:18px}
.wx-temp{font-weight:700;font-size:clamp(36px,10vmin,90px);line-height:1;color:#ffdd00}
.wx-temp .wi{font-size:.55em;margin-right:.18em;vertical-align:.04em}
.wx-cond{font-family:var(--label);text-transform:uppercase;letter-spacing:.12em;color:var(--accent);
font-size:clamp(13px,3.4vw,18px);margin-top:6px}
.wx-meta{font-family:var(--label);color:var(--faint);letter-spacing:.08em;font-size:clamp(11px,2.8vmin,14px);margin-top:6px}
.fc{display:inline-block;text-align:left;margin-top:15px}
.fc-row{display:grid;grid-template-columns:3.4em 1.5em 2.3em 2.3em;align-items:center;gap:6px;margin-top:8px}
.fc-d{font-family:var(--label);text-transform:uppercase;letter-spacing:.1em;color:var(--accent);font-size:clamp(11px,2.6vmin,14px)}
.fc-i{font-size:clamp(14px,3.4vmin,18px);text-align:center}
.fc-hi{font-weight:400;color:var(--bright);text-align:right;font-size:clamp(13px,3vmin,17px)}
.fc-lo{font-weight:400;color:var(--faint);text-align:right;font-size:clamp(13px,3vmin,17px)}
/* week number + sun times, between the date and the greeting */
#infoRegion{margin-top:14px}
.info-week{font-family:var(--label);text-transform:uppercase;letter-spacing:.16em;color:var(--accent);
font-weight:700;font-size:clamp(20px,4.6vmin,26px)}
.info-sun{font-family:var(--label);letter-spacing:.06em;color:var(--dim);font-size:clamp(12px,3vmin,16px);margin-top:9px}
.info-sun .wi{color:var(--accent);margin:0 .25em 0 0}
.info-sun .gap{display:inline-block;width:.9em}
.bus-h{font-size:11px;margin-bottom:10px;color:var(--accent)}
.msym{font-family:'Material Symbols Outlined';font-weight:normal;font-style:normal;line-height:1;
letter-spacing:normal;text-transform:none;white-space:nowrap;-webkit-font-feature-settings:'liga';font-feature-settings:'liga'}
.dep{display:flex;align-items:center;gap:12px;margin-bottom:8px;font-weight:300}
.dep .mi{font-size:1.15em;color:var(--accent);flex:0 0 auto;width:1.2em;text-align:center}
.dep .ln{font-family:var(--label);font-weight:400;min-width:2.4em;color:var(--bright)}
.dep .dst{color:var(--dim);font-size:clamp(14px,3.6vw,19px);flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:42vw}
.dep .tm{font-family:var(--label);color:var(--accent);letter-spacing:.04em}
.bus-msg{font-family:var(--label);color:var(--faint);font-size:13px;letter-spacing:.04em;line-height:1.5;max-width:60vw}
.elp-gauge{width:clamp(160px,34vmin,280px);height:auto;display:block;overflow:visible}
.elp-chart{width:clamp(160px,34vmin,280px);height:auto;display:block;overflow:visible;margin-bottom:4px}
.gear{position:fixed;bottom:14px;right:14px;width:26px;height:26px;border-radius:50%;
background:rgba(255,255,255,.06);border:none;color:var(--faint);cursor:pointer;
display:flex;align-items:center;justify-content:center;font-size:14px;z-index:10}
.gear:active{background:rgba(255,255,255,.18)}
#mirror.show .region{animation:fade .9s ease both}
.r-tr{animation-delay:.1s}.r-bl{animation-delay:.2s}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion: reduce){#mirror.show .region{animation:none}}
/* short landscape (phones on their side): hide greeting so corners never collide */
@media (orientation:landscape) and (max-height:430px){
.greet{display:none}
.date{margin-top:7px}
}
/* phone mirror (rendered at the fixed desktop width): keep the two bottom corners apart */
@media (max-width:660px){
#mirror.show .r-bl{max-width:56vw}
#mirror.show .dep{gap:10px}
#mirror.show .dep .dst{max-width:30vw}
#mirror.show .r-br{max-width:42vw;bottom:64px}
/* top-left 15% smaller */
#mirror.show .time{font-size:clamp(48px,13.6vmin,136px)}
#mirror.show .date{font-size:clamp(13px,3.6vw,22px)}
#mirror.show .greet{font-size:clamp(15px,4.25vw,26px)}
/* tighter gap between day name and weather icon */
#mirror.show .fc-row{grid-template-columns:2.6em 1.4em 2.2em 2.2em;gap:4px;margin-top:7px}
/* sunrise stacked above sunset */
#mirror.show .info-sun .sunr,#mirror.show .info-sun .suns{display:block}
#mirror.show .info-sun .suns{margin-top:5px}
#mirror.show .info-sun .gap{display:none}
}
.useloc{width:100%;background:#1b1b1b;border:1px solid #2c2c2c;color:var(--bright);
font-family:var(--label);text-transform:uppercase;letter-spacing:.14em;font-size:13px;
padding:13px;border-radius:11px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:9px}
.useloc:active{background:#1a1a1a}
.useloc .x{font-size:16px;line-height:0}
.or{font-family:var(--label);color:var(--faint);font-size:11px;letter-spacing:.16em;
text-transform:uppercase;text-align:center;margin:11px 0 9px}
/* --- BOLD TEXT EXPERIMENT (2026-07-09) ---
Daytime readability: forces every text weight on the mirror display to bold.
To revert to the original thin/light hierarchy, delete this block. */
#mirror *{font-weight:700!important}
/* --- end bold text experiment --- */
</style>
</head>
<body>
<div id="sleepveil"></div>
<div id="focus"><div id="focusInner"></div></div>
<div id="eyesaver"><img src="https://media4.giphy.com/media/v1.Y2lkPTZjMDliOTUyeTloMmF1Y2hicDQyeDlpcHh0b2J5Y3FwMW1jem9heGJvemIyeDZobyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3ohs4CacylzFaHjMM8/giphy.gif" alt="Eye"></div>
<div id="biz">
<img id="bizTopImg" class="biz-img" alt="">
<div class="biz-middle"><img id="bizMidImg" class="biz-img" alt=""></div>
<div class="biz-foot">
<div class="biz-foot-l"><div id="bizTime" class="biz-time"></div><div id="bizDate" class="biz-date"></div></div>
<div id="bizWx" class="biz-wx"></div>
</div>
<div id="bizPdf"><canvas id="bizPdfCanvas"></canvas></div>
<button class="gear" id="bizGear" title="Settings">⚙</button>
</div>
<div id="setup">
<div class="card">
<div class="brand">mini mirror<b>.</b></div>
<div class="tagline">Set up your display</div>
<div class="m3sec open">
<button type="button" class="m3sec-h"><span class="chev">›</span> Basics</button>
<div class="m3sec-b">
<div class="field">
<span class="label">Mode</span>
<div class="seg" id="modeSeg">
<button data-v="off" class="on">Home</button>
<button data-v="on">Business</button>
<button data-v="stock">Stock</button>
</div>
</div>
<div class="field opt-home">
<span class="label">Location</span>
<button class="useloc" id="useLoc"><span class="x">◎</span> Use my location</button>
<div class="or">or enter a place</div>
<input id="loc" class="input" placeholder="t.ex. Göteborg" autocomplete="off">
<div class="hint" id="locHint">Used for weather only.</div>
</div>
<div class="field opt-home">
<span class="label">Name (optional)</span>
<input id="name" class="input" placeholder="Cameron" autocomplete="off">
</div>
</div>
</div>
<div class="m3sec">
<button type="button" class="m3sec-h"><span class="chev">›</span> Clock & language</button>
<div class="m3sec-b">
<div class="row opt-home">
<div class="field">
<span class="label">Units</span>
<div class="seg" id="unitSeg">
<button data-v="celsius" class="on">°C</button>
<button data-v="fahrenheit">°F</button>
</div>
</div>
<div class="field">
<span class="label">Clock</span>
<div class="seg" id="clockSeg">
<button data-v="24" class="on">24h</button>
<button data-v="12">12h</button>
</div>
</div>
</div>
<div class="row opt-home">
<div class="field">
<span class="label">Language</span>
<div class="seg" id="langSeg">
<button data-v="sv" class="on">Svenska</button>
<button data-v="en">English</button>
</div>
</div>
<div class="field">
<span class="label">Seconds</span>
<div class="seg" id="secSeg">
<button data-v="on" class="on">On</button>
<button data-v="off">Off</button>
</div>
</div>
</div>
</div>
</div>
<div class="m3sec">
<button type="button" class="m3sec-h"><span class="chev">›</span> Content & panels</button>
<div class="m3sec-b">
<div class="field opt-home">
<span class="label">Centre display</span>
<div class="seg" id="compSeg">
<button data-v="off">Off</button>
<button data-v="sv" class="on">Svenska</button>
<button data-v="en">English</button>
<button data-v="user">User</button>
<button data-v="stock">Stock</button>
<button data-v="ha">Home Assistant</button>
</div>
<div class="hint">Rotating one-liners (Swedish/English), your own image, a full-width live stock chart, or a Home Assistant dashboard.</div>
</div>
<div class="field opt-home" id="compImgField" style="display:none">
<span class="label">Centre image</span>
<input id="compImgFile" type="file" accept="image/png,image/jpeg,image/gif" style="display:none">
<button class="start ghost" id="compImgPick" type="button">Choose from device</button>
<button class="start ghost" id="compImgClear" type="button">Clear image</button>
<div class="hint">PNG, JPEG or GIF (animated GIFs under 490KB play). Choosing it on your phone? It travels with “Push settings to mirror”. Larger photos are shrunk automatically to fit.</div>
</div>
<div class="field opt-home" id="haField" style="display:none">
<span class="label">Home Assistant URL</span>
<input id="haUrl" class="input" placeholder="https://your-ha.your-tailnet.ts.net:8123" autocomplete="off">
<div class="hint">Needs a real HTTPS address reachable from this device (e.g. a Tailscale HTTPS hostname) — a plain http:// local address won’t work from this page. Your Home Assistant also needs <code>cors_allowed_origins</code> set to this site’s address.</div>
</div>
<div class="field opt-home" id="haTokenField" style="display:none">
<span class="label">Home Assistant long-lived access token</span>
<input id="haToken" class="input" type="password" placeholder="paste a long-lived access token" autocomplete="off">
<div class="hint">Created in Home Assistant under your profile → Security → Long-Lived Access Tokens. Stays on THIS device only — it never travels with “Push settings to mirror” or leaves your browser.</div>
</div>
<button type="button" class="adv-toggle opt-home" id="haAdvToggle" style="display:none"><span class="chev">›</span> Entity IDs (advanced)</button>
<div id="haAdv" class="opt-home">
<div class="field">
<span class="label">Battery %</span>
<input id="haBattery" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Range</span>
<input id="haRange" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Odometer</span>
<input id="haOdometer" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Cabin temperature</span>
<input id="haCabinTemp" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Tire pressure — front left / front right / rear left / rear right</span>
<input id="haTireFL" class="input" autocomplete="off" style="margin-bottom:8px">
<input id="haTireFR" class="input" autocomplete="off" style="margin-bottom:8px">
<input id="haTireRL" class="input" autocomplete="off" style="margin-bottom:8px">
<input id="haTireRR" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Charging (binary_sensor)</span>
<input id="haCharging" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Plugged in (binary_sensor)</span>
<input id="haPlug" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Locked (binary_sensor)</span>
<input id="haLocked" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Doors open (binary_sensor)</span>
<input id="haDoors" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Windows open (binary_sensor)</span>
<input id="haWindows" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Online (binary_sensor)</span>
<input id="haOnline" class="input" autocomplete="off">
</div>
<div class="field">
<span class="label">Car position (device_tracker) — used by the car map page</span>
<input id="haTracker" class="input" autocomplete="off">
</div>
<div class="hint">Defaults are set for a BYD Atto 3 via the hass-byd-vehicle integration — replace any of these with your own entity IDs, or leave blank to hide that tile.</div>
</div>
<div class="field opt-home">
<span class="label">Car map page</span>
<div class="seg" id="carMapSeg">
<button data-v="off" class="on">Off</button>
<button data-v="on">On</button>
</div>
<div class="hint">A second mirror page: a satellite map with the car’s live position from Home Assistant (same URL + token as the dashboard above). The day’s journey is drawn as a line and resets at midnight; the map keeps the journey, home and the car in view together.</div>
</div>
<div class="field opt-home" id="carSwipeField">
<span class="label">Hand gestures</span>
<div class="seg" id="carSwipeSeg">
<button data-v="off">Off</button>
<button data-v="on" class="on">On</button>
</div>
<div class="hint"><b>Thumbs up</b> held for about half a second flips between the mirror and the car map. <b>Hold an open palm</b> up to the camera for a second to switch between home and business mode. Because both need a deliberate, recognised gesture, simply walking past can’t trigger them — unlike the old wave. Needs a lit room and you facing the mirror; the page dots pulse when a gesture lands, and the dots (tap) plus the “Flip mirror page” button on a connected phone still work as fallbacks. The gesture model loads once from Google’s MediaPipe CDN; all camera frames are processed on-device and never stored or sent anywhere.</div>
</div>
<div class="field opt-home">
<span class="label">Stock symbol</span>
<input id="stockSym" class="input" placeholder="e.g. AAPL, TSLA, MSFT" autocomplete="off">
<div class="hint">Live prices via your relay Worker (the Departures service URL) — no key, no cap.</div>
</div>
<div class="field stock-range-field">
<span class="label">Stock range</span>
<div class="seg" id="stockRangeSeg">
<button data-v="day">Day</button>
<button data-v="week">Week</button>
<button data-v="month" class="on">Month</button>
<button data-v="year">Year</button>
<button data-v="all">All</button>
</div>
<div class="hint">Applies to the centre stock chart (Home) and all rows below (Stock mode).</div>
</div>
<div class="field opt-stock">
<span class="label">Stock rows (up to 5)</span>
<input id="stock1" class="input" placeholder="e.g. AAPL" autocomplete="off" style="margin-bottom:8px">
<input id="stock2" class="input" placeholder="e.g. TSLA" autocomplete="off" style="margin-bottom:8px">
<input id="stock3" class="input" placeholder="e.g. MSFT" autocomplete="off" style="margin-bottom:8px">
<input id="stock4" class="input" placeholder="optional" autocomplete="off" style="margin-bottom:8px">
<input id="stock5" class="input" placeholder="optional" autocomplete="off">
<div class="hint">Leave a row blank to hide it. Shown full-screen below the clock and weather.</div>
</div>
<div class="field opt-biz">
<span class="label">Business top image</span>
<input id="bizTop" class="input" placeholder="paste a URL, or choose a file" autocomplete="off">
<input id="bizTopFile" type="file" accept="image/*" style="display:none">
<button class="start ghost" id="bizTopPick" type="button">Choose from device</button>
<label class="sizerow"><span>Size</span><input id="bizTopScale" type="range" min="30" max="100" step="5" value="100"><span id="bizTopScaleVal">100%</span></label>
</div>
<div class="field opt-biz">
<span class="label">Business middle image (optional)</span>
<input id="bizMid" class="input" placeholder="paste a URL, or choose a file" autocomplete="off">
<input id="bizMidFile" type="file" accept="image/*" style="display:none">
<button class="start ghost" id="bizMidPick" type="button">Choose from device</button>
<label class="sizerow"><span>Size</span><input id="bizMidScale" type="range" min="30" max="100" step="5" value="100"><span id="bizMidScaleVal">100%</span></label>
</div>
<div class="field opt-biz">
<span class="label">Business PDF (full screen, optional)</span>
<input id="bizPdfFile" type="file" accept="application/pdf" style="display:none">
<button class="start ghost" id="bizPdfPick" type="button">Choose PDF from device</button>
<button class="start ghost" id="bizPdfClear" type="button">Clear PDF</button>
<div class="hint">If set, the business screen shows this PDF full-screen instead of the images.</div>
</div>
<div class="field opt-home">
<span class="label">Accent colour</span>
<div class="swatches" id="accentSw">
<button data-v="#e9c98a" style="--c:#e9c98a" class="on" aria-label="Gold"></button>
<button data-v="#ffdd00" style="--c:#ffdd00" aria-label="Yellow"></button>
<button data-v="#7fd3ff" style="--c:#7fd3ff" aria-label="Ice"></button>
<button data-v="#5fe3a1" style="--c:#5fe3a1" aria-label="Mint"></button>
<button data-v="#ff8aa8" style="--c:#ff8aa8" aria-label="Rose"></button>
<button data-v="#ffffff" style="--c:#ffffff" aria-label="White"></button>
</div>
<div class="hint">Colours the date, labels and details. The clock stays white for brightness behind glass.</div>
</div>
<div class="field opt-home" id="zoneField">
<span class="label">Electricity area</span>
<div class="seg" id="zoneSeg">
<button data-v="SE1">SE1</button>
<button data-v="SE2">SE2</button>
<button data-v="SE3" class="on">SE3</button>
<button data-v="SE4">SE4</button>
</div>
<div class="hint">Swedish spot price for your bidding area (Gothenburg is SE3).</div>
</div>
<button class="adv-toggle opt-home" id="advToggle"><span class="chev">›</span> Bus departures (optional)</button>
<div id="adv" class="opt-home">
<div class="field">
<span class="label">Departures source</span>
<div class="seg" id="busSourceSeg">
<button data-v="relay" class="on">Relay</button>
<button data-v="ha">Home Assistant</button>
</div>
</div>
<div class="field" id="busEntityField" style="display:none">
<span class="label">Bus entity ID</span>
<input id="busEntity" class="input" autocomplete="off">
</div>
<div class="field" id="busUrlField">
<span class="label">Departures service URL</span>
<input id="busUrl" class="input" placeholder="https://your-worker.workers.dev" autocomplete="off">
</div>
<div class="field" id="busIdField">
<span class="label">Specific stop ID (optional)</span>
<input id="busId" class="input" placeholder="leave blank for nearest stop" autocomplete="off" inputmode="numeric">
</div>
<div class="hint" id="busRelayHint">Departures for your nearest stop work automatically once location is allowed. Advanced: override the service URL or pin a specific stop ID.</div>
<div class="hint" id="busHaHint" style="display:none">Reads departures straight from a Home Assistant sensor (e.g. a Trafiklab/Västtrafik integration) using the same URL + token as the Home Assistant dashboard above — polls HA locally instead of an external API, so there’s no outside quota to run out.</div>
</div>
</div>
</div>
<div class="m3sec">
<button type="button" class="m3sec-h"><span class="chev">›</span> Screen & motion</button>
<div class="m3sec-b">
<div class="field">
<span class="label">Motion wake</span>
<div class="seg" id="motionSeg">
<button data-v="off" class="on">Off</button>
<button data-v="on">On</button>
</div>
<div class="hint">Uses the front camera to detect movement and wake the screen; it sleeps to black when no one is around. Frames are processed on-device and never stored or sent anywhere.</div>
</div>
<div class="field">
<span class="label">Stay awake for</span>
<div class="seg" id="motionTimeoutSeg">
<button data-v="30">30s</button>
<button data-v="60" class="on">1 min</button>
<button data-v="180">3 min</button>
<button data-v="300">5 min</button>
</div>
<div class="hint">How long the screen stays on after the last movement.</div>
</div>
<div class="field">
<span class="label">Motion sensitivity</span>
<div class="seg" id="motionSensSeg">
<button data-v="low">Low</button>
<button data-v="med" class="on">Medium</button>
<button data-v="high">High</button>
<button data-v="max">Max</button>
</div>
<div class="hint">How much movement wakes the screen. High trips easily; Low needs bigger movement.</div>
</div>
</div>
</div>
<div class="m3sec">
<button type="button" class="m3sec-h"><span class="chev">›</span> Remote & phone control</button>
<div class="m3sec-b">
<div class="field">
<span class="label">Remote camera view</span>
<div class="seg" id="camShareSeg">
<button data-v="off" class="on">Off</button>
<button data-v="on">On</button>
</div>
<button class="start ghost" id="camViewBtn" type="button">View mirror camera</button>
<div class="hint">On the mirror tablet: set On, then press Start mirror — the mirror only listens for viewers while the mirror display is showing. On your phone: tap “View mirror camera” to watch live. Video streams directly device-to-device — the relay only sets up the connection.</div>
<div class="hint" id="camShareStatus" style="color:var(--accent)">Status: idle</div>
</div>
<div class="field">
<span class="label">Remote control</span>
<div class="seg" id="remoteSeg">
<button data-v="off" class="on">Off</button>
<button data-v="on">On</button>
</div>
<div class="hint">On the mirror tablet: set On so it receives settings pushed from another device. On your phone: leave Off and use “Push to mirror” below.</div>
</div>
<div class="field">
<span class="label">Mirror ID</span>
<input id="mirrorId" class="input" placeholder="main" autocomplete="off">
<button class="start ghost" id="genId" type="button">Generate new code</button>
<div class="hint" id="mirrorIdHint">This is <b>this mirror's</b> code — it acts as a light password. Generate makes a new one (any phone using the old code loses access). To pair a phone, just scan the QR below with its camera.</div>
<div id="pairQr"></div>
</div>
</div>
</div>
<button class="start ghost" id="pushBtn" type="button">Push settings to mirror</button>
<button class="start" id="startBtn">Start mirror</button>
<button class="start ghost" id="eyeBtn">Eye screensaver</button>
<button class="start ghost" id="carPageBtn" style="display:none">Flip mirror page (clock ↔ car map)</button>
<div class="status" id="status"></div>
</div>
</div>
<div id="mirror">
<div class="region r-tl" id="clockRegion">
<div class="time" id="mTime">--:--</div>
<div class="date" id="mDate"></div>
<div id="infoRegion">
<div class="info-week" id="infoWeek"></div>
<div class="info-sun" id="infoSun"></div>
</div>
<div class="greet" id="mGreet"></div>
</div>
<div class="region r-tr" id="wxRegion">
<div class="wx-temp" id="wxTemp">--°</div>
<div class="wx-cond" id="wxCond"></div>
<div class="wx-meta" id="wxMeta"></div>
<div class="fc" id="wxFc"></div>
</div>
<div class="region r-mc" id="compRegion" style="display:none">
<div class="compliment" id="compText"></div>
</div>
<div class="region r-mc" id="stockRowsRegion" style="display:none">
<div class="stockrows" id="stockRowsList"></div>
</div>
<div class="region r-br" id="busRegion" style="display:none">
<div class="label bus-h" id="busHead">Departures</div>
<div id="busList"></div>
</div>
<div class="region r-bl" id="elprisRegion" style="display:none">
<div id="elprisList"></div>
</div>
<div id="mirrorTag"></div>
<div class="region r-bl" id="stockTimeRegion" style="display:none">
<div class="biz-time" id="stockTime"></div>
<div class="biz-date" id="stockDate"></div>
</div>
<div class="region r-br" id="stockWxRegion" style="display:none">
<div class="biz-wx" id="stockWx"></div>
</div>
<div id="carmap">
<div id="carmapMap"></div>
<div id="carmapTop">
<div class="cm-title" id="carmapTitle"></div>
<div class="cm-sub" id="carmapSub"></div>
</div>
<div id="carmapMsg"></div>
</div>
<div id="pageDots"><span class="pd on"></span><span class="pd"></span></div>
<button class="gear" id="gear" title="Settings">⚙</button>
</div>
<script>
(function(){
"use strict";
// STUN finds a direct route; the free TURN relay is the fallback when phone and
// mirror sit on different networks (e.g. mobile data vs home wifi) and a direct
// route is blocked by NAT. ICE simply skips servers it can't reach.
var RTC_ICE=[
{urls:"stun:stun.l.google.com:19302"},
{urls:["turn:openrelay.metered.ca:80","turn:openrelay.metered.ca:443","turn:openrelay.metered.ca:443?transport=tcp"],username:"openrelayproject",credential:"openrelayproject"}
];
// Vanilla ICE: wait for candidate gathering to finish so the SDP we post carries
// every candidate in one write. The relay's ICE-list store drops candidates that
// arrive in a burst (parallel read-modify-write), so trickling them one POST at a
// time loses most routes — that made connections succeed only ~1 time in 20.
function waitIce(pc, ms){
return new Promise(function(res){
if(pc.iceGatheringState==="complete") return res();
var t=setTimeout(function(){ pc.removeEventListener("icegatheringstatechange",h); res(); }, ms||4000);
function h(){ if(pc.iceGatheringState==="complete"){ clearTimeout(t); pc.removeEventListener("icegatheringstatechange",h); res(); } }
pc.addEventListener("icegatheringstatechange",h);
});
}
// ---------- remote camera VIEWER mode: open this page with ?cam=1&id=<mirrorId> to watch ----------
if(new URLSearchParams(location.search).get("cam")==="1"){
document.title="Mini Mirror camera";
document.body.innerHTML='<div id="camView" style="position:fixed;inset:0;background:#000;display:flex;align-items:center;justify-content:center;overflow:hidden">'
+'<video id="camVideo" autoplay playsinline muted style="width:100%;height:100%;object-fit:contain;background:#000"></video>'
+'<div id="camStatus" style="position:absolute;bottom:24px;left:0;right:0;text-align:center;color:#fff;font-family:\'Roboto Condensed\',sans-serif;font-size:14px;letter-spacing:.08em;text-transform:uppercase">Connecting…</div>'
+'</div>';
var qs=new URLSearchParams(location.search);
var camId=qs.get("id")||"main";
var camBase=qs.get("relay")||"https://still-wave-afbc.ecksquad.workers.dev";
function cU(p){ return camBase+(camBase.indexOf("?")>=0?"&":"?")+p; }
var cPc=null, cIceT=null, cAnsT=null;
function cStatus(t){ var s=document.getElementById("camStatus"); if(s) s.textContent=t; }
function cConnect(){
cStatus("Connecting\u2026");
fetch(cU("rtc=reset&id="+encodeURIComponent(camId)),{method:"POST"}).catch(function(){}).then(function(){
cPc=new RTCPeerConnection({iceServers:RTC_ICE});
cPc.addTransceiver("video",{direction:"recvonly"});
cPc.ontrack=function(ev){
var v=document.getElementById("camVideo");
if(v && v.srcObject!==ev.streams[0]){
v.srcObject=ev.streams[0]; v.play().catch(function(){});
v.onloadedmetadata=function(){ cStatus("Live"); };
}
};
cPc.onconnectionstatechange=function(){
var v=document.getElementById("camVideo");
if(cPc.connectionState==="connected" && !(v&&v.srcObject)) cStatus("Connected, waiting for video\u2026");
else if(cPc.connectionState==="failed"||cPc.connectionState==="disconnected") cStatus("Connection lost \u2014 tap to retry");
};
return cPc.createOffer().then(function(offer){ return cPc.setLocalDescription(offer); })
.then(function(){ cStatus("Finding a route…"); return waitIce(cPc,4000); });
}).then(function(){
return fetch(cU("rtc=sdp&role=offer&id="+encodeURIComponent(camId)),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"offer",sdp:cPc.localDescription.sdp,_ts:Date.now()})});
}).then(function(){
cStatus("Waiting for mirror\u2026");
var answered=false;
setTimeout(function(){ if(!answered) cStatus("Still waiting \u2014 on the mirror, set Remote camera view to On and press Start mirror"); },15000);
clearInterval(cAnsT);
cAnsT=setInterval(function(){
if(answered) return;
fetch(cU("rtc=sdp&role=answer&id="+encodeURIComponent(camId))).then(function(r){return r.json();}).then(function(ans){
if(!ans||!ans.sdp) return;
answered=true; clearInterval(cAnsT);
cPc.setRemoteDescription({type:"answer",sdp:ans.sdp}).then(function(){
var since=0;
clearInterval(cIceT);
cIceT=setInterval(function(){
fetch(cU("rtc=ice&role=mirror&id="+encodeURIComponent(camId)+"&since="+since)).then(function(r){return r.json();}).then(function(d){
var list=(d&&d.candidates)||[];
list.forEach(function(c){ try{ cPc.addIceCandidate(c); }catch(e){} });
since=(d&&d.total)||since;
}).catch(function(){});
},2000);
});
}).catch(function(){});
},2000);
}).catch(function(){ cStatus("Couldn't connect \u2014 check the relay URL and Mirror ID"); });
}
document.getElementById("camView").addEventListener("click",function(){
var v=document.getElementById("camVideo");
if(v && v.srcObject && v.paused){ v.play().catch(function(){}); }
if(cPc && cPc.connectionState==="connected") return;
clearInterval(cIceT); clearInterval(cAnsT);
if(cPc){ try{cPc.close();}catch(e){} }
cConnect();
});
cConnect();
return;
}
// ---------- state + storage (storage is best-effort; falls back to memory) ----------
var DEFAULTS = { loc:"", lat:null, lon:null, place:"", name:"",
unit:"celsius", clock:"24", lang:"sv", seconds:"on", comments:"sv",
motion:"off", motionFor:"60", motionSens:"med", camShare:"off", biz:"off", bizTop:"", bizMid:"", bizTopData:"", bizMidData:"", bizPdf:"", bizTopScale:100, bizMidScale:100, stockSym:"AAPL", stockRange:"month", stock1:"", stock2:"", stock3:"", stock4:"", stock5:"", remoteSync:"off", mirrorId:"main", accent:"#e9c98a", elzone:"SE3", eyeMode:"off",
haUrl:"", haToken:"",
haBattery:"sensor.byd_atto3zuo_duo_battery_level", haRange:"sensor.byd_atto3zuo_duo_range", haOdometer:"sensor.byd_atto3zuo_duo_odometer",
haCabinTemp:"sensor.byd_atto3zuo_duo_cabin_temperature",
haTireFL:"sensor.byd_atto3zuo_duo_front_left_tire_pressure", haTireFR:"sensor.byd_atto3zuo_duo_front_right_tire_pressure",
haTireRL:"sensor.byd_atto3zuo_duo_rear_left_tire_pressure", haTireRR:"sensor.byd_atto3zuo_duo_rear_right_tire_pressure",
haCharging:"binary_sensor.byd_atto3zuo_duo_charging", haPlug:"binary_sensor.byd_atto3zuo_duo_plug", haLocked:"binary_sensor.byd_atto3zuo_duo_locked",
haDoors:"binary_sensor.byd_atto3zuo_duo_doors", haWindows:"binary_sensor.byd_atto3zuo_duo_windows", haOnline:"binary_sensor.byd_atto3zuo_duo_online",
haTracker:"device_tracker.byd_atto3zuo_duo_location", carMap:"off", carSwipe:"on", carFlip:0,
busUrl:"https://still-wave-afbc.ecksquad.workers.dev", busId:"",
busSource:"relay", busEntity:"sensor.bjurslattsliden_goteborg" };
var state = Object.assign({}, DEFAULTS);
var KEY = "mirror.config.v1";
// The business/centre images are data URLs — too big to sit in localStorage
// next to the settings. Two of them overflow localStorage's quota, so the
// whole save() throws and NOTHING persists (the "my logo/GIF is forgotten
// after a restart" bug). Keep the images in IndexedDB; localStorage holds
// only the lightweight settings.
var IMG_FIELDS = ["bizTopData","bizMidData","compImgData"];
function load(){ try{ var s=localStorage.getItem(KEY); if(s) state=Object.assign({},DEFAULTS,JSON.parse(s)); }catch(e){}
if(!state.busUrl) state.busUrl = DEFAULTS.busUrl; // always fall back to the built-in departures service
if(state.comments==="on") state.comments="sv"; } // migrate old on/off to the new modes
function save(){ if(KIOSK) return; try{
var lite={}; for(var k in state){ if(IMG_FIELDS.indexOf(k)<0) lite[k]=state[k]; }
localStorage.setItem(KEY, JSON.stringify(lite));
}catch(e){} }
// Set an image data URL: kept in memory (so it displays and still travels
// with a push) AND written to IndexedDB (its persistent home).
function setImg(field, value){ state[field]=value||""; try{ idbSet("img_"+field, state[field]); }catch(e){} }
// On boot, restore the images from IndexedDB into state; migrate any legacy
// copy that's still sitting in localStorage into IndexedDB, then re-save.
function loadImages(cb){
var pending=IMG_FIELDS.length;
IMG_FIELDS.forEach(function(f){
idbGet("img_"+f).then(function(v){
if(v){ state[f]=v; }
else if(state[f]){ try{ idbSet("img_"+f, state[f]); }catch(e){} } // migrate legacy localStorage value
}).catch(function(){}).then(function(){ if(--pending===0){ save(); if(cb) cb(); } });
});
}
var $ = function(id){ return document.getElementById(id); };
// ---------- i18n ----------
var T = {
sv:{ morning:"God morgon", forenoon:"God förmiddag", afternoon:"God eftermiddag", evening:"God kväll", night:"God natt",
min:"min", now:"nu", locale:"sv-SE", feels:"Känns som", wind:"m/s", week:"Vecka", noBus:"Inga avgångar just nu.", busWait:"Väntar på position\u2026",
busErr:"Kunde inte hämta avgångar. Kontrollera Stop ID och nyckel (eller blockeras anropet av CORS).",
elpris:"Elpris", low:"Lågt", mid:"Normalt", high:"Högt", today:"idag", elprisErr:"Kunde inte hämta elpris.",
carFrom:"hemifrån", carHome:"Hemma", carUpd:"uppdaterad" },
en:{ morning:"Good morning", forenoon:"Good morning", afternoon:"Good afternoon", evening:"Good evening", night:"Good night",
min:"min", now:"now", locale:"en-GB", feels:"Feels like", wind:"m/s", week:"Week", noBus:"No departures right now.", busWait:"Waiting for location\u2026",
busErr:"Couldn't load departures. Check the Stop ID and key (or the request was blocked by CORS).",
elpris:"Electricity", low:"Low", mid:"Normal", high:"High", today:"today", elprisErr:"Couldn't load prices.",
carFrom:"from home", carHome:"At home", carUpd:"updated" }
};
function t(k){ return (T[state.lang]||T.sv)[k]; }
// WMO weather code -> { icon class, sv label, en label }
function wx(code){
var m = {
0:["wi-day-sunny","Klart","Clear"],
1:["wi-day-sunny-overcast","Mest klart","Mostly clear"],
2:["wi-day-cloudy","Halvklart","Partly cloudy"],
3:["wi-cloudy","Mulet","Overcast"],
45:["wi-fog","Dimma","Fog"],48:["wi-fog","Dimma","Fog"],
51:["wi-sprinkle","Duggregn","Drizzle"],53:["wi-sprinkle","Duggregn","Drizzle"],55:["wi-sprinkle","Duggregn","Drizzle"],
56:["wi-sleet","Underkylt","Freezing drizzle"],57:["wi-sleet","Underkylt","Freezing drizzle"],
61:["wi-rain","Regn","Rain"],63:["wi-rain","Regn","Rain"],65:["wi-rain","Kraftigt regn","Heavy rain"],
66:["wi-rain-mix","Underkylt regn","Freezing rain"],67:["wi-rain-mix","Underkylt regn","Freezing rain"],
71:["wi-snow","Snö","Snow"],73:["wi-snow","Snö","Snow"],75:["wi-snow","Kraftig snö","Heavy snow"],
77:["wi-snowflake-cold","Snökorn","Snow grains"],
80:["wi-showers","Regnskurar","Showers"],81:["wi-showers","Regnskurar","Showers"],82:["wi-showers","Kraftiga skurar","Heavy showers"],
85:["wi-snow","Snöbyar","Snow showers"],86:["wi-snow","Snöbyar","Snow showers"],
95:["wi-thunderstorm","Åska","Thunderstorm"],96:["wi-thunderstorm","Åska","Thunderstorm"],99:["wi-thunderstorm","Åska","Thunderstorm"]
};
var e = m[code] || ["wi-na","—","—"];
// semantic colour by condition family (kept gentle, not neon)
var col = "#cfd6dd"; // cloud/overcast default
if(code===0||code===1) col="#ffd27a"; // sun
else if(code===2) col="#ffe0a3"; // partly
else if(code===45||code===48) col="#b8c0c8"; // fog
else if(code>=51&&code<=67) col="#7fb8ff"; // drizzle/rain
else if(code>=80&&code<=82) col="#7fb8ff"; // showers
else if((code>=71&&code<=77)||code===85||code===86) col="#bfe9ff"; // snow
else if(code>=95) col="#c9a8ff"; // thunder
return { icon:e[0], label: state.lang==="en" ? e[2] : e[1], color:col };
}
// ---------- geocoding + weather (Open-Meteo, keyless, CORS-ok) ----------
function geocode(name){
var u = "https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(name)+"&count=1&language="+state.lang+"&format=json";
return fetch(u).then(function(r){return r.json();}).then(function(d){
if(!d.results || !d.results.length) throw new Error("notfound");
var g = d.results[0];
return { lat:g.latitude, lon:g.longitude, place:g.name + (g.country_code? ", "+g.country_code : "") };
});
}
function dayName(iso){
try{ return new Intl.DateTimeFormat((T[state.lang]||T.sv).locale,{weekday:"short"}).format(new Date(iso+"T12:00:00")).replace(".",""); }
catch(e){ return iso.slice(5); }
}
var lastWx = 0;
function loadWeather(force){
if(state.lat==null) return;
var now = Date.now();
if(!force && now-lastWx < 10*60*1000) return; // refresh every 10 min
lastWx = now;
var u = "https://api.open-meteo.com/v1/forecast?latitude="+state.lat+"&longitude="+state.lon
+ "¤t=temperature_2m,apparent_temperature,relative_humidity_2m,wind_speed_10m,weather_code"
+ "&daily=weather_code,temperature_2m_max,temperature_2m_min,sunrise,sunset"
+ "&forecast_days=7&timezone=auto&wind_speed_unit=ms&temperature_unit="+state.unit;
fetch(u).then(function(r){return r.json();}).then(function(d){
var c = d.current;
if(c){
var w = wx(c.weather_code);
$("wxTemp").innerHTML = '<i class="wi '+w.icon+'" style="color:'+w.color+'"></i>'+Math.round(c.temperature_2m)+"°";
$("wxCond").textContent = w.label;
var parts=[];
if(c.apparent_temperature!=null) parts.push(t("feels")+" "+Math.round(c.apparent_temperature)+"°");
if(c.wind_speed_10m!=null) parts.push(Math.round(c.wind_speed_10m)+" "+t("wind"));
if(c.relative_humidity_2m!=null) parts.push(c.relative_humidity_2m+"%");
$("wxMeta").textContent = parts.join(" · ");
}
var dy=d.daily;
if(dy && dy.time){
var rows="";
for(var i=1;i<dy.time.length && i<=5;i++){
var fw=wx(dy.weather_code[i]);
rows += '<div class="fc-row">'
+ '<span class="fc-d">'+esc(dayName(dy.time[i]))+'</span>'
+ '<i class="wi '+fw.icon+' fc-i" style="color:'+fw.color+'"></i>'
+ '<span class="fc-hi">'+Math.round(dy.temperature_2m_max[i])+'°</span>'
+ '<span class="fc-lo">'+Math.round(dy.temperature_2m_min[i])+'°</span>'
+ '</div>';
}
$("wxFc").innerHTML = rows;
if(dy.sunrise && dy.sunset){
var sr=(dy.sunrise[0]||"").slice(11,16), ss=(dy.sunset[0]||"").slice(11,16);
$("infoSun").innerHTML = '<span class="sunr"><i class="wi wi-sunrise"></i>'+sr+'</span>'
+ '<span class="gap"></span>'
+ '<span class="suns"><i class="wi wi-sunset"></i>'+ss+'</span>';
}
}
}).catch(function(){ /* keep last shown */ });
}
// ---------- bus (via your relay Worker, OR straight from Home Assistant) ----------
var lastBus = 0, lastBusHA = 0;
function loadBus(force){
if(state.busSource==="ha"){ loadBusHA(force); return; }
if(!state.busUrl){ $("busRegion").style.display="none"; return; }
$("busRegion").style.display="block";
if(state.lat==null){ $("busHead").textContent="Departures"; $("busList").innerHTML='<div class="bus-msg">'+t("busWait")+'</div>'; return; }
var now=Date.now();
// ResRobot's free key shares ONE monthly quota across every endpoint it
// has (confirmed 2026-07-20: nearbystops AND location.name reported the
// identical hardQuota/requestCounter) - polling every minute burns
// through it in ~9 days. 3 minutes keeps a full month's worth of
// departureBoard-only polling comfortably under the cap.
if(!force && now-lastBus < 180*1000) return;
lastBus = now;
var u = state.busUrl + (state.busUrl.indexOf("?")>=0?"&":"?")
+ "lat="+encodeURIComponent(state.lat) + "&lon="+encodeURIComponent(state.lon)
+ (state.busId ? "&id="+encodeURIComponent(state.busId) : "");
fetch(u).then(function(r){return r.json();}).then(function(d){
if(!d || d.error){ $("busHead").textContent="Departures"; $("busList").innerHTML='<div class="bus-msg">'+t("busErr")+'</div>'; return; }
// cache the resolved stop so every future poll skips the
// coordinate-lookup call entirely (see quota note above)
if(d.extId && !state.busId){ state.busId=String(d.extId); save(); }
$("busHead").textContent = d.stop || "Departures";
var deps = d.departures || [];
if(!deps.length){ $("busList").innerHTML = '<div class="bus-msg">'+t("noBus")+'</div>'; return; }
var html = deps.slice(0,8).map(function(dep){
var hhmm = (dep.time || "").slice(0,5);
var mins = minsUntil(dep.date, dep.time);
var when = (mins!=null && mins<=20) ? (mins<=0? t("now") : mins+" "+t("min")) : hhmm;
return '<div class="dep">'+modeIcon(dep.mode)+'<span class="ln">'+esc(dep.line)+'</span><span class="dst">'+esc(dep.dir)+'</span><span class="tm">'+esc(when)+'</span></div>';
}).join("");
$("busList").innerHTML = html;