-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
5266 lines (4651 loc) · 181 KB
/
content.js
File metadata and controls
5266 lines (4651 loc) · 181 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
(function() {
'use strict';
if (window.cinemaModeUltimateLoaded) {
chrome.runtime.onMessage.addListener((msg) => {
if (msg.action === 'toggleCinemaMode' && !document.getElementById('cmu-overlay')) {
window.toggleCinemaMode();
}
});
return;
}
window.cinemaModeUltimateLoaded = true;
// 🔧 CONSTANTS - IDs, Classes, Icons
const OVERLAY_ID = 'cmu-overlay';
const CONTROLS_ID = 'cmu-controls-container';
const SHORTS_CONTROLS_ID = 'cmu-shorts-controls-container';
const SETTINGS_ID = 'cmu-settings-panel';
const AMBIANCE_ID = 'cmu-ambiance-canvas';
const STYLES_ID = 'cmu-styles';
const ACTIVE_VIDEO_CLASS = 'cmu-active-video';
const SHORTCUT_GUIDE_ID = 'cmu-shortcut-guide';
const YOUTUBE_LOGO_ID = 'cmu-youtube-logo';
const AUDIO_MODE_CONTAINER_ID = 'cmu-audio-mode-container';
const AUDIO_COVER_ID = 'cmu-audio-cover';
const ICONS = {
play: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M8 5v14l11-7z"></path></svg>`,
pause: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"></path></svg>`,
volumeHigh: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></path></svg>`,
volumeMute: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"></path></svg>`,
settings: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61-.25-1.17-.59-1.69-.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19-.15-.24-.42-.12-.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.58 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></svg>`,
close: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></svg>`,
fullscreen: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"></path></svg>`,
ambianceOn: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M12 6c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6 2.69-6 6-6m0-2c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8z"></path></svg>`,
ambianceOff: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></svg>`,
nextTrack: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M16 6h2v12h-2zm-4.5 6L4 6v12l7.5-6z"></path></svg>`,
prevTrack: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M6 6h2v12H6zm3.5 6l8.5 6V6l-8.5 6z"></path></svg>`,
lyrics: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M4 6h16v2H4zm0 5h16v2H4zm0 5h10v2H4z"></path></svg>`,
audioMode: `<svg width="24" height="24" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet"><path fill="currentColor" d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"></path></svg>`,
};
// 🎨 UI THEMES - Catégories et Définitions
const THEME_CATEGORIES = {
focus: { name: 'Focus & Productivité', icon: '🧠' },
immersive: { name: 'Immersif & Cinématographique', icon: '🎬' },
expressive: { name: 'Artistique & Expressif', icon: '🎭' },
custom: { name: 'Personnalisé', icon: '🎨' },
};
// Complete UI Themes - every theme follows the same value schema for reliable inheritance
const UI_THEMES = {
// --- Focus & Productivité ---
light: {
name: 'Light (iOS Style)',
icon: '☀️',
category: 'focus',
isDark: false,
values: {
hue: 210,
menuOpacity: 0.95,
menuBlur: 18,
menuSaturation: 120,
menuBrightness: 105,
menuContrast: 115,
menuBorderOpacity: 0.12,
hideControlBar: false, controlBarOpacity: 0.60,
controlBarBlur: 22,
controlBarSaturation: 110,
controlBarBrightness: 105,
controlBarContrast: 115,
buttonShape: 'circle',
buttonBgOpacity: 0.08,
buttonBorderOpacity: 0.16,
buttonHoverBgOpacity: 0.16,
menuTextLightness: 12,
buttonTextLightness: 12,
menuHeadingLightness: 10,
},
// 🎨 Glassmorphism Settings (iOS Crystalline Style)
glassmorphism: {
enabled: true,
backgroundOpacity: 0.15, // Transparency of the glass
backdropBlur: 33, // Backdrop blur intensity (px)
backdropSaturate: 180, // Color saturation (%)
backdropBrightness: 120, // Brightness adjustment (%)
borderOpacity: 0.18, // Border shine opacity
shadowIntensity: 0.3, // Shadow depth
blendMode: 'overlay', // Background blend mode
},
progressGradient: 'linear-gradient(90deg, #0A84FF 0%, #64D2FF 50%, #B4E8FF 100%)',
progressShadow: 'rgba(10, 132, 255, 0.6)',
},
dark: {
name: 'Dark (macOS Style)',
icon: '🌙',
category: 'focus',
isDark: true,
values: {
hue: 220,
menuOpacity: 0.88,
menuBlur: 50,
menuSaturation: 140,
menuBrightness: 100,
menuContrast: 120,
menuBorderOpacity: 0.18,
hideControlBar: false, controlBarOpacity: 0.57,
controlBarBlur: 40,
controlBarSaturation: 130,
controlBarBrightness: 100,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.1,
buttonBorderOpacity: 0.18,
buttonHoverBgOpacity: 0.2,
menuTextLightness: 98,
buttonTextLightness: 98,
menuHeadingLightness: 92,
},
// 🎨 Glassmorphism Settings (macOS Big Sur Style)
glassmorphism: {
enabled: true,
backgroundOpacity: 0.1, // Very transparent glass
backdropBlur: 60, // Strong blur for macOS look
backdropSaturate: 180, // Rich colors
backdropBrightness: 100, // Normal brightness
borderOpacity: 0.2, // Subtle border shine
shadowIntensity: 0.4, // Deeper shadow
blendMode: 'normal', // macOS uses normal blend
},
progressGradient: 'linear-gradient(90deg, #0A52A0 0%, #6366F1 50%, #64A5FF 100%)',
progressShadow: 'rgba(99, 102, 241, 0.6)',
},
windows11: {
name: 'Windows 11 (Acrylic)',
icon: '🪟',
category: 'focus',
isDark: true,
values: {
hue: 220,
menuOpacity: 0.85,
menuBlur: 45,
menuSaturation: 150,
menuBrightness: 105,
menuContrast: 118,
menuBorderOpacity: 0.15,
hideControlBar: false,
controlBarOpacity: 0.55,
controlBarBlur: 35,
controlBarSaturation: 145,
controlBarBrightness: 105,
controlBarContrast: 118,
buttonShape: 'circle',
buttonBgOpacity: 0.11,
buttonBorderOpacity: 0.17,
buttonHoverBgOpacity: 0.21,
menuTextLightness: 96,
buttonTextLightness: 96,
menuHeadingLightness: 90,
},
// 🎨 Glassmorphism Settings (Windows 11 Acrylic Material)
glassmorphism: {
enabled: true,
backgroundOpacity: 0.2, // Slightly more opaque for Acrylic
backdropBlur: 50, // Medium blur
backdropSaturate: 150, // Enhanced saturation
backdropBrightness: 110, // Slightly brighter
borderOpacity: 0.15, // Subtle border
shadowIntensity: 0.35, // Balanced shadow
blendMode: 'overlay', // Acrylic blend effect
},
progressGradient: 'linear-gradient(90deg, #0078D4 0%, #50A0E8 50%, #90D0FF 100%)',
progressShadow: 'rgba(0, 120, 212, 0.6)',
},
studio: {
name: 'Studio',
icon: '🎙️',
category: 'focus',
isDark: true,
values: {
hue: 210,
menuOpacity: 0.98, // OPAQUE - environnement pro
menuBlur: 0, // Pas de flou - netteté pro
menuSaturation: 0, // Monochrome pro
menuBrightness: 85, // Éclairage studio
menuContrast: 140, // Contraste élevé pour lisibilité
menuBorderOpacity: 0.25, // Bordures nettes
hideControlBar: false,
controlBarOpacity: 0.95, // Barre opaque et fonctionnelle
controlBarBlur: 0, // Pas de flou
controlBarSaturation: 0,
controlBarBrightness: 90,
controlBarContrast: 135,
buttonShape: 'square', // Forme carrée pro
buttonBgOpacity: 0.15,
buttonBorderOpacity: 0.3,
buttonHoverBgOpacity: 0.35,
menuTextLightness: 95, // Texte contrasté
buttonTextLightness: 95,
menuHeadingLightness: 90,
},
progressGradient: 'linear-gradient(90deg, #404040 0%, #808080 50%, #C0C0C0 100%)',
progressShadow: 'rgba(128, 128, 128, 0.8)',
},
eink: {
name: 'E-Ink',
icon: '📰',
category: 'focus',
isDark: false,
values: {
hue: 0,
menuOpacity: 1.0, // OPAQUE - comme vrai e-ink
menuBlur: 0, // Pas de flou - netteté e-ink
menuSaturation: 0, // Noir et blanc pur
menuBrightness: 110, // Blanc papier
menuContrast: 200, // Contraste maximum type e-ink
menuBorderOpacity: 0.4, // Bordures noires nettes
hideControlBar: false,
controlBarOpacity: 1.0, // Barre totalement opaque
controlBarBlur: 0,
controlBarSaturation: 0,
controlBarBrightness: 115,
controlBarContrast: 200,
buttonShape: 'square', // Carrés nets type e-reader
buttonBgOpacity: 0.1, // Fond gris très léger
buttonBorderOpacity: 0.6, // Bordures marquées
buttonHoverBgOpacity: 0.2,
menuTextLightness: 0, // Noir pur
buttonTextLightness: 0,
menuHeadingLightness: 0,
},
progressGradient: 'linear-gradient(90deg, #000 0%, #333 50%, #666 100%)',
progressShadow: 'rgba(0, 0, 0, 0.8)',
},
// --- Immersif & Cinématographique ---
youtube: {
name: 'YouTube',
icon: '📺',
category: 'immersive',
isDark: true,
values: {
hue: 0,
menuOpacity: 0.15, // TRÈS transparent pour voir la vidéo
menuBlur: 60, // Flou fort pour effet glassmorphism
menuSaturation: 200, // Saturé pour l'identité YouTube
menuBrightness: 90,
menuContrast: 130,
menuBorderOpacity: 0.1, // Bordure très subtile
hideControlBar: false,
controlBarOpacity: 0.20, // Barre de contrôle très transparente
controlBarBlur: 80, // Flou maximal
controlBarSaturation: 200,
controlBarBrightness: 85,
controlBarContrast: 125,
buttonShape: 'circle',
buttonBgOpacity: 0.08, // Boutons très transparents
buttonBorderOpacity: 0.15,
buttonHoverBgOpacity: 0.25,
menuTextLightness: 100, // Texte blanc pur
buttonTextLightness: 100,
menuHeadingLightness: 100,
},
progressGradient: 'linear-gradient(90deg, #FF0000 0%, #FF4444 50%, #FF6B35 100%)',
progressShadow: 'rgba(255, 0, 0, 0.8)',
},
midnight: {
name: 'Midnight',
icon: '🤫',
category: 'immersive',
isDark: true,
values: {
hue: 240,
menuOpacity: 0.05, // Quasi-invisible pour immersion totale
menuBlur: 100, // Flou maximum
menuSaturation: 80, // Désaturé pour effet nocturne
menuBrightness: 60, // Très sombre
menuContrast: 110,
menuBorderOpacity: 0.03, // Bordure imperceptible
hideControlBar: true, // Barre cachée par défaut
controlBarOpacity: 0.08, // Ultra-transparent quand visible
controlBarBlur: 120, // Flou extrême
controlBarSaturation: 60,
controlBarBrightness: 50,
controlBarContrast: 100,
buttonShape: 'circle',
buttonBgOpacity: 0.03, // Boutons fantômes
buttonBorderOpacity: 0.06,
buttonHoverBgOpacity: 0.15,
menuTextLightness: 75, // Texte atténué
buttonTextLightness: 75,
menuHeadingLightness: 70,
},
progressGradient: 'linear-gradient(90deg, #1a1a3a 0%, #2a2a5a 50%, #3a3a6a 100%)',
progressShadow: 'rgba(42, 42, 90, 0.4)',
},
neon: {
name: 'Neon',
icon: '💜',
category: 'immersive',
isDark: true,
values: {
hue: 300,
menuOpacity: 0.95, // Plus opaque pour les néons
menuBlur: 15, // Flou réduit pour netteté néon
menuSaturation: 250, // Saturation extrême
menuBrightness: 120, // Très lumineux
menuContrast: 160, // Contraste élevé
menuBorderOpacity: 0.6, // Bordures néon visibles
hideControlBar: false,
controlBarOpacity: 0.85, // Barre bien visible
controlBarBlur: 12,
controlBarSaturation: 230,
controlBarBrightness: 115,
controlBarContrast: 150,
buttonShape: 'square', // Forme néon
buttonBgOpacity: 0.3, // Fond néon visible
buttonBorderOpacity: 0.7, // Bordures néon marquées
buttonHoverBgOpacity: 0.5,
menuTextLightness: 95, // Texte blanc éclatant
buttonTextLightness: 95,
menuHeadingLightness: 100,
},
progressGradient: 'linear-gradient(90deg, #FF00FF 0%, #00FFFF 50%, #39FF14 100%)',
progressShadow: 'rgba(255, 0, 255, 1.0)', // Ombre néon intense
},
dracula: {
name: 'Dracula',
icon: '🧛',
category: 'immersive',
isDark: true,
values: {
hue: 280,
menuOpacity: 0.94,
menuBlur: 18,
menuSaturation: 150,
menuBrightness: 90,
menuContrast: 135,
menuBorderOpacity: 0.25,
hideControlBar: false, controlBarOpacity: 0.63,
controlBarBlur: 18,
controlBarSaturation: 150,
controlBarBrightness: 90,
controlBarContrast: 130,
buttonShape: 'circle',
buttonBgOpacity: 0.2,
buttonBorderOpacity: 0.38,
buttonHoverBgOpacity: 0.32,
menuTextLightness: 97,
buttonTextLightness: 97,
menuHeadingLightness: 88,
},
progressGradient: 'linear-gradient(90deg, #BD93F9 0%, #FF79C6 50%, #FF92DF 100%)',
progressShadow: 'rgba(189, 147, 249, 0.6)',
},
synthwave: {
name: 'Synthwave',
icon: '🌴',
category: 'immersive',
isDark: true,
values: {
hue: 290,
menuOpacity: 0.86,
menuBlur: 18,
menuSaturation: 210,
menuBrightness: 92,
menuContrast: 130,
menuBorderOpacity: 0.22,
hideControlBar: true, controlBarOpacity: 0.52,
controlBarBlur: 22,
controlBarSaturation: 170,
controlBarBrightness: 90,
controlBarContrast: 120,
buttonShape: 'square',
buttonBgOpacity: 0.12,
buttonBorderOpacity: 0.3,
buttonHoverBgOpacity: 0.22,
menuTextLightness: 86,
buttonTextLightness: 86,
menuHeadingLightness: 90,
},
progressGradient: 'linear-gradient(90deg, #F92C86 0%, #FF6B9A 50%, #00FFFF 100%)',
progressShadow: 'rgba(249, 44, 134, 0.7)',
},
// --- Artistique & Expressif ---
aurora: {
name: 'Aurora',
icon: '🌌',
category: 'expressive',
isDark: true,
values: {
hue: 170,
menuOpacity: 0.72,
menuBlur: 60,
menuSaturation: 180,
menuBrightness: 98,
menuContrast: 125,
menuBorderOpacity: 0.18,
hideControlBar: false, controlBarOpacity: 0.62,
controlBarBlur: 52,
controlBarSaturation: 180,
controlBarBrightness: 98,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.16,
buttonBorderOpacity: 0.3,
buttonHoverBgOpacity: 0.26,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 98,
},
progressGradient: 'linear-gradient(90deg, #00FF9F 0%, #00BFFF 50%, #9370DB 100%)',
progressShadow: 'rgba(0, 191, 255, 0.6)',
},
gradient: {
name: 'Gradient',
icon: '🌈',
category: 'expressive',
isDark: true,
values: {
hue: 30,
menuOpacity: 0.8,
menuBlur: 44,
menuSaturation: 200,
menuBrightness: 100,
menuContrast: 125,
menuBorderOpacity: 0.2,
hideControlBar: false, controlBarOpacity: 0.45,
controlBarBlur: 32,
controlBarSaturation: 200,
controlBarBrightness: 100,
controlBarContrast: 125,
buttonShape: 'circle',
buttonBgOpacity: 0.16,
buttonBorderOpacity: 0.24,
buttonHoverBgOpacity: 0.26,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 98,
},
progressGradient: 'linear-gradient(90deg, #F89B29 0%, #FF4E50 50%, #C850C0 100%)',
progressShadow: 'rgba(255, 78, 80, 0.6)',
},
blueSky: {
name: 'Blue Sky',
icon: '☁️',
category: 'expressive',
isDark: true,
values: {
hue: 200,
menuOpacity: 0.64,
menuBlur: 78,
menuSaturation: 160,
menuBrightness: 102,
menuContrast: 120,
menuBorderOpacity: 0.18,
hideControlBar: false, controlBarOpacity: 0.64,
controlBarBlur: 64,
controlBarSaturation: 160,
controlBarBrightness: 102,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.16,
buttonBorderOpacity: 0.28,
buttonHoverBgOpacity: 0.26,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 98,
},
progressGradient: 'linear-gradient(90deg, #0080FF 0%, #00CED1 50%, #87CEEB 100%)',
progressShadow: 'rgba(0, 206, 209, 0.6)',
},
sunset: {
name: 'Sunset',
icon: '🌅',
category: 'expressive',
isDark: true,
values: {
hue: 25,
menuOpacity: 0.76,
menuBlur: 42,
menuSaturation: 190,
menuBrightness: 95,
menuContrast: 135,
menuBorderOpacity: 0.2,
hideControlBar: true, controlBarOpacity: 0.52,
controlBarBlur: 34,
controlBarSaturation: 180,
controlBarBrightness: 92,
controlBarContrast: 125,
buttonShape: 'circle',
buttonBgOpacity: 0.2,
buttonBorderOpacity: 0.32,
buttonHoverBgOpacity: 0.3,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 95,
},
progressGradient: 'linear-gradient(90deg, #FF6B35 0%, #FF5E78 50%, #9D4EDD 100%)',
progressShadow: 'rgba(255, 94, 120, 0.6)',
},
forest: {
name: 'Forest',
icon: '🌲',
category: 'expressive',
isDark: true,
values: {
hue: 140,
menuOpacity: 0.86,
menuBlur: 34,
menuSaturation: 150,
menuBrightness: 95,
menuContrast: 120,
menuBorderOpacity: 0.2,
hideControlBar: false, controlBarOpacity: 0.57,
controlBarBlur: 26,
controlBarSaturation: 150,
controlBarBrightness: 95,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.16,
buttonBorderOpacity: 0.28,
buttonHoverBgOpacity: 0.26,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 98,
},
progressGradient: 'linear-gradient(90deg, #228B22 0%, #7FFF00 50%, #ADFF2F 100%)',
progressShadow: 'rgba(127, 255, 0, 0.6)',
},
ocean: {
name: 'Ocean Deep',
icon: '🌊',
category: 'expressive',
isDark: true,
values: {
hue: 200,
menuOpacity: 0.9,
menuBlur: 36,
menuSaturation: 160,
menuBrightness: 95,
menuContrast: 130,
menuBorderOpacity: 0.22,
hideControlBar: true, controlBarOpacity: 0.54,
controlBarBlur: 34,
controlBarSaturation: 160,
controlBarBrightness: 94,
controlBarContrast: 125,
buttonShape: 'circle',
buttonBgOpacity: 0.16,
buttonBorderOpacity: 0.3,
buttonHoverBgOpacity: 0.26,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 95,
},
progressGradient: 'linear-gradient(90deg, #003366 0%, #0077BE 50%, #40E0D0 100%)',
progressShadow: 'rgba(0, 119, 190, 0.6)',
},
fire: {
name: 'Fire',
icon: '🔥',
category: 'expressive',
isDark: true,
values: {
hue: 18,
menuOpacity: 0.82,
menuBlur: 28,
menuSaturation: 210,
menuBrightness: 98,
menuContrast: 140,
menuBorderOpacity: 0.22,
hideControlBar: false, controlBarOpacity: 0.57,
controlBarBlur: 22,
controlBarSaturation: 200,
controlBarBrightness: 100,
controlBarContrast: 135,
buttonShape: 'circle',
buttonBgOpacity: 0.2,
buttonBorderOpacity: 0.32,
buttonHoverBgOpacity: 0.32,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 95,
},
progressGradient: 'linear-gradient(90deg, #8B0000 0%, #FF4500 50%, #FFD700 100%)',
progressShadow: 'rgba(255, 69, 0, 0.6)',
},
nature: {
name: 'Nature',
icon: '🌿',
category: 'expressive',
isDark: true,
values: {
hue: 120,
menuOpacity: 0.9,
menuBlur: 24,
menuSaturation: 140,
menuBrightness: 96,
menuContrast: 120,
menuBorderOpacity: 0.18,
hideControlBar: false, controlBarOpacity: 0.61,
controlBarBlur: 26,
controlBarSaturation: 135,
controlBarBrightness: 96,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.12,
buttonBorderOpacity: 0.22,
buttonHoverBgOpacity: 0.2,
menuTextLightness: 98,
buttonTextLightness: 98,
menuHeadingLightness: 94,
},
progressGradient: 'linear-gradient(90deg, #2E7D32 0%, #4CAF50 50%, #A5D6A7 100%)',
progressShadow: 'rgba(76, 175, 80, 0.6)',
},
hulk: {
name: 'Hulk',
icon: '💪',
category: 'expressive',
isDark: true,
values: {
hue: 120,
menuOpacity: 1.0, // COMPLÈTEMENT OPAQUE - force brute
menuBlur: 0, // Pas de flou - puissance directe
menuSaturation: 200, // Vert intense
menuBrightness: 100, // Couleur pure
menuContrast: 150, // Contraste puissant
menuBorderOpacity: 0.8, // Bordures marquées
hideControlBar: false,
controlBarOpacity: 0.95, // Barre puissante
controlBarBlur: 0,
controlBarSaturation: 190,
controlBarBrightness: 105,
controlBarContrast: 140,
buttonShape: 'square', // Forme brutale
buttonBgOpacity: 0.4, // Fond vert visible
buttonBorderOpacity: 0.6,
buttonHoverBgOpacity: 0.7,// Hover intense
menuTextLightness: 100, // Texte blanc pur
buttonTextLightness: 100,
menuHeadingLightness: 100,
},
progressGradient: 'linear-gradient(90deg, #00A86B 0%, #00FF41 50%, #7FFF00 100%)',
progressShadow: 'rgba(0, 255, 65, 1.0)',
},
sahara: {
name: 'Sahara',
icon: '🏜️',
category: 'expressive',
isDark: true,
values: {
hue: 35,
menuOpacity: 0.9, // Very opaque - desert warmth
menuBlur: 20,
menuSaturation: 140,
menuBrightness: 92,
menuContrast: 125,
menuBorderOpacity: 0.25,
hideControlBar: false, controlBarOpacity: 0.60,
controlBarBlur: 18,
controlBarSaturation: 135,
controlBarBrightness: 94,
controlBarContrast: 125,
buttonShape: 'circle',
buttonBgOpacity: 0.2,
buttonBorderOpacity: 0.32,
buttonHoverBgOpacity: 0.3,
menuTextLightness: 96,
buttonTextLightness: 96,
menuHeadingLightness: 92,
},
progressGradient: 'linear-gradient(90deg, #C19A6B 0%, #E6C68A 50%, #FFE4B5 100%)',
progressShadow: 'rgba(193, 154, 107, 0.6)',
},
auto: {
name: 'Auto',
icon: '🌓',
category: 'focus',
isDark: null, // Will be determined by time of day
auto: true, // Special flag for auto-switching
values: {
// These values will be dynamically set based on time
hue: 200,
menuOpacity: 0.85,
menuBlur: 40,
menuSaturation: 140,
menuBrightness: 100,
menuContrast: 120,
menuBorderOpacity: 0.18,
hideControlBar: false, controlBarOpacity: 0.455,
controlBarBlur: 35,
controlBarSaturation: 140,
controlBarBrightness: 100,
controlBarContrast: 120,
buttonShape: 'circle',
buttonBgOpacity: 0.12,
buttonBorderOpacity: 0.2,
buttonHoverBgOpacity: 0.2,
menuTextLightness: 95,
buttonTextLightness: 95,
menuHeadingLightness: 92,
},
progressGradient: 'linear-gradient(90deg, #0A84FF 0%, #64D2FF 50%, #B4E8FF 100%)',
progressShadow: 'rgba(10, 132, 255, 0.6)',
},
// --- Custom ---
custom: {
name: 'Custom',
icon: '🎨',
category: 'custom',
isDark: true,
customizable: true,
values: {
hue: 200,
menuOpacity: 0.7,
menuBlur: 40,
menuSaturation: 180,
menuBrightness: 100,
menuContrast: 100,
menuBorderOpacity: 0.15,
hideControlBar: false, controlBarOpacity: 0.65,
controlBarBlur: 30,
controlBarSaturation: 180,
controlBarBrightness: 100,
controlBarContrast: 100,
buttonShape: 'circle',
buttonBgOpacity: 0.12,
buttonBorderOpacity: 0.2,
buttonHoverBgOpacity: 0.2,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 97,
},
progressGradient: 'linear-gradient(90deg, hsl(var(--custom-hue), 70%, 50%) 0%, hsl(var(--custom-hue), 70%, 60%) 50%, hsl(var(--custom-hue), 70%, 70%) 100%)',
progressShadow: 'hsla(var(--custom-hue), 70%, 50%, 0.5)',
},
// 🎮 RGB GAMING THEME - Changement automatique de couleurs
rgbGaming: {
name: 'RGB Gaming',
icon: '🎮',
category: 'expressive',
isDark: true,
animated: true,
values: {
hue: 0, // Will change automatically
menuOpacity: 0.85,
menuBlur: 35,
menuSaturation: 200, // Saturation maximale
menuBrightness: 110, // Couleurs vives
menuContrast: 130,
menuBorderOpacity: 0.3, // Bordures visibles
hideControlBar: false,
controlBarOpacity: 0.75,
controlBarBlur: 25,
controlBarSaturation: 200,
controlBarBrightness: 115,
controlBarContrast: 125,
buttonShape: 'square', // Style gaming
buttonBgOpacity: 0.2,
buttonBorderOpacity: 0.4,
buttonHoverBgOpacity: 0.4,
menuTextLightness: 100,
buttonTextLightness: 100,
menuHeadingLightness: 95,
},
// Gradient qui change avec l'animation RGB
progressGradient: 'linear-gradient(90deg, hsl(var(--rgb-hue), 100%, 50%) 0%, hsl(calc(var(--rgb-hue) + 60), 100%, 60%) 50%, hsl(calc(var(--rgb-hue) + 120), 100%, 70%) 100%)',
progressShadow: 'hsla(var(--rgb-hue), 100%, 50%, 0.8)',
},
};
// 🎲 RANDOM THEME GENERATOR
function generateRandomTheme() {
// Generate a random hue (0-360)
const hue = Math.floor(Math.random() * 360);
// Generate 3 harmonious colors (triad: +120° and +240°)
const hue2 = (hue + 120) % 360;
const hue3 = (hue + 240) % 360;
// Randomly choose between dark and light theme
const isDark = Math.random() > 0.4; // 60% chance of dark theme
// Random variation for more diversity
const opacityVariation = Math.random() * 0.2; // 0-0.2
const blurVariation = Math.floor(Math.random() * 40); // 0-40
const satVariation = Math.floor(Math.random() * 100); // 0-100
// Generate harmonious values with safe ranges
const theme = {
name: 'Random',
icon: '🎲',
category: 'custom',
isDark: isDark,
values: {
hue: hue,
// Menu values - MORE variation for uniqueness
menuOpacity: 0.7 + opacityVariation, // 0.7-0.9
menuBlur: 15 + blurVariation, // 15-55
menuSaturation: 120 + satVariation, // 120-220
menuBrightness: 90 + Math.floor(Math.random() * 20), // 90-110
menuContrast: 100 + Math.floor(Math.random() * 40), // 100-140
menuBorderOpacity: 0.08 + Math.random() * 0.25, // 0.08-0.33
hideControlBar: Math.random() > 0.7, // 30% chance to hide
// Control bar values - DIFFERENT from menu
controlBarOpacity: 0.5 + Math.random() * 0.35, // 0.5-0.85
controlBarBlur: 15 + Math.floor(Math.random() * 50), // 15-65
controlBarSaturation: 100 + Math.floor(Math.random() * 100), // 100-200
controlBarBrightness: 85 + Math.floor(Math.random() * 20), // 85-105
controlBarContrast: 100 + Math.floor(Math.random() * 35), // 100-135
// Button style - random shape
buttonShape: Math.random() > 0.5 ? 'circle' : 'square',
buttonBgOpacity: 0.06 + Math.random() * 0.16, // 0.06-0.22
buttonBorderOpacity: 0.1 + Math.random() * 0.3, // 0.1-0.4
buttonHoverBgOpacity: 0.12 + Math.random() * 0.2, // 0.12-0.32
// Text colors based on isDark
menuTextLightness: isDark ? 85 + Math.floor(Math.random() * 15) : 5 + Math.floor(Math.random() * 15),
buttonTextLightness: isDark ? 85 + Math.floor(Math.random() * 15) : 5 + Math.floor(Math.random() * 15),
menuHeadingLightness: isDark ? 80 + Math.floor(Math.random() * 18) : 0 + Math.floor(Math.random() * 12),
},
// Generate progress gradient with 3 harmonious colors (triad)
progressGradient: `linear-gradient(90deg, hsl(${hue}, 75%, 55%) 0%, hsl(${hue2}, 80%, 58%) 50%, hsl(${hue3}, 75%, 55%) 100%)`,
progressShadow: `hsla(${hue2}, 80%, 58%, 0.7)`,
};
return theme;
}
const defaultSettings = {
ambianceEnabled: true,
ambianceBlur: 120,
ambianceOpacity: 0.9,
ambianceSaturation: 1.2,
ambianceHue: 0,
videoBorderRadius: 35,
videoMaxSize: 75,
cursorHideDelay: 3,
videoShadowBlur: 60,
videoShadowOpacity: 0.8,
videoShadowX: 0,
videoShadowY: 20,
uiTheme: 'youtube', // Default to YouTube theme
// ============================================
// 🎨 CUSTOM THEME ENGINE - UNIFIED WITH PRESET THEMES
// Ces paramètres correspondent EXACTEMENT aux thèmes prédéfinis (iOS, Mac, Windows, etc.)
// ============================================
// Base Color
customHue: 200, // 0-360° - Couleur de base du thème
// Menu Settings (identique aux presets: menuOpacity, menuBlur, etc.)
customMenuOpacity: 0.7,
customMenuBlur: 40,
customMenuSaturation: 180,
customMenuBrightness: 100,
customMenuContrast: 100,
customMenuBorderOpacity: 0.15,
customMenuTextLightness: 100, // 0-100% for HSL lightness
customMenuHeadingLightness: 97, // 0-100% for HSL lightness (titres de sections)
// Control Bar Settings (identique aux presets: controlBarOpacity, controlBarBlur, etc.)
customControlBarOpacity: 0.65,
customControlBarBlur: 30,
customControlBarSaturation: 180,
customControlBarBrightness: 100,
customControlBarContrast: 100,
// Control Bar Display Mode Toggles
showControlBarBg: true, // Mode Normal: Show/hide background (ON by default)
showCapsuleBorder: true, // Mode Capsule: Show/hide border (ON by default)
// Control Bar Advanced (spécifique au Custom Theme)
customControlBarStyle: 'normal', // 'normal', 'gradient', 'capsule'
customControlBarWidth: 90, // Width percentage (60-100%) for capsule style
customControlBarHeight: 70, // Height in pixels for capsule style
customControlBarPadding: 20, // Padding for capsule style
// Button Settings (hérités des thèmes - gérés automatiquement)
buttonShape: 'circle', // 'circle' or 'square' (utilisé par tous les thèmes)
customButtonBgOpacity: 0.12,
customButtonBorderOpacity: 0.2,
customButtonHoverBgOpacity: 0.2,
customButtonTextLightness: 100, // 0-100% for HSL lightness
customButtonSize: 44, // Size in pixels
customButtonSpacing: 12, // Space between buttons
// Video Control Features
playbackSpeed: 1, // 0.25 - 3.0
enableLoop: false, // Loop video
flipHorizontal: false, // Mirror/flip video horizontally
flipVertical: false, // Flip video vertically
// Video Filters
videoBrightness: 100, // 0-200%
videoContrast: 100, // 0-200%
videoSaturation: 100, // 0-300%
videoHueRotate: 0, // 0-360°
videoBlur: 0, // 0-10px
videoSepia: 0, // 0-100%
videoGrayscale: 0, // 0-100%
videoInvert: 0, // 0-100%
videoAberration: 0, // 0-100%
// Music Metadata Integration
useSpotify: true, // Use iTunes API for album art and metadata (free, no auth)
audioModeEnabled: false, // Enable audio mode (vinyl/cover + playlist)
showPlaylist: false, // Show playlist in audio mode (DISABLED by user request)
};
// 🛠️ FORMATTERS - Time, text utilities
/**
* Format seconds to HH:MM:SS or MM:SS
*/
function formatTime(s) {
if (isNaN(s) || s < 0) return '0:00';
const d = new Date(s * 1000);
const h = d.getUTCHours();
const m = d.getUTCMinutes();
const sec = d.getUTCSeconds().toString().padStart(2, '0');
return h > 0 ? `${h}:${m.toString().padStart(2, '0')}:${sec}` : `${m}:${sec}`;
}
/**
* Debounce function calls
*/
function debounce(func, delay) {
let timeout;
return function (...args) {
clearTimeout(timeout);
timeout = setTimeout(() => func.apply(this, args), delay);
};
}
// 💾 CACHE - Store video metadata (titles & covers)
const CACHE_KEY = 'youtune_video_cache';
const MAX_CACHE_SIZE = 50; // Max 50 videos
const CACHE_EXPIRY_DAYS = 7; // Cache expires after 7 days
/**
* Get cached video info
*/
function getCachedVideoInfo(videoId) {
try {
const cache = JSON.parse(localStorage.getItem(CACHE_KEY) || '{}');
const cached = cache[videoId];
if (!cached) return null;
// Check if expired
const now = Date.now();
const age = now - cached.timestamp;
const maxAge = CACHE_EXPIRY_DAYS * 24 * 60 * 60 * 1000;
if (age > maxAge) {
console.log(`[Youtune Cache] Expired entry for ${videoId}`);
deleteCachedVideoInfo(videoId);
return null;
}
console.log(`[Youtune Cache] Hit for ${videoId}`);
return {
title: cached.title,
artist: cached.artist,
thumbnail: cached.thumbnail
};
} catch (error) {
console.error('[Youtune Cache] Error reading cache:', error);
return null;
}
}
/**
* Save video info to cache
*/
function setCachedVideoInfo(videoId, videoInfo) {
try {
const cache = JSON.parse(localStorage.getItem(CACHE_KEY) || '{}');
// Add new entry
cache[videoId] = {