-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
1769 lines (1680 loc) · 66.1 KB
/
main.js
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
const ヤマノススメ = "ヤマノススメ";
let readCfg = JSON.parse(localStorage.getItem("LyricBarBlurSettings"));
let crStyle = document.createElement("style");
let cfgDefault = ({
blur: 12,
blurCompel: false,
bgTrans: 0.75,
bgColor: "defaultWom",
bgRed: 0,
bgGreen: 120,
bgBlue: 215,
bgCompel: false,
fonts: "default",
customFonts: "\"SDK_SC_Web 85W\", \"华文彩云\"",
textTrans: 1,
textColor: "theme",
textRed: 127,
textGreen: 127,
textBlue: 127,
textOl: false,
textOlWay: "shadow",
textOlWidth: 0.5,
textOlTrans: 1,
textOlColor: "custom",
textOlRed: 0,
textOlGreen: 0,
textOlBlue: 0,
textCompel: false,
padding: 0,
bdWidth: 1,
bdTrans: 0.1,
bdRadius: 12,
bdColor: "custom",
bdRed: 127,
bdGreen: 127,
bdBlue: 127,
noBdBgBlend: true,
bdCompel: false,
shadowX: 0,
shadowY: 1,
shadowBlur: 8,
shadowSpread: -4,
shadowTrans: 0.3,
shadowRed: 0,
shadowGreen: 0,
shadowBlue: 0,
isWidthEnable: false,
widthCustom: 400,
centerOfBottom: false,
doNotHideWithoutLyrics: true,
multiline3: false,
weltLeftRight: false,
noFadeLyrics: false,
mdThemeFloatBtBarBugFix: true,
});
async function resetStyles() { //应用新设置
if (!JSON.parse(localStorage.getItem("isLyricBarBlurEnable"))) { //清空!
try {
document.querySelector("#LyricBarBlurStyles").innerHTML = ``;
} catch {
crStyle.innerHTML = ``;
}
console.log("LyricBarBlur Log: Disabled");
return;
}
let lb = document.querySelector(".lyric-bar");
let lbi = document.querySelector(".lyric-bar-inner");
let readCfg = JSON.parse(localStorage.getItem("LyricBarBlurSettings"));
let blur = readCfg.blur;
let bgTrans = readCfg.bgTrans;
if (bgTrans == undefined || bgTrans == null || bgTrans == NaN) {
bgTrans = readCfg.trans;
bgRed = readCfg.colorRed;
bgGreen = readCfg.colorGreen;
bgBlue = readCfg.colorBlue;
} else {
bgTrans = readCfg.bgTrans;
bgRed = readCfg.bgRed;
bgGreen = readCfg.bgGreen;
bgBlue = readCfg.bgBlue;
}
if (readCfg.blurCompel) {
isBlurCompel = "!important";
} else {
isBlurCompel = "";
}
if (readCfg.bgCompel || readCfg.colorCompel) {
isBgCompel = "!important";
} else {
isBgCompel = "";
}
if (readCfg.textCompel) {
isTextCompel = "!important";
} else {
isTextCompel = "";
}
if (readCfg.bdCompel) {
isBdCompel = "!important";
} else {
isBdCompel = "";
}
let cssLbTop = `
.lyric-bar {
--lbb-text-outline-width: ` + readCfg.textOlWidth + `px;
--lbb-text-outline-color: rgba(` + readCfg.textOlRed + `, ` + readCfg.textOlGreen + `, ` + readCfg.textOlBlue + `, ` + readCfg.textOlTrans + `);
opacity: 1 !important;
transition: opacity .35s, all .5s !important;
`;
let cssLbiTop = `
.lyric-bar-inner {
`;
let cssLbiaTop = `
.lyric-bar-inner * {
`;
let cssBgDefault = `
background: linear-gradient(0deg, rgba(var(--md-accent-color-rgb, var(--ncm-fg-rgb)), ` + bgTrans/10 +`), rgba(var(--md-accent-color-rgb, var(--ncm-fg-rgb)), ` + bgTrans/10 +`)), rgba(var(--md-accent-color-bg-rgb, var(--ncm-bg-rgb)), ` + bgTrans +`) ` + isBgCompel + `;
`;
let cssBgDefaultWom = `
background: rgba(var(--md-accent-color-bg-rgb, var(--ncm-fg-rgb)), ` + bgTrans +`) ` + isBgCompel + `;
`;
let cssBgDefaultWomAll = `
body.ncm-light-theme .lyric-bar {
background: rgba(var(--md-accent-color-bg-rgb, var(--ncm-bg-rgb)), ` + bgTrans +`) ` + isBgCompel + `;
}
`;
let cssBgCustom = `
background: rgba(` + bgRed + `,` + bgGreen + `,` + bgBlue + `,` + bgTrans +`) ` + isBgCompel + `;
`;
let cssBgBlur = `
backdrop-filter: blur(` + blur + `px) ` + isBlurCompel + `;
`;
/* 一开始Rnp并不会加载,所以这里读取了Rnp的字体设置,并通过CSS应用。
* :not选择器的作用是判断Rnp播放页是否被加载,解决在Rnp内关闭自定义字体后,
* 这里的设置仍被应用的问题。
*/
let cssFontsRnpAll = `
body:not(.rnp-auto, .rnp-light, .rnp-dark) .lyric-bar-inner * {
font-family: ` + localStorage.getItem("refined-now-playing-font-family").replace("[", "").replace("]", "") + `;
}
`;
let cssFontsCustomLbia = `
font-family: ` + readCfg.customFonts + `;
`;
let cssTextTransLbi = `
opacity: ` + readCfg.textTrans + ` ` + isTextCompel + `;
`;
let cssTextTheme = `
--lbb-custom-text-color: var(--themeC1);
`;
let cssTextCustom = `
--lbb-custom-text-color: rgb(` + readCfg.textRed + `,` + readCfg.textGreen + `,` + readCfg.textBlue + `);
`;
let cssTextCustomLbia = `
--rnp-accent-color-shade-2: var(--lbb-custom-text-color) ` + isTextCompel + `;
color: var(--lbb-custom-text-color) ` + isTextCompel + `;
`;
let cssTextOlShadow = `
text-shadow:
var(--lbb-text-outline-width) var(--lbb-text-outline-width) var(--lbb-text-outline-color),
calc(var(--lbb-text-outline-width) * -1) var(--lbb-text-outline-width) var(--lbb-text-outline-color),
calc(var(--lbb-text-outline-width) * -1) calc(var(--lbb-text-outline-width) * -1) var(--lbb-text-outline-color),
var(--lbb-text-outline-width) calc(var(--lbb-text-outline-width) * -1) var(--lbb-text-outline-color);
`;
let cssTextOlStroke = `
-webkit-text-stroke: var(--lbb-text-outline-width) var(--lbb-text-outline-color);
`;
let cssWidth = `
--lyric-bar-width: ` + readCfg.widthCustom + `px !important;
`;
let cssPadding = `
padding: ` + readCfg.padding + `px ` + isBdCompel + `;
`;
let cssBdWidth = `
border: ` + readCfg.bdWidth + `px solid;
`;
let cssBdDefault = `
border-color: var(--themeC1) ` + isBdCompel + `;
`;
let cssBdText = `
border-color: var(--lbb-custom-text-color, var(--md-accent-color, var(--ncm-text)));
`;
let cssBdCustom = `
border-color: rgba(` + readCfg.bdRed + `,` + readCfg.bdGreen + `,` + readCfg.bdBlue + `,` + readCfg.bdTrans +`) ` + isBdCompel + `;
`;
let cssNoBdBgBlend = `
background-clip: padding-box;
`;
let cssBdRadius = `
border-radius: ` + readCfg.bdRadius + `px ` + isBdCompel + `;
`;
let cssShadow = `
box-shadow: ` + readCfg.shadowX + `px ` + readCfg.shadowY + `px ` + readCfg.shadowBlur + `px ` + readCfg.shadowSpread + `px rgba(` + readCfg.shadowRed + `,` + readCfg.shadowGreen + `,` + readCfg.shadowBlue + `,` + readCfg.shadowTrans +`);
`;
let cssCobAll = `
.lyric-bar {
top: unset !important;
bottom: calc(var(--bottombar-height, 72px) + var(--bottombar-elevation, 0px)) !important;
margin: 0 auto !important;
border-bottom-width: 0 !important;
border-bottom-left-radius: 0 !important;
border-bottom-right-radius: 0 !important;
}
.MoTheme-bottomMusicBar_dockMode .lyric-bar {
bottom: calc(var(--bottombar-height, 72px) + var(--bottombar-elevation, 0px) + 10px) !important;
}
`;
let cssDnhwolAll = `
.lyric-bar.no-lyrics {
opacity: 1 !important;
pointer-events: auto;
}
`;
let cssLbMl3 = `
height: calc(var(--lyric-bar-height)*3);
`;
let cssWeltLeftRight = `
width: clamp(200px, 100%, 100vw - var(--sidebar-width, 199px) - (2px * ` + readCfg.bdWidth + `px)) !important;
`;
let cssWlrFloatBtBarAll = `
body.floating-bottombar .lyric-bar {
right: calc(50vw - var(--bottombar-width)/2) !important;
left: calc(50vw - var(--bottombar-width)/2) !important;
z-index: 152 !important;
}
.MoTheme-bottomMusicBar_dockMode .lyric-bar {
right: calc(10px + var(--extra-pos-margin, 0px)) !important;
}
`;
let cssWlrAndCobFloatBtBarAll = `
body.floating-bottombar:not(.mq-playing) #main-player, body.floating-bottombar:not(.mq-playing) .m-player-fm, body.floating-bottombar:not(.mq-playing) #main-player .prg, body.floating-bottombar:not(.mq-playing) .m-player-fm .prg {
border-top-left-radius: 0 !important;
border-top-right-radius: 0 !important;
}
.MoTheme-bottomMusicBar_dockMode .lyric-bar {
bottom: calc(var(--bottombar-height, 72px) + var(--bottombar-elevation, 0px) + 12px) !important;
}
.MoTheme-bottomMusicBar_dockMode .m-player {
border-top-right-radius: 0 !important;
}
`;
let cssWlrOrCobFloatBtBar = `
right: calc(1px + var(--extra-pos-margin, 0px)) !important;
left: calc(var(--leftbar-width, 199px) + var(--extra-pos-margin, 0px)) !important;
`;
let cssNoFadeLyrics = `
--mask-image: unset !important;
`;
let cssMdThemeFloatBtBarBugFixAll = `
body.floating-bottombar .lyric-bar.posx-left {
left: max(calc(var(--leftbar-width, 199px) + 15px + var(--extra-pos-margin, 0px)), calc(50vw - var(--bottombar-width)/2));
}
`;
let css0 = `
body.rnp-shadow.rnp-text-glow .lyric-bar, body.rnp-text-glow.rnp-text-glow .lyric-bar {
--rnp-drop-shadow: drop-shadow(0px 4px 5px rgba(var(--rnp-accent-color-shade-2-rgb), 0.27)) !important;
}
`;
let cssEnd = `
}
`;
let bgc = readCfg.bgColor;
let textc = readCfg.textColor;
let olw = readCfg.textOlWay;
let bdc = readCfg.bdColor;
let f = readCfg.fonts;
let c = cssLbTop + cssBgBlur + cssPadding + cssBdRadius + cssShadow;
if (readCfg.bgColor || readCfg.color) {
c = c + cssBgCustom;
} else {
c = c + cssBgDefault;
}
if (bgc == "default") {
c = c + cssBgDefault;
}
if (bgc == "defaultWom") {
c = c + cssBgDefaultWom;
}
if (bgc == "custom") {
c = c + cssBgCustom;
}
if (textc == "theme") {
c = c + cssTextTheme;
}
if (textc == "custom") {
c = c + cssTextCustom;
}
if (readCfg.textOl) {
if (olw == "shadow") {
c = c + cssTextOlShadow;
}
if (olw == "stroke") {
c = c + cssTextOlStroke;
}
}
c = c + cssBdWidth;
if (bdc == "default") {
c = c + cssBdDefault;
}
if (bdc == "text") {
c = c + cssBdText;
}
if (bdc == "custom") {
c = c + cssBdCustom;
}
if (readCfg.noBdBgBlend) {
c = c + cssNoBdBgBlend;
}
if (readCfg.isWidthEnable) {
c = c + cssWidth;
}
if (readCfg.multiline3) {
c = c + cssLbMl3 + ``;
}
if (readCfg.weltLeftRight) {
c = c + cssWeltLeftRight;
}
if (readCfg.weltLeftRight || readCfg.centerOfBottom) {
c = c + cssWlrOrCobFloatBtBar;
}
if (readCfg.noFadeLyrics) {
c = c + cssNoFadeLyrics;
}
c = c + cssEnd + cssLbiTop + cssTextTransLbi + cssEnd + cssLbiaTop;
if (textc == "theme" || textc == "custom") {
c = c + cssTextCustomLbia;
}
try {
//先移除类…
lb.classList.remove("g-single-track");
lbi.classList.remove("lyric");
if (f == "rnp") {
//添加Rnp歌词的类以动态更换字体
lb.classList.add("g-single-track");
lbi.classList.add("lyric");
}
} catch { console.err("LyricBarBlur Error: Class list of the LyricBar editing failed"); }
if (f == "custom") {
c = c + cssFontsCustomLbia;
}
c = c + cssEnd;
//读取Rnp设置
if (f == "rnp" && localStorage.getItem("refined-now-playing-custom-font") == "true") {
c = c + cssFontsRnpAll;
}
if (bgc == "defaultWom") {
c = c + cssBgDefaultWomAll;
}
if (readCfg.centerOfBottom) {
c = c + cssCobAll;
}
if (readCfg.doNotHideWithoutLyrics) {
c = c + cssDnhwolAll;
}
if (readCfg.weltLeftRight) {
c = c + cssWlrFloatBtBarAll;
}
if (readCfg.weltLeftRight && readCfg.centerOfBottom) {
c = c + cssWlrAndCobFloatBtBarAll;
}
if (readCfg.mdThemeFloatBtBarBugFix) {
c = c + cssMdThemeFloatBtBarBugFixAll;
}
c = c + css0;
try {
document.querySelector("#LyricBarBlurStyles").innerHTML = c;
} catch {
crStyle.innerHTML = c;
}
console.log("LyricBarBlur Log: Styles set/reset");
};
async function disableSaveCancel(onoff, isFlashing) {
let s = document.querySelector("#saveButton");
let c = document.querySelector("#cancelButton");
if (onoff) {
s.disabled = true;
c.disabled = true;
} else {
s.disabled = false;
c.disabled = false;
}
if (isFlashing) {
let css = "animation: buttonFlashing .2s 2; color: var(--lbbs-fg) !important; box-shadow: 0;";
s.setAttribute("style", css);
c.setAttribute("style", css);
setTimeout(() => {
s.setAttribute("style", "");
c.setAttribute("style", "");
}, 500)
}
}
async function onOffAnySets() {
let allBinding = document.querySelectorAll(".switchBinding");
let bindingInput = document.querySelectorAll(".switchBinding:not(.part) > label:nth-of-type(1) input, .switchBinding .partTitle + div > label:nth-of-type(1) input");
if (allBinding.length != bindingInput.length) {
console.warn("LyricBarBlur Warning: [SETTING] allBinding.length != bindingInput.length");
}
for (n = 0; n < allBinding.length; n++) {
let allInput = allBinding[n].querySelectorAll("input");
let isChecked = bindingInput[n].checked;
if (bindingInput[n].disabled) {
for (i = 1; i < allInput.length; i++) {
allInput[i].disabled = true;
}
} else {
for (i = 1; i < allInput.length; i++) {
allInput[i].disabled = !isChecked;
}
}
}
}
async function onOffAllSets() {
let isChecked = document.querySelector("#mainSwitch").checked;
let allInput = document.querySelectorAll("#LyricBarBlurSettings input");
for (i = 0; i < allInput.length; i++) {
allInput[i].disabled = !isChecked;
}
if (isChecked == true) {
onOffAnySets();
}
document.querySelector("#mainSwitch").disabled = false;
localStorage.setItem("isLyricBarBlurEnable", isChecked);
resetStyles();
}
async function writeCfg(Cfg) { //写配置
localStorage.setItem("LyricBarBlurSettings", JSON.stringify(Cfg));
};
async function saveCfg() { //保存设置
//获取纯数字设置
function n(name, min, max) {
let b = document.getElementById(name + "SetBox");
let set = b.value;
//对字符串进行处理
if (set == "undefined" || set == "null" || set == "") {
set = b.placeholder;
};
//转换为数字
set = set*1;
//检查合法值
if (min != "n" && set < min) {
set = min;
b.value = min;
}
if (max != "n" && set > max) {
set = max;
b.value = max;
};
return set;
};
//获取文本设置
function t(name) {
let b = document.getElementById(name + "SetBox");
let set = b.value;
if (set == "undefined" || set == "null" || set == "") {
return b.placeholder;
};
return set;
};
//获取开关设置
function s(name) {
return document.getElementById(name + "Switch").checked;
};
//获取单选项设置
function r(name) {
let sets = document.getElementsByName(name);
for (i = 0; i < sets.length; i++) {
if(sets[i].checked) {
return sets[i].value;
}
}
};
let cfgWillWrite = ({
blur: n("blur", 0, "n"),
blurCompel: s("blurCompel"),
bgTrans: n("bgTrans", 0, 100)/100,
bgColor: r("bgColor"),
bgRed: n("bgRed", 0, 255),
bgGreen: n("bgGreen", 0, 255),
bgBlue: n("bgBlue", 0, 255),
bgCompel: s("bgCompel"),
fonts: r("fonts"),
customFonts: t("fonts"),
textTrans: n("textTrans", 0, 100)/100,
textColor: r("textColor"),
textRed: n("textRed", 0, 255),
textGreen: n("textGreen", 0, 255),
textBlue: n("textBlue", 0, 255),
textOl: s("textOl"),
textOlWay: r("textOlWay"),
textOlWidth: n("textOlWidth", 0, "n"),
textOlTrans: n("textOlTrans", 0, 100)/100,
textOlColor: r("textOlColor"),
textOlRed: n("textOlRed", 0, 255),
textOlGreen: n("textOlGreen", 0, 255),
textOlBlue: n("textOlBlue", 0, 255),
textCompel: s("textCompel"),
padding: n("padding", 0, "n"),
bdWidth: n("bdWidth", 0, "n"),
bdTrans: n("bdTrans", 0, 100)/100,
bdRadius: n("bdRadius", 0, "n"),
bdColor: r("bdColor"),
bdRed: n("bdRed", 0, 255),
bdGreen: n("bdGreen", 0, 255),
bdBlue: n("bdBlue", 0, 255),
noBdBgBlend: s("noBdBgBlend"),
bdCompel: s("bdCompel"),
shadowX: n("shadowX", "n", "n"),
shadowY: n("shadowY", "n", "n"),
shadowBlur: n("shadowBlur", 0, "n"),
shadowSpread: n("shadowSpread", "n", "n"),
shadowTrans: n("shadowTrans", 0, 100)/100,
shadowRed: n("shadowRed", 0, 255),
shadowGreen: n("shadowGreen", 0, 255),
shadowBlue: n("shadowBlue", 0, 255),
isWidthEnable: s("width"),
widthCustom: n("widthCustom", 200, "n"),
centerOfBottom: s("centerOfBottom"),
doNotHideWithoutLyrics: s("doNotHideWithoutLyrics"),
multiline3: s("multiline3"),
weltLeftRight: s("weltLeftRight"),
noFadeLyrics: s("noFadeLyrics"),
mdThemeFloatBtBarBugFix: s("mdThemeFloatBtBarBugFix"),
});
writeCfg(cfgWillWrite);
if (s("width")) {
localStorage.setItem("lyric-bar-lyric-bar-width", n("widthCustom", 200, "n") + "px");
}
console.log("LyricBarBlur Log: Settings saved");
resetStyles();
disableSaveCancel(true);
};
async function cancel(cfg) {
let readCfg = cfg;
if (cfg == undefined) {
readCfg = JSON.parse(localStorage.getItem("LyricBarBlurSettings"));
}
let d = document;
d.querySelector("#blurSetBox").value = readCfg.blur;
d.querySelector("#blurCompelSwitch").checked = readCfg.blurCompel;
d.querySelector("#bgTransSetBox").value = readCfg.bgTrans*100;
let bgc = readCfg.bgColor;
if (bgc == "default") {
d.querySelector("#bgColorDefaultRadio").checked = true;
}
if (bgc == "defaultWom") {
d.querySelector("#bgColorDefaultWomRadio").checked = true;
}
if (bgc == "custom") {
d.querySelector("#bgColorCustomRadio").checked = true;
}
d.querySelector("#bgRedSetBox").value = readCfg.bgRed;
d.querySelector("#bgGreenSetBox").value = readCfg.bgGreen;
d.querySelector("#bgBlueSetBox").value = readCfg.bgBlue;
d.querySelector("#bgCompelSwitch").checked = readCfg.bgCompel;
let f = readCfg.fonts;
if (f == "default") {
d.querySelector("#fontsDefaultRadio").checked = true;
}
if (f == "rnp") {
d.querySelector("#fontsRnpRadio").checked = true;
}
if (f == "custom") {
d.querySelector("#fontsCustomRadio").checked = true;
}
d.querySelector("#fontsSetBox").value = readCfg.customFonts;
d.querySelector("#textTransSetBox").value = readCfg.textTrans*100;
let textc = readCfg.textColor;
if (textc == "default") {
d.querySelector("#textColorDefaultRadio").checked = true;
}
if (textc == "theme") {
d.querySelector("#textColorThemeRadio").checked = true;
}
if (textc == "custom") {
d.querySelector("#textColorCustomRadio").checked = true;
}
d.querySelector("#textRedSetBox").value = readCfg.textRed;
d.querySelector("#textGreenSetBox").value = readCfg.textGreen;
d.querySelector("#textBlueSetBox").value = readCfg.textBlue;
d.querySelector("#textOlSwitch").checked = readCfg.textOl;
let olw = readCfg.textOlWay;
if (olw == "shadow") {
d.querySelector("#textOlWayShadowRadio").checked = true;
}
if (olw == "stroke") {
d.querySelector("#textOlWayStrokeRadio").checked = true;
}
d.querySelector("#textOlWidthSetBox").value = readCfg.textOlWidth;
d.querySelector("#textOlTransSetBox").value = readCfg.textOlTrans*100;
let olc = readCfg.textOlColor;
if (olc == "custom") {
d.querySelector("#textOlColorCustomRadio").checked = true;
}
d.querySelector("#textOlRedSetBox").value = readCfg.textOlRed;
d.querySelector("#textOlGreenSetBox").value = readCfg.textOlGreen;
d.querySelector("#textOlBlueSetBox").value = readCfg.textOlBlue;
d.querySelector("#textCompelSwitch").checked = readCfg.textCompel;
d.querySelector("#paddingSetBox").value = readCfg.padding;
d.querySelector("#bdWidthSetBox").value = readCfg.bdWidth;
d.querySelector("#bdTransSetBox").value = readCfg.bdTrans*100;
d.querySelector("#bdRadiusSetBox").value = readCfg.bdRadius;
let bdc = readCfg.bdColor;
if (bdc == "default") {
d.querySelector("#bdColorDefaultRadio").checked = true;
}
if (bdc == "text") {
d.querySelector("#bdColorTextRadio").checked = true;
}
if (bdc == "custom") {
d.querySelector("#bdColorCustomRadio").checked = true;
}
d.querySelector("#bdRedSetBox").value = readCfg.bdRed;
d.querySelector("#bdGreenSetBox").value = readCfg.bdGreen;
d.querySelector("#bdBlueSetBox").value = readCfg.bdBlue;
d.querySelector("#noBdBgBlendSwitch").checked = readCfg.noBdBgBlend;
d.querySelector("#bdCompelSwitch").checked = readCfg.bdCompel;
d.querySelector("#shadowXSetBox").value = readCfg.shadowX;
d.querySelector("#shadowYSetBox").value = readCfg.shadowY;
d.querySelector("#shadowBlurSetBox").value = readCfg.shadowBlur;
d.querySelector("#shadowSpreadSetBox").value = readCfg.shadowSpread;
d.querySelector("#shadowTransSetBox").value = readCfg.shadowTrans*100;
d.querySelector("#shadowRedSetBox").value = readCfg.shadowRed;
d.querySelector("#shadowGreenSetBox").value = readCfg.shadowGreen;
d.querySelector("#shadowBlueSetBox").value = readCfg.shadowBlue;
d.querySelector("#widthSwitch").checked = readCfg.isWidthEnable;
d.querySelector("#widthCustomSetBox").value = readCfg.widthCustom;
d.querySelector("#centerOfBottomSwitch").checked = readCfg.centerOfBottom;
d.querySelector("#doNotHideWithoutLyricsSwitch").checked = readCfg.doNotHideWithoutLyrics;
d.querySelector("#multiline3Switch").checked = readCfg.multiline3;
d.querySelector("#weltLeftRightSwitch").checked = readCfg.weltLeftRight;
d.querySelector("#noFadeLyricsSwitch").checked = readCfg.noFadeLyrics;
d.querySelector("#mdThemeFloatBtBarBugFixSwitch").checked = readCfg.mdThemeFloatBtBarBugFix;
console.log("LyricBarBlur Log: Settings refreshed");
disableSaveCancel(true);
}
function initializeCfg() { //初始化设置
localStorage.setItem("isLyricBarBlurEnable", true);
writeCfg(cfgDefault);
console.log("LyricBarBlur Log: Configs initializing");
resetStyles();
};
async function backToDefault() {
await cancel(cfgDefault);
disableSaveCancel(false, true);
}
let whatiii = 0;
let abcabc = 0;
let xhAiDi = -1;
async function what() { //彩蛋嘿嘿
let b = document.querySelector("#bugton")
whatiii++
if (whatiii == 1) {
b.value = "干嘛?"
}
if (whatiii == 2) {
b.value = "别戳我"
}
if (whatiii == 3) {
b.value = "睡不着啦"
}
if (whatiii == 4) {
b.value = "(怒)要给你点教训吗"
}
if (whatiii == 5) {
b.value = "不听是吧,你等着";
setTimeout(() => {
document.querySelector("#LyricBarBlurSettings style").innerHTML = "";
whatiii = 5;
abcabc = 123;
b.value = "怎么样?"
}, 10000)
}
if (abcabc != 123) {
if (whatiii == 6) {
b.value = "喂喂,不是叫你等着吗"
}
if (whatiii == 7) {
b.value = "叫你等你就等,烦呐"
}
if (whatiii == 8) {
b.value = "…"
}
if (whatiii > 8) {
b.value += "…"
}
}
if (abcabc == 123) {
if (whatiii == 6) {
b.value = "还戳呐?"
}
if (whatiii >= 7 && xhAiDi == -1) {
b.value = "再给你点惩罚(免罚请重载)"
setTimeout(() => {
location.href = "orpheus://orpheus/pub/app.html#/m2/mv/?id=22602294";
xhAiDi = setInterval(() => {
location.href = "orpheus://orpheus/pub/app.html#/m2/mv/?id=22602294"
}, 30000);
whatiii = 7
}, 10000)
}
if (xhAiDi != -1) {
if (whatiii == 8) {
b.value = "?油盐不进"
}
if (whatiii == 9) {
b.value = "你……"
}
if (whatiii == 10) {
b.value = "我要生气了"
}
if (whatiii == 11) {
b.value = "再戳我就要开大了!!!"
}
if (whatiii == 12) {
b.value = "最后警告。再戳就让你颠。"
}
if (whatiii == 13) {
b.value = "……10秒内,任务管理器准备好。别怪我没提醒你。"
localStorage.setItem(ヤマノススメ, true);
setTimeout(() => {
setInterval(() => {
location.href = "orpheus://orpheus/pub/app.html#/m2/mv/?id=22602294";
document.querySelector(".m-winctrl .icn.revert").click();
document.querySelector(".m-mvplayer video").volume = 1;
document.querySelector(".m-mvplayer .volume a.z-silence").click();
document.querySelector(".m-mvplayer > .bottom .play-pause.play").click();
document.querySelector(".m-mvplayer div:not(.f-dn) > .replay").click();
}, 200)
}, 10000)
}
}
}
}
plugin.onAllPluginsLoaded(async () => { //插件初始化
if (!readCfg) { //初始化设置
initializeCfg();
};
if (localStorage.getItem(ヤマノススメ)) { //等会?!
setInterval(() => {
document.querySelector("html").innerHTML = `
<h1 style="color:red">YOU DEER</h1>
<input type="button" value="RESPAWN ->" onclick="localStorage.removeItem('ヤマノススメ');location.href='orpheus://orpheus'"/>
<input type="button" value="TITLE SCREEN ->" onclick="localStorage.removeItem('ヤマノススメ');window.open('orpheus://orpheus')"/>
<p>OR</p>
<input type="button" value="网易云音乐 ->" onclick="window.open('https://music.163.com/#/mv?id=22602294')"/>
<input type="button" value="ilibilib ->" onclick="window.open('https://www.bilibili.com/video/BV1xJ4m1M7RU')"/>
<input type="button" value="UOGUK ->" onclick="window.open('https://www.kugou.com/mvweb/html/mv_7jcwjca')"/>
`;
}, 5000);
};
await betterncm.utils.waitForElement(".lyric-bar-inner"); //等待LyricBar加载完毕,否则一开始Rnp字体不生效
//初始化样式
crStyle.setAttribute("id", "LyricBarBlurStyles");
await resetStyles();
document.head.appendChild(crStyle);
});
plugin.onConfig(() => {
if (!readCfg) { //如果读不到就使用初始设置
readCfg = cfgDefault;
};
//设置读取
try {
var blur = readCfg.blur;
var bgTrans = readCfg.bgTrans*100;
var bgRed = readCfg.bgRed;
var bgGreen = readCfg.bgGreen;
var bgBlue = readCfg.bgBlue;
var textTrans = readCfg.textTrans*100;
var textRed = readCfg.textRed;
var textGreen = readCfg.textGreen;
var textBlue = readCfg.textBlue;
var textOlWidth = readCfg.textOlWidth;
var textOlTrans = readCfg.textOlTrans*100;
var textOlRed = readCfg.textOlRed;
var textOlGreen = readCfg.textOlGreen;
var textOlBlue = readCfg.textOlBlue;
var padding = readCfg.padding;
var bdWidth = readCfg.bdWidth;
var bdTrans = readCfg.bdTrans*100;
var bdRadius = readCfg.bdRadius;
var bdRed = readCfg.bdRed;
var bdGreen = readCfg.bdGreen;
var bdBlue = readCfg.bdBlue;
var shadowX = readCfg.shadowX;
var shadowY = readCfg.shadowY;
var shadowBlur = readCfg.shadowBlur;
var shadowSpread = readCfg.shadowSpread;
var shadowTrans = readCfg.shadowTrans*100;
var shadowRed = readCfg.shadowRed;
var shadowGreen = readCfg.shadowGreen;
var shadowBlue = readCfg.shadowBlue;
var widthCustom = readCfg.widthCustom;
if (readCfg.blurCompel) {
var blurCompelSwitchCheck = "Checked";
}
if (readCfg.bgCompel) {
var bgCompelSwitchCheck = "Checked";
}
var bgc = readCfg.bgColor;
var bgColorSetBoxDisable = "Disabled";
if (bgc == "defaultWom") {
var bgColorDefaultWomRadioCheck = "Checked";
} else if (bgc == "custom") {
var bgColorCustomRadioCheck = "Checked";
var bgColorSetBoxDisable = "";
} else {
var bgColorDefaultRadioCheck = "Checked";
}
//v0.2配置兼容
if (bgc == true) {
var bgColorCustomRadioCheck = "Checked";
} else if (bgc == false) {
var bgColorDefaultRadioCheck = "Checked";
var bgColorSetBoxDisable = "Disabled";
}
if (readCfg.textCompel) {
var textCompelSwitchCheck = "Checked";
}
var f = readCfg.fonts;
var fontsSetBoxDisable = "Disabled";
if (f == "rnp") {
var fontsRnpRadioCheck = "Checked";
} else if (f == "custom") {
var fontsCustomRadioCheck = "Checked";
var fontsSetBoxDisable = "";
} else {
var fontsDefaultRadioCheck = "Checked";
}
var textc = readCfg.textColor;
var textColorSetBoxDisable = "Disabled";
if (textc == "theme") {
var textColorThemeRadioCheck = "Checked";
} else if (textc == "custom") {
var textColorCustomRadioCheck = "Checked";
var textColorSetBoxDisable = "";
} else {
var textColorDefaultRadioCheck = "Checked";
}
//v0.2配置兼容
if (textc == true) {
var textColorCustomRadioCheck = "Checked";
} else if (textc == false) {
var textColorDefaultRadioCheck = "Checked";
var textColorSetBoxDisable = "Disabled";
}
if (readCfg.textOl) {
var textOlSwitchCheck = "Checked";
} else {
var textOlSetsDisable = "Disabled";
var textOlColorSetBoxDisable = "Disabled";
}
var olw = readCfg.textOlWay;
if (olw == "shadow") {
var textOlWayShadowRadioCheck = "Checked";
} else if (olw == "stroke") {
var textOlWayStrokeRadioCheck = "Checked";
}
if (readCfg.textOlColor) {
var textOlColorCustomRadioCheck = "Checked";
} else {
var textOlColorSetBoxDisable = "Disabled";
}
if (readCfg.noBdBgBlend) {
var noBdBgBlendSwitchCheck = "Checked";
}
if (readCfg.bdCompel) {
var bdCompelSwitchCheck = "Checked";
}
var bdc = readCfg.bdColor;
var bdColorSetBoxDisable = "Disabled";
if (bdc == "default") {
var bdColorDefaultRadioCheck = "Checked";
} else if (bdc == "text") {
var bdColorTextRadioCheck = "Checked";
} else if (bdc == "custom") {
var bdColorCustomRadioCheck = "Checked";
var bdColorSetBoxDisable = "";
}
if (readCfg.isWidthEnable) {
var widthSwitchCheck = "Checked";
} else {
var widthCustomSetBoxDisable = "Disabled";
}
if (readCfg.centerOfBottom) {
var centerOfBottomSwitchCheck = "Checked";
}
if (readCfg.doNotHideWithoutLyrics) {
var doNotHideWithoutLyricsSwitchCheck = "Checked";
}
if (readCfg.multiline3) {
var multiline3SwitchCheck = "Checked";
}
if (readCfg.weltLeftRight) {
var weltLeftRightSwitchCheck = "Checked";
}
if (readCfg.noFadeLyrics) {
var noFadeLyricsSwitchCheck = "Checked";
}
if (readCfg.mdThemeFloatBtBarBugFix) {
var mdThemeFloatBtBarBugFixSwitchCheck = "Checked";
}
var customFonts = readCfg.customFonts.replaceAll("\"", """);
} catch {
//v0.1配置兼容
try {
var blur = readCfg.blur;
var bgTrans = readCfg.trans*100;
var bgRed = readCfg.colorRed;
var bgGreen = readCfg.colorGreen;
var bgBlue = readCfg.colorBlue;
if (readCfg.blurCompel) {
var blurCompelSwitchCheck = "Checked";
}
if (readCfg.color) {
var bgColorCustomRadioCheck = "Checked";
var bgColorSetBoxDisable = "";
} else {
var bgColorSetBoxDisable = "Disabled";
}
if (readCfg.colorCompel) {
var bgCompelSwitchCheck = "Checked";
}
} catch {}
}
//创建DOM
let crCfgPage = document.createElement("div");
crCfgPage.setAttribute("id", "LyricBarBlurSettings");
crCfgPage.innerHTML = `
<style>
#LyricBarBlurSettings {
--lbbs-fg: var(--themeC1);
--lbbs-bg: rgba(var(--md-accent-color-bg-rgb, var(--ncm-fg-rgb)), .3);
--lbbs-bg-wot: rgba(var(--md-accent-color-bg-rgb, var(--ncm-fg-rgb)), 1);
color: var(--md-accent-color-secondary, var(--ncm-text));
width: 420px;
margin: 0 auto 120px 0;
line-height: 45px;
font-size: 16px;
}
body.ncm-light-theme #LyricBarBlurSettings {
--lbbs-bg: rgba(var(--md-accent-color-bg-rgb, var(--ncm-bg-rgb)), .3);