-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
1168 lines (1033 loc) · 53.5 KB
/
Copy pathindex.html
File metadata and controls
1168 lines (1033 loc) · 53.5 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="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5" />
<title>Ultra Skelly Web Controller</title>
<style>
:root { --bg:#0b0d10; --panel:#13161b; --muted:#6b7280; --text:#e5e7eb; --accent:#22d3ee; --ok:#10b981; --warn:#f59e0b; --err:#ef4444; }
* { box-sizing: border-box; }
:root{
--col-left: 360px;
--col-mid: 420px; /* <- wider middle column */
}
body { margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; background: var(--bg); color: var(--text); overflow-x: hidden; }
header { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid #1f242c; position:sticky; top:0; background:rgba(11,13,16,.8); backdrop-filter: blur(6px); z-index:10; }
h1 { font-size:18px; margin:0; letter-spacing:.4px; }
.btn { border:1px solid #2a3039; background:#151a21; color:var(--text); padding:10px 14px; border-radius:12px; cursor:pointer; font-weight:600; transition:.15s transform, .15s background, .15s border; }
.btn:hover { background:#1b212a; }
.btn:active { transform: scale(.98); }
.btn.primary { border-color:#134e55; background:#07333a; color:#a5f3fc; }
.btn.primary:hover { background:#0a4048; }
.btn.danger { border-color:#5d1b1b; background:#2a0f10; color:#fecaca; }
.btn.xs, .btn.sm { padding:6px 8px; font-size:12px; border-radius:10px; }
/* ======= 3-COLUMN LAYOUT ======= */
.grid{
display:grid;
grid-template-columns: var(--col-left) var(--col-mid) 1fr; /* left | middle | right */
gap:10px;
padding:20px;
align-items: start; /* items flow naturally, no stretching */
}
/* Column containers */
.col-left, .col-mid, .col-right {
display: flex;
flex-direction: column;
gap: 10px;
}
/* Legacy area classes for backwards compatibility */
.area-dev{ grid-column: 1; }
.area-status{ grid-column: 1; }
.area-live{ grid-column: 2; }
.area-transfer{ grid-column: 3; }
.area-files{ grid-column: 3; }
.area-log{ grid-column: 3; }
.move-grid { display:flex; gap:.75rem; align-items:center; justify-content:center; }
.iconToggle { border:2px solid transparent; border-radius:12px; padding:6px; background:transparent; cursor:pointer; opacity:.7 }
.iconToggle.selected { border-color:var(--accent, #7aa7ff); opacity:1; box-shadow:0 0 0 2px rgba(0,0,0,.04) }
.iconToggle img { width:42px; height:42px; display:block; }
.card { background:var(--panel); border:1px solid #1f242c; border-radius:16px; padding:16px; }
.card h2 { margin:0 0 10px; font-size:14px; color:#9ca3af; text-transform:uppercase; letter-spacing:.12em; }
label { display:block; font-size:12px; color:#9ca3af; margin:10px 0 6px; }
input, select, textarea { width:100%; background:#0f1318; color:var(--text); border:1px solid #28303a; border-radius:10px; padding:10px 12px; outline:none; }
input:focus, select:focus, textarea:focus { border-color:#2dd4bf; }
.row { display:flex; gap:10px; }
.row > * { flex:1; }
.pill { display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius:999px; border:1px solid #28303a; color:#a7f3d0; background:#0a2a27; font-size:12px; }
.muted { color:var(--muted); }
.log { height:360px; overflow:auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background:#0b0f14; border-radius:12px; padding:12px; border:1px solid #1f242c; }
.log .line { white-space: pre-wrap; word-break: break-word; margin: 0 0 6px; }
.log .rx { color:#93c5fd; }
.log .tx { color:#a7f3d0; }
.log .warn { color:#fbbf24; }
.small { font-size:12px; }
.actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.spacer { height:8px; }
footer { padding: 10px 20px; color:#6b7280; font-size:12px; border-top:1px solid #1f242c; }
/* Topbar: keep controls compact and pinned to right */
#btnAdvanced { white-space: nowrap; padding: 8px 10px; }
.topbar-right { display:flex; align-items:center; gap:8px; margin-left:auto; flex-wrap:nowrap; }
.menuwrap { position:relative; margin-left:0; display:inline-block; }
.dropdown { position:absolute; right:0; top:38px; background:#0f1318; border:1px solid #28303a; border-radius:12px; min-width:240px; padding:10px; z-index:50; box-shadow:0 10px 30px rgba(0,0,0,.35); }
.dropdown label { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:12px; color:#d1d5db; }
.dropdown input[type=checkbox] { width:auto; }
/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { display:inline-block; width:16px; height:16px; border:2px solid #28303a; border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; vertical-align:middle; }
.spinner-lg { width:40px; height:40px; border-width:3px; }
/* Progress */
.progress { height: 10px; background:#0f1318; border:1px solid #28303a; border-radius:999px; overflow:hidden; }
.bar { height:100%; width:0%; background: linear-gradient(90deg, #22d3ee, #10b981); transition: width .15s; }
.capsule { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:8px; font-size:12px; color:#a7f3fc; }
/* Files table */
.tablewrap { border:1px solid #1f242c; border-radius:12px; overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; }
thead th { position:sticky; top:0; background:#0f1318; color:#a5b4fc; text-align:left; padding:10px; border-bottom:1px solid #1f242c; }
tbody td { padding:8px 10px; border-bottom:1px solid #1f242c; }
tbody tr:hover { background:#0f1216; }
/* Modals & modals */
.hidden { display:none !important; }
.modal { position:fixed; inset:0; background:rgba(0,0,0,.75); display:flex; align-items:center; justify-content:center; z-index:9999; padding: 20px; }
.modal-panel { width:min(820px, 92vw); max-height:calc(100vh - 40px); background:#1b0d0d; border:2px solid #7f1d1d; color:#fecaca; border-radius:16px; padding:22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow-y:auto; }
.modal-panel h3 { margin:0 0 8px; font-size:22px; color:#fecaca; }
.modal-panel p { margin:8px 0; line-height:1.5; }
.modal-actions { display:flex; gap:10px; margin-top:16px; justify-content:flex-end; }
/* Edit modal specific: wider number inputs */
#editModal input[type="number"] {
width: 70px;
min-width: 70px;
flex: 0 0 70px !important;
}
/* Movement icons */
.iconToggle {
border:2px solid transparent; border-radius:12px; padding:6px;
background:transparent; cursor:pointer; opacity:.8; transition:.15s;
}
.iconToggle:hover { opacity:1; }
.iconToggle.selected{
border-color:#3b82f6; /* blue-500 border */
background:rgba(59,130,246,.12); /* faint blue fill */
box-shadow:0 0 0 2px rgba(59,130,246,.08);
}
/* Light group boxes */
.light-group {
border: 1px solid #28303a;
border-radius: 12px;
padding: 12px;
margin-top: 12px;
background: rgba(15, 19, 24, 0.5);
}
.light-group h3 {
margin: 0 0 8px 0;
font-size: 13px;
color: #22d3ee;
text-transform: uppercase;
letter-spacing: 0.1em;
font-weight: 600;
}
/* Side-by-side light controls */
.lights-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-top: 12px;
}
/* Compact control rows */
.compact-row {
display: flex;
gap: 6px;
align-items: center;
margin-top: 8px;
}
.compact-row label {
margin: 0;
font-size: 11px;
min-width: 75px;
}
.compact-row input[type="range"] {
flex: 1;
min-width: 0;
}
.compact-row input[type="number"] {
width: 70px;
flex: 0 0 70px;
}
.compact-row input[type="color"] {
width: 36px;
height: 32px;
flex: 0 0 36px;
}
.compact-row select {
flex: 1;
min-width: 0;
}
@media (max-width: 600px) {
.lights-grid {
grid-template-columns: 1fr;
}
}
/* Segmented control for color scope */
.seg{display:inline-flex; gap:0}
.seg-btn{
padding:.45rem .7rem; border:1px solid #d1d5db; background:#fff;
font-size:.9rem; border-right:none; cursor:pointer
}
.seg-btn:first-child{border-top-left-radius:8px;border-bottom-left-radius:8px}
.seg-btn:last-child{border-right:1px solid #d1d5db;border-top-right-radius:8px;border-bottom-right-radius:8px}
.seg-btn.selected{border-color:#3b82f6;background:rgba(59,130,246,.12);color:#1f2937}
/* Eye previews */
.eye-thumb { width:22px; height:22px; object-fit:contain; vertical-align:middle; margin-right:6px; image-rendering: crisp-edges; }
/* Eye pickers */
.eye-grid { display:grid; grid-template-columns: repeat(6, 36px); gap:8px; margin-top:8px; }
#apEyeGrid { grid-template-columns: repeat(6, 36px); gap:8px; justify-content:center; } /* 6 per row for the live card */
.eye-opt { border:1px solid #28303a; background:#0f1318; border-radius:8px; padding:4px; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.eye-opt.selected { outline:2px solid var(--accent); }
/* Disconnected state: dim + disable most cards except Log */
body.disconnected .grid .card { opacity:.6; pointer-events:none; }
body.disconnected .area-log.card { opacity:1; pointer-events:auto !important; }
body.disconnected #status { color: var(--err); }
/* Sliders */
input[type=range]{ width:100%; }
/* Responsive fallbacks (stack on narrower screens) */
@media (max-width:1200px){
.grid{
grid-template-columns: 1fr;
}
}
/* === Form + checkbox cleanup === */
label { line-height: 1.25; }
input, select, textarea { font-size: 14px; line-height: 1.2; }
/* Reusable inline checkbox row */
.checkline{
display:flex; align-items:center; gap:8px;
margin-top: 8px;
}
.checkline.small { font-size:12px; color:#d1d5db; }
.checkline input[type="checkbox"]{
width:18px; height:18px; flex:0 0 auto; accent-color: var(--accent);
border-radius:4px;
}
input[type="checkbox"]:focus-visible{
outline:2px solid var(--accent); outline-offset:2px;
}
/* Utility margins to replace inline style attributes */
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
/* Color inputs a bit bigger for finger tapping */
input[type="color"]{
width: 44px; height: 36px; padding: 0; border-radius: 8px; border:1px solid #28303a;
}
/* Buttons: consistent touch targets */
.btn{ touch-action: manipulation; }
@media (pointer:coarse){
.btn { padding:12px 14px; border-radius:14px; min-height: 40px; }
input, select, textarea { padding:12px 14px; }
.iconToggle img { width:48px; height:48px; }
}
/* Rows wrap gracefully on small screens */
.row { flex-wrap: wrap; }
/* Make the log height adaptive (good on phones) */
.log { height: clamp(220px, 32vh, 360px); }
/* Tables: make scroll more obvious on mobile */
.tablewrap { -webkit-overflow-scrolling: touch; }
/* Dropdown menu spacing on mobile */
.dropdown label{ display:flex; align-items:center; gap:8px; }
/* Modals breathe on small screens */
.modal-panel { width:min(780px, 94vw); }
/* Fine-tune the file/live grids for phone widths */
@media (max-width: 600px){
:root{ --col-left: 1fr; --col-mid: 1fr; }
.grid{
grid-template-columns: 1fr;
padding: 10px;
gap: 12px;
}
#apEyeGrid{ grid-template-columns: repeat(6, 36px); }
/* Make cards fill width on mobile */
.card { padding: 12px; border-radius: 12px; }
/* Compact header on mobile */
header { padding: 12px 10px; flex-wrap: wrap; gap: 8px; }
h1 { font-size: 16px; }
/* Stack topbar controls on mobile if needed */
.topbar-right { gap: 6px; }
.btn { font-size: 13px; padding: 8px 12px; }
/* Make tables scroll horizontally */
.tablewrap {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
max-width: 100%;
}
/* Adjust actions to wrap better */
.actions { gap: 6px; }
/* Make filter input responsive */
#filesFilter { max-width: 100% !important; min-width: 0; flex: 1; }
/* Smaller modal panels on mobile */
.modal-panel {
width: calc(100vw - 20px);
max-height: calc(100vh - 20px);
padding: 16px;
}
}
/* Additional breakpoint for tablets and medium screens */
@media (max-width: 1200px){
.grid{
grid-template-columns: 1fr;
}
:root{ --col-left: 100%; --col-mid: 100%; }
}
/* Fix checkbox baseline weirdness inside “Advanced” and others */
.dropdown input[type="checkbox"],
#slowModal input[type="checkbox"],
#riskModal input[type="checkbox"]{
margin: 0; transform: translateY(0); /* prevents baseline misalignment */
}
/* Outline inputs when the chosen name already exists on device */
.warn-border { border-color: var(--warn) !important; box-shadow: 0 0 0 2px rgba(245,158,11,.18); }
/* Subcard (used for upcoming features) */
.subcard{
border:1px dashed #28303a; background:#0f1216; border-radius:12px; padding:12px;
}
.subcard-head{ margin-bottom:6px; color:#c7d2fe; }
.subcard.upcoming{ opacity:.9; }
footer {
display: flex;
align-items: center;
gap: 12px; /* spacing between the two spans */
}
footer span:last-child {
margin-left: auto; /* shove the last span to the right */
text-align: right;
}
/* optional, keep the link on brand */
footer a { color: var(--accent); }
</style>
<script defer src="https://cdn.jsdelivr.net/npm/lamejs@1.2.1/lame.min.js"></script>
</head>
<body>
<!-- First-load warning -->
<div id="riskModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="riskTitle">
<div class="modal-panel">
<h3 id="riskTitle">⚠️ Proceed at your own risk</h3>
<p>This tool talks directly to your skeleton over Bluetooth and can send file and control commands. While many features have been tested, there is <strong>NO GUARANTEE</strong> this won’t misbehave or damage your device. By continuing, you accept all risk.</p>
<p class="muted">Use a fully charged device, keep the browser tab focused during transfers, and avoid interrupting power.</p>
<div class="modal-actions">
<button type="button" id="riskCancel" class="btn">Leave page</button>
<button type="button" id="riskAccept" class="btn danger">I understand — continue</button>
</div>
</div>
</div>
<!-- File overwrite confirmation modal -->
<div id="overwriteModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="overwriteTitle" style="z-index:10001">
<div class="modal-panel">
<h3 id="overwriteTitle">⚠️ File Already Exists</h3>
<p id="overwriteMessage">A file with this name already exists on the device.</p>
<p class="muted">Overwriting will replace the existing file. This action cannot be undone.</p>
<div class="modal-actions">
<button type="button" id="overwriteCancel" class="btn">Cancel</button>
<button type="button" id="overwriteConfirm" class="btn danger">Overwrite File</button>
</div>
</div>
</div>
<!-- Device type change confirmation modal -->
<div id="deviceTypeChangeModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="deviceTypeChangeTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;max-width:480px;">
<h3 id="deviceTypeChangeTitle">⚠️ Change Device Type?</h3>
<p id="deviceTypeChangeMsgDetail"></p>
<p>Using the wrong device type while connected can send incorrect commands and have unforeseen consequences. Only change this if you know the connected device matches the new type.</p>
<div class="modal-actions">
<button type="button" id="deviceTypeChangeCancel" class="btn">Cancel</button>
<button type="button" id="deviceTypeChangeConfirm" class="btn danger">Change Anyway</button>
</div>
</div>
</div>
<!-- Connection options modal -->
<div id="connectModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="connectTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;max-width:520px;">
<h3 id="connectTitle">Connect to Device</h3>
<!-- Connection Type -->
<div style="margin: 16px 0;">
<p style="margin-bottom: 12px; font-weight: 500;">Connection Type:</p>
<!-- Web Bluetooth Warning -->
<div id="webBluetoothWarning" style="display: none; margin-bottom: 12px; padding: 10px; background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 6px; font-size: 12px; color: #fca5a5;">
⚠️ <strong>Web Bluetooth not available.</strong> Direct BLE connection is not supported in this browser or context. Use the REST Server Proxy instead.
</div>
<div style="display: grid; grid-template-columns: 18px auto; gap: 8px; align-items: center; margin-bottom: 8px;">
<input type="radio" name="connectionType" id="connectionTypeDirect" value="direct" checked style="margin: 0; width: 18px;">
<label for="connectionTypeDirect" id="connectionTypeDirectLabel" style="cursor: pointer; white-space: nowrap; margin: 0;">Direct BLE Connection</label>
</div>
<div style="display: grid; grid-template-columns: 18px auto; gap: 8px; align-items: center; margin-bottom: 8px;">
<input type="radio" name="connectionType" id="connectionTypeRest" value="rest" style="margin: 0; width: 18px;">
<label for="connectionTypeRest" style="cursor: pointer; white-space: nowrap; margin: 0;">REST Server Proxy</label>
</div>
<div id="restUrlContainer" style="margin-left: 26px; margin-top: 8px; display: none;">
<label for="restServerUrl" style="font-size: 11px; color: #9ca3af;">REST Server URL:</label>
<input id="restServerUrl" type="text" placeholder="http://localhost:8765" value="http://localhost:8765" style="width: 100%; margin-top: 4px;" />
<p style="font-size: 11px; color: #6b7280; margin-top: 4px;">
For browsers without Web Bluetooth. <a href="https://github.com/martinecker/SkellyUltra/tree/main/custom_components/skelly_ultra/skelly_ultra_srv" target="_blank" style="color: #3b82f6;">Setup guide</a>
</p>
<p style="font-size: 11px; color: #f59e0b; margin-top: 4px; padding: 8px; background: rgba(245, 158, 11, 0.1); border-radius: 4px;">
⚠️ <strong>Important:</strong> If this page is served over HTTPS, you must use an HTTPS REST server URL or open this page via <code style="background: rgba(0,0,0,0.3); padding: 2px 4px; border-radius: 2px;">file://</code> protocol. Mixed HTTP/HTTPS content is blocked by browsers.
</p>
</div>
</div>
<hr style="border: 0; border-top: 1px solid #273449; margin: 16px 0;">
<!-- Device Filter -->
<div style="margin: 16px 0;">
<p style="margin-bottom: 12px; font-weight: 500;">Device Discovery:</p>
<!-- Filter by default name -->
<div style="display: grid; grid-template-columns: 18px auto; gap: 8px; align-items: center; margin-bottom: 6px;">
<input type="radio" name="connectFilter" id="connectFilterDefault" value="default" checked style="margin: 0; width: 18px;">
<label for="connectFilterDefault" style="cursor: pointer; white-space: nowrap; margin: 0;">Filter by default name</label>
</div>
<div style="margin-left: 26px; margin-bottom: 12px;">
<select id="connectDefaultDevice" style="width: 100%;">
<option value="skelly">Ultra Skelly v2 (new firmware)</option>
<option value="skelly_old">Animated Skelly (older firmware)</option>
<option value="lily">Lethal Lily</option>
</select>
</div>
<!-- All devices -->
<div style="display: grid; grid-template-columns: 18px auto; gap: 8px; align-items: center;">
<input type="radio" name="connectFilter" id="connectAllDevices" value="all" style="margin: 0; width: 18px;">
<label for="connectAllDevices" style="cursor: pointer; white-space: nowrap; margin: 0;">All devices</label>
</div>
</div>
<div class="modal-actions">
<button type="button" id="connectCancel" class="btn">Cancel</button>
<button type="button" id="connectOk" class="btn primary">Connect</button>
</div>
</div>
</div>
<!-- Device Selection Modal (for REST proxy) -->
<div id="deviceSelectModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="deviceSelectTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;max-width:520px;">
<h3 id="deviceSelectTitle">Select Device</h3>
<p id="deviceSelectStatus">Scanning for devices...</p>
<div id="deviceList" style="margin: 20px 0; max-height: 300px; overflow-y: auto;">
<!-- Device list will be populated here -->
</div>
<div class="modal-actions">
<button type="button" id="deviceSelectCancel" class="btn">Cancel</button>
<button type="button" id="deviceSelectRescan" class="btn">Rescan</button>
</div>
</div>
</div>
<!-- Slow upload heads-up -->
<div id="slowModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="slowTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;">
<h3 id="slowTitle">Heads up: File sending can be slow</h3>
<p>
Large transfers over Bluetooth can take a while. After the file finishes uploading,
the device may take a couple minutes before you see the final “complete” message.
Converting the file can greatly speed up the process.
</p>
<p class="muted" style="margin-top:6px">
Keep this tab focused and avoid disconnecting power during the process.
</p>
<label class="small checkline mt-10">
<input id="slowDontShow" type="checkbox"> Don’t show this again
</label>
<div class="modal-actions">
<button type="button" id="slowCancel" class="btn">Cancel</button>
<button type="button" id="slowOk" class="btn primary">Continue</button>
</div>
</div>
</div>
<!-- Long track heads-up -->
<div id="longModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="longTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;">
<h3 id="longTitle">Heads up: long audio</h3>
<p>
Uploading tracks longer than 30 seconds is experimental and may be unreliable.
You can still proceed, but results aren’t guaranteed.
</p>
<label class="small checkline" style="margin-top:10px">
<input id="longDontShow" type="checkbox"> Don’t show this again
</label>
<div class="modal-actions">
<button type="button" id="longOk" class="btn primary">OK</button>
</div>
</div>
</div>
<!-- Unknown firmware version warning -->
<div id="fwWarningModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="fwWarningTitle">
<div class="modal-panel" style="background:#101318;border-color:#92400e;color:#fde68a;max-width:520px;">
<h3 id="fwWarningTitle">⚠️ Untested firmware version</h3>
<p>Connected firmware version <strong id="fwWarningVersion"></strong> has not been tested with this app.</p>
<p>Tested versions: <strong>Ultra Skelly v66, v68</strong> · <strong>Lethal Lily v24</strong>.</p>
<p>Per-file settings (lights, eye, movement) may not save correctly. Proceed with caution.</p>
<div class="modal-actions">
<button type="button" id="fwWarningOk" class="btn primary">OK, I understand</button>
</div>
</div>
</div>
<!-- Edit file modal -->
<!-- Transfer Modal -->
<div id="transferModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="transferModalTitle" style="z-index:10000">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;width:min(680px,92vw)">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px">
<h3 id="transferModalTitle" style="margin:0;color:#e5e7eb">Add File</h3>
<button type="button" class="btn" id="btnCloseTransferModal" style="padding:4px 10px">✕</button>
</div>
<div id="transferModalLockNotice" class="small muted hidden" style="margin-bottom:10px;padding:6px 10px;background:rgba(59,130,246,.1);border-radius:6px;border:1px solid rgba(59,130,246,.3)">
🔒 Filename is locked — uploading will replace the existing file.
</div>
<!-- Source selector -->
<label for="sourceSelect">Source</label>
<select id="sourceSelect">
<option value="local">Local file</option>
<option value="elevenlabs">ElevenLabs TTS</option>
</select>
<!-- Local file panel -->
<div id="panelLocalFile">
<label style="margin-top:10px">Choose file</label>
<input id="fileInput" type="file" />
</div>
<!-- ElevenLabs TTS panel -->
<div id="panelElevenLabs" class="hidden">
<label style="margin-top:10px">ElevenLabs API key</label>
<div style="display:flex; gap:8px; align-items:center">
<input id="elApiKey" type="password" placeholder="sk_…" style="flex:1" autocomplete="off" />
<button type="button" class="btn small" id="btnClearElApiKey">Clear key</button>
</div>
<label style="margin-top:10px">Model</label>
<select id="elModel">
<option value="eleven_turbo_v2_5">Turbo v2.5 (fast)</option>
<option value="eleven_multilingual_v2">Multilingual v2 (high quality)</option>
<option value="eleven_flash_v2_5">Flash v2.5 (fastest)</option>
</select>
<label style="margin-top:10px">Voice <span id="elVoiceStatus" class="small muted"></span></label>
<select id="elVoice" disabled>
<option value="">— enter API key to load voices —</option>
</select>
<label style="margin-top:10px">Text</label>
<textarea id="elText" rows="4" placeholder="Type what the device should say…" style="width:100%; box-sizing:border-box; resize:vertical"></textarea>
<div style="margin-top:8px">
<button type="button" class="btn small" id="btnPreviewTTS">🔊 Preview</button>
<button type="button" class="btn small" id="btnSaveTTS">💾 Save…</button>
</div>
</div>
<!-- Shared: convert + bitrate -->
<div style="display:flex; align-items:center; gap:16px; margin-top:12px; flex-wrap:wrap">
<label class="small checkline" style="margin:0">
<input id="chkConvert" type="checkbox" checked> Convert to device format (MP3, 8 kHz mono)
</label>
<label class="small checkline" style="margin:0">
<input id="chkBitrateOverride" type="checkbox"> Override bitrate
</label>
<div id="convertOpts" class="hidden" style="display:flex; align-items:center; gap:8px">
<select id="mp3Kbps" aria-label="MP3 bitrate">
<option value="16">16 kbps</option>
<option value="24">24 kbps</option>
<option value="32" selected>32 kbps</option>
<option value="64">64 kbps</option>
</select>
</div>
</div>
<!-- Shared: filename -->
<label style="margin-top:10px">Device filename</label>
<input id="fileName" placeholder="example.mp3" maxlength="33" />
<div class="spacer"></div>
<div style="display:flex; align-items:center; gap:10px; flex-wrap:wrap">
<label class="small checkline" style="margin:0">
<input id="chkChunkOverride" type="checkbox"> Override chunk size
</label>
<div id="chunkOverrideOpts" class="hidden" style="display:flex; align-items:center; gap:10px; flex:1; min-width:300px">
<input id="chunkSizeSlider" type="range" min="50" max="500" value="250" step="10" style="flex:1; min-width:150px" />
<span class="small" style="white-space:nowrap"><span id="chunkSizeValue">250</span> bytes</span>
</div>
</div>
<div class="small muted" style="margin-top:6px">
⚠️ If transfers fail frequently, try reducing the chunk size. Larger values may be faster but less reliable.
</div>
<div class="spacer"></div>
<div class="actions">
<button type="button" class="btn primary" id="btnSendFile">Send to Device</button>
<button type="button" class="btn danger" id="btnCancelFile" disabled>Cancel</button>
<button type="button" class="btn" id="btnCloseTransferModalBottom">Close</button>
</div>
<div class="capsule">
<div>Progress: <span id="progText">0 / 0</span></div>
<div id="progPct">0%</div>
</div>
<div class="progress"><div id="progBar" class="bar"></div></div>
</div>
</div>
<div id="editModal" class="modal hidden" role="dialog" aria-modal="true" aria-labelledby="editTitle">
<div class="modal-panel" style="background:#101318;border-color:#273449;color:#e5e7eb;">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px">
<h3 id="editTitle" style="margin:0;color:#e5e7eb">Edit File</h3>
<button type="button" class="btn" id="edCloseTop" style="padding:4px 10px">✕</button>
</div>
<div class="row">
<div style="flex:2">
<label>File name</label>
<input id="edName" placeholder="example.mp3" readonly>
</div>
<div style="flex:1">
<label>Serial #</label>
<input id="edSerial" disabled>
</div>
<div style="flex:1">
<label>Cluster</label>
<input id="edCluster" type="number" min="0" step="1" readonly>
</div>
</div>
<div class="spacer"></div>
<div class="row" style="align-items:start">
<div id="editEyeSection" style="flex:2">
<label>Eye Icon</label>
<div id="eyeGrid" class="eye-grid" aria-label="Choose eye icon"></div>
</div>
<div style="flex:1">
<label>Movement</label>
<div id="edMove" class="move-grid" style="gap:0.5rem">
<button type="button" class="iconToggle" data-part="all" title="All" style="padding:4px">
<img src="images/skelly/icon_action1.png" alt="All" style="width:32px;height:32px" />
</button>
<button type="button" class="iconToggle" data-part="head" title="Head" style="padding:4px">
<img src="images/skelly/icon_action2.png" alt="Head" style="width:32px;height:32px" />
</button>
<button type="button" class="iconToggle" data-part="arm" title="Arm" style="padding:4px">
<img src="images/skelly/icon_action3.png" alt="Arm" style="width:32px;height:32px" />
</button>
<button type="button" class="iconToggle" data-part="torso" title="Torso" style="padding:4px">
<img src="images/skelly/icon_action4.png" alt="Torso" style="width:32px;height:32px" />
</button>
</div>
</div>
</div>
<div class="spacer"></div>
<label>Lights</label>
<div class="row">
<!-- Head Light Group -->
<div id="editLight1Group" class="light-group" style="flex:1; margin-top:0">
<h3>Head Light</h3>
<label>Brightness (0–255)</label>
<div class="row">
<input id="edLight1BrightnessRange" type="range" min="0" max="255" value="200" />
<input id="edLight1Brightness" type="number" min="0" max="255" value="200" />
</div>
<div class="spacer"></div>
<label>Color</label>
<div class="row">
<input id="edLight1ColorPick" type="color" value="#ff0000" />
<input id="edLight1R" type="number" min="0" max="255" value="255" />
<input id="edLight1G" type="number" min="0" max="255" value="0" />
<input id="edLight1B" type="number" min="0" max="255" value="0" />
<button type="button" class="iconToggle" id="edLight1ColorCycle" title="Cycle all colors">
<img src="images/icon_light_cycle_no.png" alt="Cycle colors" style="width:24px;height:24px" />
</button>
</div>
<div class="spacer"></div>
<label>Effect Mode</label>
<select id="edLight1EffectMode" aria-label="Light 1 effect mode">
<option value="1">Static</option>
<option value="2">Strobe</option>
<option value="3">Pulsing</option>
</select>
<div class="spacer"></div>
<div id="edLight1EffectSpeedBlock">
<label>Effect Speed (0–254)</label>
<div class="row">
<input id="edLight1EffectSpeedRange" type="range" min="0" max="254" value="0" />
<input id="edLight1EffectSpeed" type="number" min="0" max="254" value="0" />
</div>
</div>
</div>
<!-- Torso Light Group -->
<div class="light-group" style="flex:1; margin-top:0">
<h3 id="editLight0Label">Torso Light</h3>
<label>Brightness (0–255)</label>
<div class="row">
<input id="edLight0BrightnessRange" type="range" min="0" max="255" value="200" />
<input id="edLight0Brightness" type="number" min="0" max="255" value="200" />
</div>
<div class="spacer"></div>
<label>Color</label>
<div class="row">
<input id="edLight0ColorPick" type="color" value="#0000ff" />
<input id="edLight0R" type="number" min="0" max="255" value="0" />
<input id="edLight0G" type="number" min="0" max="255" value="0" />
<input id="edLight0B" type="number" min="0" max="255" value="255" />
<button type="button" class="iconToggle" id="edLight0ColorCycle" title="Cycle all colors">
<img src="images/icon_light_cycle_no.png" alt="Cycle colors" style="width:24px;height:24px" />
</button>
</div>
<div class="spacer"></div>
<label>Effect Mode</label>
<select id="edLight0EffectMode" aria-label="Light 0 effect mode">
<option value="1">Static</option>
<option value="2">Strobe</option>
<option value="3">Pulsing</option>
</select>
<div class="spacer"></div>
<div id="edLight0EffectSpeedBlock">
<label>Effect Speed (0–254)</label>
<div class="row">
<input id="edLight0EffectSpeedRange" type="range" min="0" max="254" value="0" />
<input id="edLight0EffectSpeed" type="number" min="0" max="254" value="0" />
</div>
</div>
</div>
</div>
<div class="spacer"></div>
<div class="actions">
<button type="button" class="btn" id="btnReplaceFile">Replace File</button>
</div>
<div class="spacer"></div>
<label>Log</label>
<div id="edLog" class="log" style="height:180px;" aria-live="polite"></div>
<div class="spacer"></div>
<div class="modal-actions">
<button type="button" id="edDelete" class="btn danger">Delete</button>
<button type="button" id="edApplyAll" class="btn primary">Apply All Settings</button>
<button type="button" id="edClose" class="btn">Close</button>
</div>
</div>
</div>
<header>
<h1>🦴 Ultra Skelly Web Controller</h1>
<div class="topbar-right">
<span id="status" class="pill">● <span>Disconnected</span></span>
<button type="button" class="btn primary" id="btnConnect">Connect</button>
<button type="button" class="btn danger" id="btnDisconnect" disabled>Disconnect</button>
<div class="menuwrap">
<button type="button" class="btn" id="btnAdvanced">⚙️ Advanced ▾</button>
<div id="advMenu" class="dropdown hidden" role="menu" aria-label="Advanced options">
<label><input type="checkbox" id="advRaw"> Show "Raw Command"</label>
<label><input type="checkbox" id="advFEDC"> Show FEDC keepalives</label>
<label><input type="checkbox" id="advFileDetails"> Show File List Details</label>
</div>
</div>
</div>
</header>
<div class="grid">
<!-- LEFT COLUMN -->
<div class="col-left">
<!-- Device / Commands -->
<section class="card area-dev">
<h2>Device / Commands</h2>
<div class="compact-row">
<label>Device Type</label>
<select id="deviceTypeSelect" style="flex:1">
<option value="skelly">Ultra Skelly</option>
<option value="lily">Lethal Lily</option>
</select>
</div>
<div class="spacer"></div>
<div>
<label>Queries</label>
<div class="actions">
<button type="button" class="btn cmd" data-q="AAE0">Get Device Params</button>
<button type="button" class="btn cmd" data-q="AAE1">Get Live Mode</button>
<button type="button" class="btn cmd" data-q="AAE5">Get Volume</button>
<button type="button" class="btn cmd" data-q="AAE6">Get BT Name</button>
<button type="button" class="btn cmd" data-q="AAEE">Get Version</button>
<button type="button" class="btn cmd" data-q="AAD2">Get Capacity</button>
<button type="button" class="btn cmd" data-q="AAD1">Get File Order</button>
<button type="button" class="btn" id="btnGetAll" style="font-weight: bold; background: #4CAF50;">Get All</button>
</div>
</div>
<div class="spacer"></div>
<div>
<label>Commands</label>
<div class="compact-row">
<label>Device Name</label>
<input id="deviceNameInput" type="text" maxlength="22" placeholder="Ultra Skelly v2" style="flex:1; font-family:monospace;" />
<button type="button" class="btn" id="btnSetDeviceName">Set</button>
</div>
<div class="compact-row">
<label>PIN</label>
<input id="pinInput" type="text" inputmode="numeric" maxlength="4" pattern="[0-9]{4}" placeholder="0000" style="width:80px; text-align:center; font-family:monospace;" />
<button type="button" class="btn" id="btnSetPin">Set PIN</button>
</div>
</div>
<!-- Raw Command (advanced) -->
<div class="spacer"></div>
<div id="advRawBlock" class="hidden">
<label>Raw Command (hex after AA+TAG+payload[≤8B]+CRC8 auto)</label>
<div class="row">
<select id="tag">
<option value="AAE0">AAE0 (Query Device Params)</option>
<option value="AAE1">AAE1 (Query Live Status)</option>
<option value="AAE5">AAE5 (Query Volume)</option>
<option value="AAE6">AAE6 (Query Classic BT Name)</option>
<option value="AAEE">AAEE (Query Version)</option>
<option value="AAD0">AAD0 (Query File List)</option>
<option value="AAD1">AAD1 (Query File Order)</option>
<option value="AAD2">AAD2 (Query Remaining Capacity)</option>
<option value="AAFA">AAFA (Set Volume)</option>
<option value="AAFC">AAFC (Play/Pause)</option>
<option value="AAFD">AAFD (Enable Live Audio)</option>
<option value="AAF2">AAF2 (Set Light Effect Mode)</option>
<option value="AAF3">AAF3 (Set Light Brightness)</option>
<option value="AAF4">AAF4 (Set Light RGB+Color Cycle)</option>
<option value="AAF6">AAF6 (Set Light Effect Speed)</option>
<option value="AAF9">AAF9 (Set Eye Icon)</option>
<option value="AAC0">AAC0 (Start Data Transfer)</option>
<option value="AAC1">AAC1 (Send Data Chunk)</option>
<option value="AAC2">AAC2 (End Data Transfer)</option>
<option value="AAC3">AAC3 (Commit File Transfer)</option>
<option value="AAC4">AAC4 (Cancel Data Transfer)</option>
<option value="AAC6">AAC6 (Play/Pause File)</option>
<option value="AAC7">AAC7 (Delete File)</option>
<option value="AAC9">AAC9 (Set File Order)</option>
<option value="AACA">AACA (Set Movement Action)</option>
</select>
<input id="payload" placeholder="payload hex (optional)" />
</div>
<div class="actions"><button type="button" class="btn" id="btnSendRaw">Send</button></div>
<div class="small muted" style="margin-top:6px">Payload auto-pads to <strong>16 hex chars (8 bytes)</strong> before CRC8 (poly 0x8C).</div>
</div>
</section>
<!-- Status -->
<section class="card area-status">
<h2>Current Status</h2>
<div style="display:grid; grid-template-columns:1fr 1fr; gap:8px 24px">
<div><div class="muted">Device Name</div><div id="statName">—</div></div>
<div><div class="muted">Firmware Version</div><div id="statVersion">—</div></div>
<div><div class="muted">Classic BT Name</div><div id="statBtName">—</div></div>
<div><div class="muted">Show Mode</div><div id="statShowMode">—</div></div>
<div><div class="muted">Capacity</div><div id="statCapacity">—</div></div>
<div><div class="muted">Channels</div><div id="statChannels">—</div></div>
<div><div class="muted">File Count</div><div id="statFileCount">—</div></div>
<div><div class="muted">PIN</div><div id="statPin">—</div></div>
<div><div class="muted">File Order by Serial</div><div id="statOrder">—</div></div>
</div>
</section>
</div>
<!-- MIDDLE COLUMN -->
<div class="col-mid">
<!-- Live Mode -->
<section class="card area-live">
<h2>Live Mode</h2>
<div class="actions">
<button type="button" class="btn" id="btnBT">Enable Live Mode</button>
</div>
<!-- Volume -->
<div class="compact-row">
<label>Volume</label>
<input id="volRange" type="range" min="0" max="100" value="50" />
<input id="vol" type="number" min="0" max="100" value="50" />
</div>
<div class="spacer"></div>
<label>Movement</label>
<div id="liveMove" class="move-grid">
<button type="button" class="iconToggle" data-part="all" title="All">
<img src="images/skelly/icon_action1.png" alt="All" />
</button>
<button type="button" class="iconToggle" data-part="head" title="Head">
<img src="images/skelly/icon_action2.png" alt="Head" />
</button>
<button type="button" class="iconToggle" data-part="arm" title="Arm">
<img src="images/skelly/icon_action3.png" alt="Arm" />
</button>
<button type="button" class="iconToggle" data-part="torso" title="Torso">
<img src="images/skelly/icon_action4.png" alt="Torso" />
</button>
</div>
<div class="spacer"></div>
<div id="liveEyeSection">
<label>Eyes</label>
<div id="apEyeGrid" class="eye-grid" aria-label="Choose eye icon"></div>
</div>
<!-- Head Light Controls -->
<div id="liveLight1Group" class="light-group">
<h3>Head Light</h3>
<div class="compact-row">
<label>Brightness</label>
<input id="light1BrightnessRange" type="range" min="0" max="255" value="200" />
<input id="light1Brightness" type="number" min="0" max="255" value="200" />
</div>
<div class="compact-row">
<label>Color</label>
<input id="light1ColorPick" type="color" value="#ff0000" />
<input id="light1R" type="number" min="0" max="255" value="255" />
<input id="light1G" type="number" min="0" max="255" value="0" />
<input id="light1B" type="number" min="0" max="255" value="0" />
</div>
<div style="display:flex; align-items:center; gap:6px; margin-top:8px;">
<button type="button" class="iconToggle" id="btnLight1ColorCycle" title="Cycle all colors" style="padding:4px;">
<img src="images/icon_light_cycle_no.png" alt="Cycle colors" style="width:28px;height:28px" />
</button>
<span class="small muted">Cycle</span>
</div>
<div class="compact-row">
<label>Effect</label>
<select id="light1EffectMode" aria-label="Light 1 effect mode">
<option value="1">Static</option>
<option value="2">Strobe</option>
<option value="3">Pulsing</option>
</select>
</div>
<div id="light1EffectSpeedBlock" class="compact-row hidden">
<label>Speed</label>
<input id="light1EffectSpeedRange" type="range" min="0" max="254" value="0" />
<input id="light1EffectSpeed" type="number" min="0" max="254" value="0" />
</div>
</div>
<!-- Torso Light Controls -->
<div class="light-group">
<h3 id="liveLight0Label">Torso Light</h3>
<div class="compact-row">
<label>Brightness</label>
<input id="light0BrightnessRange" type="range" min="0" max="255" value="200" />
<input id="light0Brightness" type="number" min="0" max="255" value="200" />
</div>
<div class="compact-row">
<label>Color</label>
<input id="light0ColorPick" type="color" value="#ff0000" />
<input id="light0R" type="number" min="0" max="255" value="255" />
<input id="light0G" type="number" min="0" max="255" value="0" />