forked from qianjiachun/douyuEx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdouyuex.js
12057 lines (11003 loc) · 555 KB
/
douyuex.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
"use strict";
// ==UserScript==
// @name DouyuEx-斗鱼直播间增强插件
// @namespace https://github.com/qianjiachun
// @icon https://s2.ax1x.com/2020/01/12/loQI3V.png
// @version 2022.01.18.01
// @description 弹幕自动变色防检测循环发送 一键续牌 查看真实人数/查看主播数据 已播时长 一键签到(直播间/车队/鱼吧/客户端) 一键领取鱼粮(宝箱/气泡/任务) 一键寻宝 送出指定数量的礼物 一键清空背包 屏蔽广告 调节弹幕大小 自动更新 同屏画中画/多直播间小窗观看/可在斗鱼看多个平台直播(虎牙/b站) 获取真实直播流地址 自动抢礼物红包 背包信息扩展 简洁模式 夜间模式 开播提醒 幻神模式 关键词回复 关键词禁言 自动谢礼物 自动抢宝箱 弹幕右键信息扩展 防止下播自动跳转 影院模式 直播时间流控制 弹幕投票 直播滤镜 直播音频流 账号多开/切换 显示粉丝牌获取日期 月消费数据显示 弹幕时速 相机截图录制gif 全景播放器 斗鱼视频下载 直播画面局部缩放 全站抽奖信息
// @author 小淳
// @match *://*.douyu.com/0*
// @match *://*.douyu.com/1*
// @match *://*.douyu.com/2*
// @match *://*.douyu.com/3*
// @match *://*.douyu.com/4*
// @match *://*.douyu.com/5*
// @match *://*.douyu.com/6*
// @match *://*.douyu.com/7*
// @match *://*.douyu.com/8*
// @match *://*.douyu.com/9*
// @match *://*.douyu.com/topic/*
// @match *://www.douyu.com/member/cp/getFansBadgeList
// @match *://passport.douyu.com/*
// @match *://msg.douyu.com/*
// @match *://yuba.douyu.com/*
// @match *://v.douyu.com/*
// @match *://cz.douyu.com/*
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/flv.min.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/build/svga.min.js
// @require https://cdn.jsdelivr.net/npm/[email protected]/dist/gif.min.js
// @require https://lib.baomitu.com/three.js/80/three.min.js
// @grant GM_openInTab
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_listValues
// @grant GM_deleteValue
// @grant GM_cookie
// @grant GM_registerMenuCommand
// @grant unsafeWindow
// @connect douyucdn.cn
// @connect douyu.com
// @connect 122.51.5.63
// @connect qq.com
// @connect rrocr.com
// @connect douyuex.com
// @connect bojianger.com
// @connect greasyfork.org
// @connect bilibili.com
// @connect huya.com
// @connect jsdelivr.net
// @connect shadiao.app
// @connect fz996.com
// @connect toubang.tv
// @connect doseeing.com
// ==/UserScript==
function init() {
initPkg_Night_Set_Fast();
removeAD();
initPkg_Statistics();
initPkg_Console();
initPkg_Menu();
initPkg_FollowList();
}
function initPkg() {
Update_checkVersion();
initPkg_Night();
initPkg_ExIcon();
initPkg_ExPanel();
initPkg_RealAudience();
initPkg_CopyRealLive();
initPkg_AudioLine();
initPkg_RemoveAD();
initPkg_BagInfo();
initPkg_Update();
initPkg_Monitor();
initPkg_Lottery();
// initPkg_MiniProgram();
initPkg_PopupPlayer();
initPkg_LiveTool();
initPkg_VideoTools();
initPkg_ExpandTool();
initPkg_Refresh();
initPkg_BarrageLoop();
initPkg_FansContinue();
initPkg_FishFood();
initPkg_Sign();
initPkg_BarragePanel();
initPkg_AdVideo();
initPkg_AccountList();
initPkg_ChatTools();
initPkg_MonthCost();
initPkg_TabSwitch();
initPkg_WeeklyPanel();
}
function initPkg_Timer() {
initPkg_FishPond_Timer();
}
function initTimer() {
initPkg_Timer();
exTimer = setInterval(initPkg_Timer, 35000);
}
function initStyles() {
let style = document.createElement("style");
style.appendChild(document.createTextNode(`#ex-accountList-wrap { left: -152px; top: -16px; /* max-height: 330px; overflow-y: scroll; scrollbar-width: none; -ms-overflow-style: none; */ -webkit-transition: all .2s cubic-bezier(.22,.58,.12,.98); -o-transition: all cubic-bezier(.22,.58,.12,.98) .2s; -moz-transition: all cubic-bezier(.22,.58,.12,.98) .2s; transition: all .2s cubic-bezier(.22,.58,.12,.98); -webkit-transform-origin: 80% 0; -moz-transform-origin: 80% 0; -ms-transform-origin: 80% 0; -o-transform-origin: 80% 0; transform-origin: 80% 0; -webkit-animation: scale-in-ease .5s cubic-bezier(.22,.58,.12,.98); -moz-animation: scale-in-ease cubic-bezier(.22,.58,.12,.98) .5s; -o-animation: scale-in-ease cubic-bezier(.22,.58,.12,.98) .5s; animation: scale-in-ease .5s cubic-bezier(.22,.58,.12,.98);}/* #ex-accountList-wrap::-webkit-scrollbar { display: none;} */.ex-accountList-item { padding: 10px; display: flex; border-radius: 10px; align-items: center;}.ex-accountList-item:hover { background-color: rgb(244,244,244);}#ex-accountList-iframe { display: none;}#ex-accountList-iframe2 { display: none;}#ex-accountList-item-add { padding: 10px; text-align: center; margin-bottom:0px; border-radius: 10px;}#ex-accountList-item-add:hover { background-color: rgb(244,244,244);}.ex-accountList-item__imgWrap { flex: 0 0 25%;}.ex-accountList-item__img { width: 50px; height: 50px; border-radius: 50%;}.ex-accountList-item__name { line-height: 50px; flex: 0 0 55%;}.ex-accountList-item__btn { height: 30px; width: 50px; border-radius: 10px; align-items: center; flex: auto; text-align: center; line-height: 28px; color: white; background-color: rgb(245,108,108);}.ex-accountList-item__btn:hover { background-color: rgb(247,137,137);}#ex-accountList-icon:hover > #ex-accountList-wrap { display: block;}#ex-audio-line { cursor: pointer;}.bag-info { position: absolute; background-color: rgba(0, 0, 0, 0.6); color: white; width: 20px; font-weight: 800; height: 20px; text-align: center;}.bag-button { position: relative; color: rgb(255, 255, 255); text-align: center; height: 15px; line-height: 15px; cursor: pointer; margin-left: 5px; background: rgb(70, 171, 255); border-radius: 9px; padding: 0px 10px; float: right; right: 20px;}.bloop { background-color: rgba(255,255,255,0.9); width: 100%; height: 200px; position: relative; bottom: 200px; display: none; z-index: 1015;}.bloop__switch { position: absolute; right: 0; bottom: 0;}.bloop__mode { display: inline-block;}.barragePanel__funcPanel { position: absolute; width: 232px; height: 270px; display: block; background: white; overflow-y: scroll;}.barragePanel__funcPanel::-webkit-scrollbar {display:none}.barragePanel__muteTime { position: absolute; left: 25px; top: 123px; z-index: 5;}#copy-real-live { cursor: pointer;}.ex-icon { display: inline-block; vertical-align: middle; margin-right: 8px; -moz-user-select:none; /*火狐*/ -webkit-user-select:none; /*webkit浏览器*/ -ms-user-select:none; /*IE10*/ -khtml-user-select:none; /*早期浏览器*/ user-select:none;}.extool { background-color: rgba(255,255,255,0.9); width: 100%; height: 200px; position: relative; bottom: 200px; display: none; z-index: 1015;}.extool__switch { position: absolute; right: 0; bottom: 0;}.extool__bsize,.extool__sendgift { margin-bottom: 5px;}.extool__redpacket_room,.extool__gold { display: inline-block;}.ex_giftAnimation { width: 100%; height: 100%; position: absolute; z-index: 50; pointer-events: none;}.ex-panel { position: absolute; bottom: 32px; right: 5px; background-color: rgba(255,255,255,0.9); display: none; border: 2px rgb(234,173,26) solid; z-index: 1015; user-select: none;}.ex-panel__wrap { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;}.ex-panel__icon { margin: 0 10px; display: block; position: relative; padding: 5px; transition: 0.5s;}.ex-panel__icon:hover { transform: scale(1.15);}.ex-panel__tip { display:none; background:#f00; border-radius:50%; width:8px; height:8px; top:0px; right:0px; position:absolute;}#refreshFollowList { color: grey;position: absolute;right: 5px;top:0px;cursor: default;}.barrageSpeed { position: absolute; right: 10px; top: -20px; color: rgba(0,0,0,0.5); cursor: default; z-index: 0;}.enter__panel { width: 100%; display: none; margin-top: 4px;}#enter__title { cursor: pointer; user-select: none;}#enter__select { width: 190px;}.enter__option { margin-top: 5px;}#enter__enterId { width: 40px;}#enter__reply { width: 150px;}#enter__word { width: 140px;}#enter__level { width: 25px; text-align: center;}#enter__export { cursor: pointer; color: royalblue; margin-left: 10px;}#enter__import { cursor: pointer; color: royalblue; margin-left: 5px;}.gift__panel { width: 100%; display: none; margin-top: 4px;}#gift__title { cursor: pointer; user-select: none;}#gift__select { width: 113px;}.gift__option { margin-top: 5px;}#gift__giftId { width: 40px;}#gift__reply { width: 150px;}#gift__export { cursor: pointer; color: royalblue; margin-left: 10px;}#gift__import { cursor: pointer; color: royalblue; margin-left: 5px;}.livetool { background-color: rgba(255,255,255,0.9); width: 100%; height: 290px; position: relative; bottom: 290px; display: none; z-index: 1015;}.livetool__cell { position: relative; display: -webkit-box; display: -webkit-flex; display: flex; box-sizing: border-box; width: 100%; padding: 10px 16px; overflow: hidden; color: #323233; font-size: 14px; line-height: 24px; background-color: #fff; border-bottom: 1px solid rgba(0,0,0,0.2); flex-wrap: wrap; -webkit-flex-wrap: wrap;}.livetool__cell_title { flex: 1; -webkit-box-flex: 1;}.livetool__cell_option { text-align: right;}.livetool__cell_switch { float: right;}.mute__panel { width: 100%; display: none; margin-top: 4px;}#mute__title { cursor: pointer; user-select: none;}#mute__idlist { cursor: pointer; color: royalblue; margin-left: 10px;}#mute__export, #mute__import { cursor: pointer; color: royalblue; margin-left: 5px;}#mute__select { width: 110px;}.mute__option { margin-top: 5px;}#mute__word { width: 70px;}#mute__count { width: 30px;}#mute__time { width: 65px;}.reply__panel { width: 100%; display: none; margin-top: 4px;}#reply__title { cursor: pointer; user-select: none;}#reply__select { /* width: 190px; */ width: 100px;}#reply__time { width: 35px;}.reply__option { margin-top: 5px;}#reply__word { width: 70px;}#reply__reply { width: 147px;}#reply__export { cursor: pointer; color: royalblue; margin-left: 10px;}#reply__import { cursor: pointer; color: royalblue; margin-left: 5px;}.livetool__Treasure { width: 100%; position: relative; z-index: 999;}.vote__panel { width: 100%; display: none; margin-top: 4px;}#vote__title { cursor: pointer; user-select: none;}#vote__select { width: 100px;}.vote__option { margin-top: 5px;}#vote__theme { width: 70px;}#vote__options { width: 133px;}#vote__time { width: 35px;}#vote__show-result { cursor: pointer; color: royalblue; margin-left: 10px;}.vote__result { position: absolute; top: 0px; width: 300px; background: rgba(255,255,255,0.85); left: 0px; z-index: 999; padding: 5px; border-radius: 10px; user-select: none; display: none;}#vote__result-theme { font-size: 20px; font-weight: 600; margin-bottom: 10px;}#vote__result-close { position: absolute; top: 5px; right: 10px; font-size: 14px; cursor: pointer; color: gray;}.vote__option-wrap { margin-bottom: 10px;}.vote__option-choice { display: inline-block; font-size: 14px;}.vote__option-num { float: right; font-size: 14px;}.vote__progress { width: 100%; background-color: #ddd; border-radius: 10px;}.vote__progress-bar { width: 0%; height: 14px; background-color: #4CAF50; text-align: center; line-height: 30px; border-radius: 10px;}.exlottery { background-color: rgba(255,255,255,1); width: 100%; height: 250px; position: relative; bottom: 250px; display: none; z-index: 1015; overflow: auto; padding: 0 10px; box-sizing: border-box;}.lottery__nodata { z-index: 998; position: absolute; left:50%; top:50%; transform: translate(-50%, -50%); color: #606266;}.lottery__wrap { display: flex; flex-direction: column; z-index: 999;}.lottery__a:hover .lottery__item { background-color: rgb(244,244,244);}.lottery__item { display: flex; padding: 5px 0; border-bottom: 1px solid #d0d0d0; color: #606266;}.lottery__img img { width: 150px; border-radius: 5px;}.lottery__anchor { position: absolute; background-color: rgba(255,255,255,0.9); border-radius: 5px 0px 5px 0px;}.lottery__info { display: flex; justify-content: space-evenly; flex-direction: column; margin-left: 10px; overflow: hidden;}.lottery__prize { white-space: nowrap; text-overflow: ellipsis; word-break: break-all; font-size: 14px;}.lottery__expireTime { position: absolute; margin-top: -18px; background-color: rgba(255,255,255,0.9); border-radius: 0px 5px 0px 5px;} /*滚动条样式*/.exlottery::-webkit-scrollbar { width: 4px; }.exlottery::-webkit-scrollbar-thumb { border-radius: 10px; box-shadow: inset 0 0 5px rgba(0,0,0,0.2); background: rgba(0,0,0,0.2);}.exlottery::-webkit-scrollbar-track { box-shadow: inset 0 0 5px rgba(0,0,0,0.2); border-radius: 0; background: rgba(0,0,0,0.1);}.lottery__func { display: flex; justify-content: space-between; margin-top: 5px; user-select: none; border-bottom: 1px solid #d0d0d0;}.lottery__notice,#lottery-refresh { cursor: pointer; color: #606266;}.miniprogram__panel { position: absolute; right: 43px; bottom: 100px; animation: move-in 0.75s; z-index: 101; text-align: center; display: none;}.miniprogram__wrap { overflow: hidden; background-color: white; border-radius: 5%; width: 200px; box-shadow: 0px 2px 20px 0px #888888; font-size: 14px;}.miniprogram__triangle { width: 0px; height: 0px; border-color: white transparent transparent transparent; border-style: solid; border-width: 10px; position: absolute; left: 100px;}.month-cost { margin-right: 5px; cursor: default; -moz-user-select:none;/*火狐*/ -webkit-user-select:none;/*webkit浏览器*/ -ms-user-select:none;/*IE10*/ -khtml-user-select:none;/*早期浏览器*/ user-select:none;}.monthcost__icon { position: relative; top: 3px; cursor: pointer; margin-left: 3px;}#ex-point { cursor: pointer; float: left; line-height: 30px; -moz-user-select:none; /*火狐*/ -webkit-user-select:none; /*webkit浏览器*/ -ms-user-select:none; /*IE10*/ -khtml-user-select:none; /*早期浏览器*/ user-select:none;}#point__value { color: #333;}#ex-exchange { position: absolute; left: 0; bottom: 37px; z-index: 100;}.exchange__panel { width: 400px; height: 500px; position: relative;}.exchange__wrap { width: 400px; height: 500px; background-color: white; border-radius: 3%; overflow-y: scroll; overflow-x: hidden; box-shadow: 0px 0px 20px 0px #888888;}.exchange__wrap::-webkit-scrollbar { display:none}.exchange__close { position: absolute; color: rgb(127, 127, 137); right: 10px; top: 5px; font-size: 15px; cursor: pointer; z-index: 101;}.item__wrap { width: 100%; height: 130px; border-bottom: 1px solid rgba(121,127,137,0.4); position: relative;}.item__pic { left: 10px; top: 10px; position: absolute; height: 110px; width: 110px;}.item__name { position: absolute; top: 7px; left: 130px; color: #353536;; font-size: 15px; margin-right: 10px;}.item__description { position: absolute; top: 32px; left: 130px; font-size: 12px; margin-right: 10px; color: #969799;}.item__num { position: absolute; bottom: 27px; left: 130px; font-size: 12px; color: #969799;}.item__price { position: absolute; bottom: 7px; left: 130px; font-size: 14px; color: rgb(255,93,35); font-weight: 600;}.item__exchange { position: absolute; bottom: 8px; right: 10px; font-size: 14px; color: white; text-align: center; width: 80px; height: 25px; background-color: rgb(255,93,35); border-radius: 999px; cursor: pointer;}#ex-pointlist { position: absolute; width: 300px; height: 400px; background-color: white; border-radius: 3%; overflow: auto; z-index: 100; bottom: 37px;}#ex-pointlist::-webkit-scrollbar { display:none}.pointlist__wrap { width: 100%; height: 100%; margin: 15px 0; position: absolute;}.pointlist__close { position: absolute; color: rgb(127, 127, 137); right: 7px; font-size: 15px; cursor: pointer;}.pointlist__wrap table { border-collapse: collapse; margin: 0 auto; text-align: center;}.pointlist__wrap td,.pointlist__wrap th { border: 1px solid #cad9ea; color: #666; height: 30px; width: 85px;}.pointlist__wrap thead th { background-color: #CCE8EB; width: 100px;}.pointlist__wrap tr:nth-child(odd) { background: #fff;}.pointlist__wrap tr:nth-child(even) { background: #F5FAFA;}.point__panel { position: absolute; left: 0px; bottom: 37px; display: none; animation: move-in 0.75s; z-index: 101;}@keyframes move-in { 0% { opacity: 0; } 100% { opacity: 0.95; }}.panel__wrap { overflow: hidden; background-color: white; border-radius: 5%; width: 120px; box-shadow: 0px 2px 20px 0px #888888; font-size: 14px;}.panel__cell { width: 100%; height: 37px; line-height: 37px; border-bottom: 1px solid rgba(121,127,137,0.4); text-align: center; cursor: pointer;}.panel__cell:hover { background-color: rgb(217, 217, 217); transition: 0.75s;}.panel__triangle { width: 0px; height: 0px; border-color: white transparent transparent transparent; border-style: solid; border-width: 10px; position: absolute; left: 35px;}#ex-record { width: 300px; height: 400px; position: absolute; bottom: 67px; z-index: 100;}.record__close { position: absolute; color: rgb(127, 127, 137); right: -20px; font-size: 15px; cursor: pointer;}.records__wrap { width: 100%; height: 100%; background-color: white; border-radius: 3%; box-shadow: 0px 0px 20px 0px #888888; padding: 15px; overflow-y: scroll; overflow-x: hidden;}.records__wrap::-webkit-scrollbar { display:none}.record__wrap { height: 50px; width: 100%; border: 1px solid rgba(121,127,137,0.4); margin-bottom: 10px; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; transition: 0.75s; cursor: pointer;}.record__wrap:hover { background-color: #e9f5ff;}.record__left { flex: 1; position: relative;}.record__name { position: absolute; flex: 1; color: #353536;; font-size: 15px; top: 2px; margin-left: 5px;}.record__updatetime { position: absolute; margin-left: 5px; font-size: 12px; bottom: 2px; color: #969799;}.record__price { line-height: 50px; color: rgb(255,93,35); margin-right: 10px;}.record__pagenav { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; width: 310px; position: absolute; bottom: -20px; padding-left: 10px; padding-right: 10px; cursor: pointer;}.record__prev { flex: 1; text-align: center; border: 1px solid rgba(121,127,137,0.8); transition: 0.75s; color: white; background-color: rgb(57,169,237);}.record__prev:hover { background-color: #7167ff;}.record__next { flex: 1; text-align: center; border: 1px solid rgba(121,127,137,0.8); transition: 0.75s; background-color: rgb(57,169,237); color: white;}.record__next:hover { background-color: #7167ff;}.exVideoDiv { width: 400px; height: 200px; background-color: rgba(255, 255, 255, 0); position: absolute; z-index: 1015;}.exVideoPlayer { width: 100%; height: 100%; cursor: move;}.exVideoScale { width: 10px; height: 10px; overflow: hidden; cursor: se-resize; position: absolute; right: 0; bottom: 0; background-color: rgb(231, 57, 57);}.exVideoInfo { width: 100%; height: 30px; background-color: gray; position: absolute; top: -30px; line-height: 30px;}.exVideoClose { width: 30px; float: right; color: white;}.exVideoQn, .exVideoCDN { margin-left: 5px;}.exVideoRID { margin: 0px 5px; font-weight: 800; font-size: medium;}#popup-player__prompt { display: none;}.real-audience { cursor: pointer; display: flex; padding: 0 7px; line-height: 33px;}/* #refresh-video { float: left; width: 24px; height: 24px; margin-right: 5px; cursor: pointer; background-size: contain;} */#refresh-video2 { display: none; position: absolute; top: 20px; right: 20px; cursor: pointer;}#refresh-video2-svg { fill: rgba(0,0,0,.6)}.refresh-barrage { display: inline-block; vertical-align: top; margin: 0 2px; padding: 0 8px; height: 22px; line-height: 21px; background-color: #fff; border: 1px solid #e5e4e4; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; cursor: pointer;}#refresh-barrage__svg { vertical-align: middle;}#ex-camera { background: rgba(0,0,0,0.7); position: absolute; right: 20px; bottom: 190px; z-index: 10; width: 60px; height: 60px; cursor: pointer; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; cursor: pointer; display: none; justify-content: center; align-items: center; border: 2px solid #2d2c2c; box-sizing: border-box;}#ex-camera:hover > svg > path { fill: rgb(252, 199, 84);}#ex-camera:active > svg > path { fill: rgb(253, 60, 60);}#ex-cinema:hover > .cinema__wrap { display: block;}.cinema__wrap { display: none; margin: 0; padding: 0; border: 1px solid #e5e5e5; background: #fff; position: absolute; left: 201px; min-width: 100px; top: 130px;}.cinema__panel { position: absolute; border: 1px solid #000; border-radius: 4px; transform: translateY(calc(-4px - 100%)) translateX(-50%); left: 33%; background-color: #000; opacity: .75; width: 70px;}.cinema__panel li { padding: 0 2px; white-space: nowrap; color: #fff; text-align: center; cursor: pointer;}.cinema__panel li:hover { background-color: rgb(85, 85, 85);} #ex-filter { float: left; width: 24px; height: 24px; margin-right: 10px; cursor: pointer; background-size: contain;}.filter__wrap { display: none; position: relative; height: 100%; margin-right: -15px; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; float: left; right: -12px; bottom: 10px;}.filter__panel { position: absolute; border: 1px solid #000; border-radius: 4px; transform: translateY(calc(-4px - 100%)) translateX(-50%); left: 33%; background-color: #000; opacity: .75; width: 300px; padding-top: 10px; padding-left: 10px; padding-right: 10px;}.filter__panel li { padding: 0 2px; white-space: nowrap; color: #fff; text-align: center; cursor: pointer;}.filter__panel li:hover { background-color: rgb(85, 85, 85);}.filter__scroll { width: 255px; height: 5px; background: #ccc; position: relative; display: inline-block;}.filter__scroll-bar { width: 15px; height: 15px; background: #369; position: absolute; top: -5px; left: 100px; cursor: pointer; border-radius: 100%;}.filter__scroll-mask { position: absolute; left: 0; top: 0; background: #369; width: 100px; height: 5px;}.filter__title { color: white; display: inline-block; cursor: initial; margin-right: 2px;}#filter__select { width: 260px; float: right;}.filter__filter { margin-top: 5px;}#ex-videospeed:hover > .videospeed__wrap { display: block;}.videospeed__wrap { display: none; margin: 0; padding: 0; border: 1px solid #e5e5e5; background: #fff; position: absolute; left: 201px; min-width: 100px; top: 120px;}.videospeed__panel { position: absolute; border: 1px solid #000; border-radius: 4px; transform: translateY(calc(-4px - 100%)) translateX(-50%); left: 33%; background-color: #000; opacity: .75; width: 70px;}.videospeed__panel li { padding: 0 2px; white-space: nowrap; color: #fff; text-align: center; cursor: pointer;}.videospeed__panel li:hover { background-color: rgb(85, 85, 85);} #ex-videosync { float: left; width: 24px; height: 24px; margin-left: 20px; cursor: pointer; background-size: contain;}.weeklypanel__panel-wrap { width: 100%; height: 100%; z-index: 999; background-color: rgba(0, 0, 0, 0.9); position: absolute; top: 0; left: 0; display: flex; justify-content: center; align-items: center;}.weeklypanel__panel { height: 600px; width: 500px; background-color: white; border-radius: 20px; position: fixed; top: 0; left: 0; right: 0; bottom: 0; margin: auto;}.weeklypanel__content { position: relative; top: 50%; transform: translateY(-50%); text-align: center;}.weeklypanel__text { font-size: 18px;}.weeklypanel__text a { font-weight: bold; font-size: 24px;}.weeklypanel__close { font-size: 30px; font-weight: bold; position: absolute; right: 15px; cursor: pointer;}.noticejs-top{top:0;width:100% !important}.noticejs-top .item{border-radius:0 !important;margin:0 !important}.noticejs-topRight{top:10px;right:10px}.noticejs-topLeft{top:10px;left:10px}.noticejs-topCenter{top:10px;left:50%;transform:translate(-50%)}.noticejs-middleLeft,.noticejs-middleRight{right:10px;top:50%;transform:translateY(-50%)}.noticejs-middleLeft{left:10px}.noticejs-middleCenter{top:50%;left:50%;transform:translate(-50%,-50%)}.noticejs-bottom{bottom:0;width:100% !important}.noticejs-bottom .item{border-radius:0 !important;margin:0 !important}.noticejs-bottomRight{bottom:10px;right:10px}.noticejs-bottomLeft{bottom:10px;left:10px}.noticejs-bottomCenter{bottom:10px;left:50%;transform:translate(-50%)}.noticejs{font-family:Helvetica Neue,Helvetica,Arial,sans-serif}.noticejs .item{margin:0 0 10px;border-radius:3px;overflow:hidden}.noticejs .item .close{float:right;font-size:18px;font-weight:700;line-height:1;color:#fff;text-shadow:0 1px 0 #fff;opacity:1;margin-right:7px}.noticejs .item .close:hover{opacity:.5;color:#000}.noticejs .item a{color:#fff;border-bottom:1px dashed #fff}.noticejs .item a,.noticejs .item a:hover{text-decoration:none}.noticejs .success{background-color:#64ce83}.noticejs .success .noticejs-heading{background-color:#3da95c;color:#fff;padding:10px}.noticejs .success .noticejs-body{color:#fff;padding:10px}.noticejs .success .noticejs-body:hover{visibility:visible !important}.noticejs .success .noticejs-content{visibility:visible}.noticejs .info{background-color:#3ea2ff}.noticejs .info .noticejs-heading{background-color:#067cea;color:#fff;padding:10px}.noticejs .info .noticejs-body{color:#fff;padding:10px}.noticejs .info .noticejs-body:hover{visibility:visible !important}.noticejs .info .noticejs-content{visibility:visible}.noticejs .warning{background-color:#ff7f48}.noticejs .warning .noticejs-heading{background-color:#f44e06;color:#fff;padding:10px}.noticejs .warning .noticejs-body{color:#fff;padding:10px}.noticejs .warning .noticejs-body:hover{visibility:visible !important}.noticejs .warning .noticejs-content{visibility:visible}.noticejs .error{background-color:#e74c3c}.noticejs .error .noticejs-heading{background-color:#ba2c1d;color:#fff;padding:10px}.noticejs .error .noticejs-body{color:#fff;padding:10px}.noticejs .error .noticejs-body:hover{visibility:visible !important}.noticejs .error .noticejs-content{visibility:visible}.noticejs .progressbar{width:100%}.noticejs .progressbar .bar{width:1%;height:30px;background-color:#4caf50}.noticejs .success .noticejs-progressbar{width:100%;background-color:#64ce83;margin-top:-1px}.noticejs .success .noticejs-progressbar .noticejs-bar{width:100%;height:5px;background:#3da95c}.noticejs .info .noticejs-progressbar{width:100%;background-color:#3ea2ff;margin-top:-1px}.noticejs .info .noticejs-progressbar .noticejs-bar{width:100%;height:5px;background:#067cea}.noticejs .warning .noticejs-progressbar{width:100%;background-color:#ff7f48;margin-top:-1px}.noticejs .warning .noticejs-progressbar .noticejs-bar{width:100%;height:5px;background:#f44e06}.noticejs .error .noticejs-progressbar{width:100%;background-color:#e74c3c;margin-top:-1px}.noticejs .error .noticejs-progressbar .noticejs-bar{width:100%;height:5px;background:#ba2c1d}@keyframes noticejs-fadeOut{0%{opacity:1}to{opacity:0}}.noticejs-fadeOut{animation-name:noticejs-fadeOut}@keyframes noticejs-modal-in{to{opacity:.3}}@keyframes noticejs-modal-out{to{opacity:0}}.noticejs-rtl .noticejs-heading{direction:rtl}.noticejs-rtl .close{float:left !important;margin-left:7px;margin-right:0 !important}.noticejs-rtl .noticejs-content{direction:rtl}.noticejs{position:fixed;z-index:10050;width:320px}.noticejs::-webkit-scrollbar{width:8px}.noticejs::-webkit-scrollbar-button{width:8px;height:5px}.noticejs::-webkit-scrollbar-track{border-radius:10px}.noticejs::-webkit-scrollbar-thumb{background:hsla(0,0%,100%,.5);border-radius:10px}.noticejs::-webkit-scrollbar-thumb:hover{background:#fff}.noticejs-modal{position:fixed;width:100%;height:100%;background-color:#000;z-index:10000;opacity:.3;left:0;top:0}.noticejs-modal-open{opacity:0;animation:noticejs-modal-in .3s ease-out}.noticejs-modal-close{animation:noticejs-modal-out .3s ease-out;animation-fill-mode:forwards}.noticejs .special{background-color:rgb(160,37,160)}.noticejs .special .noticejs-heading{background-color:rgb(110,26,110);color:#fff;padding:10px}.noticejs .special .noticejs-body{color:#fff;padding:10px}.noticejs .special .noticejs-body:hover{visibility:visible !important}.noticejs .special .noticejs-content{visibility:visible}.noticejs .special .noticejs-progressbar{width:100%;background-color:rgb(160,37,160);margin-top:-1px}.noticejs .special .noticejs-progressbar .noticejs-bar{width:100%;height:5px;background:rgb(110,26,110)}/** * PostbirdAlertBox.js * - 原生javascript弹框插件 * Author: Postbird - http://www.ptbird.cn * License: MIT * Date: 2017-09-23 */.postbird-box-container { width: 100%; height: 100%; overflow: hidden; position: fixed; top: 0; left: 0; z-index: 9999; background-color: rgba(0, 0, 0, 0.2); display: block; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none}.postbird-box-container.active { display: block}.postbird-box-content { min-width: 400px; max-width: 600px; min-height: 150px; background-color: #fff; border: solid 1px #dfdfdf; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin-top: -100px}.postbird-box-header { width: 100%; padding: 10px 15px; position: relative; font-size: 1.1em; letter-spacing: 2px}.postbird-box-close-btn { cursor: pointer; font-weight: 700; color: #000; float: right; opacity: .5; font-size: 1.3em; margin-top: -3px; display: none}.postbird-box-close-btn:hover { opacity: 1}.postbird-box-text { box-sizing: border-box; width: 100%; padding: 0 10%; text-align: center; line-height: 40px; font-size: 20px; letter-spacing: 1px}.postbird-box-footer { width: 100%; position: absolute; padding: 0; margin: 0; bottom: 0; display: flex; display: -webkit-flex; justify-content: space-around; border-top: solid 1px #dfdfdf; align-items: flex-end}.postbird-box-footer .btn-footer { line-height: 44px; border: 0; cursor: pointer; background-color: #fff; color: #0e90d2; font-size: 1.1em; letter-spacing: 2px; transition: background-color .5s; -webkit-transition: background-color .5s; -o-transition: background-color .5s; -moz-transition: background-color .5s; outline: 0}.postbird-box-footer .btn-footer:hover { background-color: #e5e5e5}.postbird-box-footer .btn-block-footer { width: 100%}.postbird-box-footer .btn-left-footer,.postbird-box-footer .btn-right-footer { position: relative; width: 100%}.postbird-box-footer .btn-left-footer::after { content: ""; position: absolute; right: 0; top: 0; background-color: #e5e5e5; height: 100%; width: 1px}.postbird-box-footer .btn-footer-cancel { color: #333}.postbird-prompt-input { width: 100%; padding: 5px; font-size: 16px; border: 1px solid #ccc; outline: 0}.onoffswitch { position: relative; width: 45px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;}.onoffswitch-checkbox { position: absolute; opacity: 0; pointer-events: none;}.onoffswitch-label { display: block; overflow: hidden; cursor: pointer; height: 20px; padding: 0; line-height: 20px; border: 2px solid #E3E3E3; border-radius: 20px; background-color: #FFFFFF; transition: background-color 0.3s ease-in;}.onoffswitch-label:before { content: ""; display: block; width: 20px; margin: 0px; background: #FFFFFF; position: absolute; top: 0; bottom: 0; right: 23px; border: 2px solid #E3E3E3; border-radius: 20px; transition: all 0.3s ease-in 0s; }.onoffswitch-checkbox:checked + .onoffswitch-label { background-color: #3AAD38;}.onoffswitch-checkbox:checked + .onoffswitch-label, .onoffswitch-checkbox:checked + .onoffswitch-label:before { border-color: #3AAD38;}.onoffswitch-checkbox:checked + .onoffswitch-label:before { right: 0px; }.layui-timeline { padding-left: 5px;}.layui-timeline-item { position: relative; padding-bottom: 20px;}li { list-style: none;}.layui-timeline-item:first-child::before { display: block;}.layui-timeline-item:last-child::before { content: ''; position: absolute; left: 5px; top: 0; z-index: 0; width: 0; height: 100%;}.layui-timeline-item::before { content: ''; position: absolute; left: 5px; top: 0; z-index: 0; width: 1px; height: 100%;}.layui-timeline-item::before,hr { background-color: #e6e6e6;}.layui-timeline-axis { position: absolute; left: -5px; top: 0; z-index: 10; width: 20px; height: 20px; line-height: 20px; background-color: #fff; color: #5FB878; border-radius: 50%; text-align: center; cursor: pointer;}.layui-icon { font-family: layui-icon !important; font-size: 16px; font-style: normal;}.layui-timeline-content { padding-left: 25px;}.layui-text { line-height: 22px; font-size: 14px; color: rgb(85,85,85);}.layui-timeline-title { position: relative;}`));
document.head.appendChild(style);
}
// 全局变量及公共函数
var exTimer = 0; // 总时钟句柄
var url = document.getElementsByTagName('html')[0].innerHTML;
var urlLen = ("$ROOM.room_id =").length;
var ridPos = url.indexOf('$ROOM.room_id =');
var rid = url.substring(ridPos + urlLen, url.indexOf(';', ridPos + urlLen));
rid = rid.trim();
url = null;
urlLen = null;
ridPos = null;
var my_uid = getCookieValue("acf_uid"); // 自己的uid
var dyToken = getToken();
function showExPanel() {
// 显示功能条
let a = document.getElementsByClassName("ex-panel")[0];
if (a.style.display != "block") {
a.style.display = "block";
} else {
a.style.display = "none";
}
}
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
function formatSeconds(value) {
let secondTime = parseInt(value);
let minuteTime = 0;
let hourTime = 0;
if (secondTime > 60) {
minuteTime = parseInt(secondTime / 60);
secondTime = parseInt(secondTime % 60);
if (minuteTime > 60) {
hourTime = parseInt(minuteTime / 60);
minuteTime = parseInt(minuteTime % 60);
}
}
let result = "" + parseInt(secondTime) + "秒";
if (minuteTime > 0) {
result = "" + parseInt(minuteTime) + "分" + result;
}
if (hourTime > 0) {
result = "" + parseInt(hourTime) + "小时" + result;
}
return result;
}
function formatSeconds2(value) {
var secondTime = parseInt(value); // 秒
var minuteTime = 0; // 分
var hourTime = 0; // 小时
if (secondTime > 60) {
minuteTime = parseInt(secondTime / 60);
secondTime = parseInt(secondTime % 60);
if (minuteTime > 60) {
hourTime = parseInt(minuteTime / 60);
minuteTime = parseInt(minuteTime % 60);
}
}
var result ="" +(parseInt(secondTime) < 10? "0" + parseInt(secondTime): parseInt(secondTime));
// if (minuteTime > 0) {
result ="" + (parseInt(minuteTime) < 10? "0" + parseInt(minuteTime) : parseInt(minuteTime)) + ":" + result;
// }
// if (hourTime > 0) {
result ="" + (parseInt(hourTime) < 10 ? "0" + parseInt(hourTime): parseInt(hourTime)) +":" + result;
// }
return result;
}
async function verifyFans(room_id, level) {
return true; // 2020年12月22日18:28:18
let ret = false;
let doc = await fetch('https://www.douyu.com/member/cp/getFansBadgeList',{
method: 'GET',
mode: 'no-cors',
cache: 'default',
credentials: 'include',
}).then(res => {
return res.text();
}).catch(err => {
console.log("请求失败!", err);
})
doc = (new DOMParser()).parseFromString(doc, 'text/html');
let a = doc.getElementsByClassName("fans-badge-list")[0].lastElementChild;
let n = a.children.length;
for (let i = 0; i < n; i++) {
let rid = a.children[i].getAttribute("data-fans-room");
let rlv = a.children[i].getAttribute("data-fans-level");
if (rid == room_id && rlv >= level) {
ret = true;
break;
} else {
ret = false;
}
}
return ret;
}
function getStrMiddle(str, before, after) {
let m = str.match(new RegExp(before + '(.*?)' + after));
return m ? m[1] : false;
}
function getToken() {
// let cookie = document.cookie;
// let ret = getStrMiddle(cookie, "acf_uid=", ";") + "_" + getStrMiddle(cookie, "acf_biz=", ";") + "_" + getStrMiddle(cookie, "acf_stk=", ";") + "_" + getStrMiddle(cookie, "acf_ct=", ";") + "_" + getStrMiddle(cookie, "acf_ltkid=", ";");
let ret = getCookieValue("acf_uid") + "_" + getCookieValue("acf_biz") + "_" + getCookieValue("acf_stk") + "_" + getCookieValue("acf_ct") + "_" + getCookieValue("acf_ltkid");
return ret;
}
function getDyDid() {
// let cookie = document.cookie;
// let ret = getStrMiddle(cookie, "dy_did=", ";");
let ret = getCookieValue("dy_did");
return ret;
}
function setCookie(cookiename, value){
let exp = new Date();
exp.setTime(exp.getTime() + 3*60*60*1000);
document.cookie = cookiename + "="+ escape (value) + "; path=/; expires=" + exp.toGMTString();
}
function getCookieValue(name){
let arr,reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg)) {
return unescape(arr[2]);
} else {
return null;
}
}
function getCCN() {
// let cookie = document.cookie;
// let ret = getStrMiddle(cookie, "acf_ccn=", ";");
let ret = getCookieValue("acf_ccn");
if (ret == null) {
setCookie("acf_ccn", "1");
ret = "1";
}
return ret;
}
function getCTN() {
// let cookie = document.cookie;
// let ret = getStrMiddle(cookie, "acf_ccn=", ";");
let ret = getCookieValue("acf_ctn");
if (ret == null) {
setCookie("acf_ctn", "1");
ret = "1";
}
return ret;
}
function getCSRF() {
let ret = getCookieValue("cvl_csrf_token");
if (ret == null) {
setCookie("cvl_csrf_token", "1");
ret = "1";
}
return ret;
}
function getUID() {
let ret = getCookieValue("acf_uid");
return ret;
}
function showMessage(msg, type="success", options) {
// type: success[green] error[red] warning[orange] info[blue]
let option = {
text: msg,
type: type,
position: 'bottomLeft',
...options
}
new NoticeJs(option).show();
}
function openPage(url, b=true) {
GM_openInTab(url, {
active: b
});
}
function closePage() {
if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
window.location.href = "about:blank";
window.close();
} else {
window.opener = null;
window.open("", "_self");
window.close();
}
}
function getQueryString(name) {
let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
if (window.location.hash.indexOf("?") < 0) {
return null;
}
let r = window.location.hash.split("?")[1].match(reg);
if (r != null) return decodeURIComponent(r[2]);
return null;
}
function dateFormat(fmt, date) {
let o = {
"M+": date.getMonth() + 1,
"d+": date.getDate(),
"h+": date.getHours(),
"m+": date.getMinutes(),
"s+": date.getSeconds(),
"q+": Math.floor((date.getMonth() + 3) / 3),
"S": date.getMilliseconds()
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (let k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
function getRandom(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
function isRid(str) {
if (/^[0-9]+$/.test(str)) {
return true;
} else {
return false;
}
}
function getAvailableSheet(index) {
let ret = -1;
for (let i = index; i < document.styleSheets.length - index; i++) {
if (document.styleSheets[i].href == null) {
ret = i;
break;
} else {
ret = -1;
}
}
return ret;
}
function showMessageWindow(title, content, callback){
if(window.Notification && Notification.permission !== "denied") {
Notification.requestPermission(function(status) {
var notice_ = new Notification(title, { body: content });
notice_.onclick = function() {
callback();
}
});
}
}
function getUserName() {
return new Promise(resovle => {
fetch('https://www.douyu.com/member/cp',{
method: 'GET',
mode: 'no-cors',
credentials: 'include',
}).then(res => {
return res.text();
}).then(txt => {
txt = (new DOMParser()).parseFromString(txt, 'text/html');
let ret = txt.getElementsByClassName("uname_con")[0].title;
resovle(ret);
}).catch(err => {
console.error('请求失败', err);
})
})
}
function getTextareaPosition(element) {
// 获取textarea光标的位置
let cursorPos = 0;
if (document.selection) {//IE
let selectRange = document.selection.createRange();
selectRange.moveStart('character', -element.value.length);
cursorPos = selectRange.text.length;
} else if (element.selectionStart || element.selectionStart == '0') {
cursorPos = element.selectionStart;
}
return cursorPos;
}
function showExRightPanel(name) {
let panels = [
{
name: "弹幕发送小助手",
className: "bloop",
},
{
name: "扩展功能",
className: "extool",
},
{
name: "直播间工具",
className: "livetool",
},
{
name: "全站抽奖信息",
className: "exlottery"
},
];
for (let i = 0; i < panels.length; i++) {
let item = panels[i];
let dom = document.getElementsByClassName(item.className)[0];
if (dom) {
if (name === item.name) {
dom.style.display = dom.style.display !== "block" ? "block" : "none";
} else {
dom.style.display = "none";
}
}
}
}
function getTimeDiff(t1, t2) {
if (t1 < t2) {
return -1;
} else{
let ret = "";
let date3 = Math.abs(t1 - t2);
let days = Math.floor(date3/(24*3600*1000));
ret += days > 0 ? days + "天" : "";
let leave1 = date3%(24*3600*1000);
let hours = Math.floor(leave1/(3600*1000));
ret += hours > 0 ? hours + "时" : "";
let leave2 = leave1%(3600*1000);
let minutes = Math.floor(leave2/(60*1000));
ret += minutes > 0 ? minutes + "分" : "";
let leave3 = leave2%(60*1000);
let seconds = Math.round(leave3/1000);
ret += seconds > 0 ? seconds + "秒" : "";
return ret;
}
}
function debounce(func, wait) {
let timer;
return function() {
let context = this;
let args = arguments;
if (timer) clearTimeout(timer);
let callNow = !timer;
timer = setTimeout(() => {
timer = null;
}, wait)
if (callNow) func.apply(context, args);
}
}
let svg_accountList = `<svg t="1613993967937" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2122" width="16" height="16"><path d="M217.472 311.808l384.64 384.64-90.432 90.56-384.64-384.64z" fill="#8A8A8A" p-id="2123"></path><path d="M896.32 401.984l-384.64 384.64-90.56-90.496 384.64-384.64z" fill="#8A8A8A" p-id="2124"></path></svg>`
let cleanOverTimes = 0; // 用于判断是否全部清空并跳转
function initPkg_AccountList() {
// GM_deleteValue("Ex_accountList");
// GM_deleteValue("Ex_accountListPassport");
// return;
initPkg_AccountList_Dom();
initPkg_AccountList_Func();
}
function initPkg_AccountList_Dom() {
AccountList_insertIcon();
}
function AccountList_insertIcon() {
let a = document.createElement("div");
a.style = "position: absolute;right: -14px;top: 32px;cursor: pointer;"
a.id = "ex-accountList-icon";
let html = `
<div id="ex-accountList-wrap" class="public-DropMenu-drop">
<div class="public-DropMenu-drop-main">
<div id="ex-accountList-iframe"></div>
<div id="ex-accountList-iframe2"></div>
<div id="ex-accountList-content" style="width: 300px;font-size: 14px;padding: 10px;">
</div>
</div>
<i></i>
</div>
`;
a.innerHTML = svg_accountList + html;
// a.innerHTML = svg_accountList + `<div id="ex-accountList-wrap" class="public-DropMenu-drop"><div class="public-DropMenu-drop-main"><div style="width: 300px;font-size: 14px;"></div></div><i></i></div>`;
// a.title = "账号列表";
let b = document.getElementsByClassName("Header-right")[0];
b.appendChild(a);
addAccount();
}
function initPkg_AccountList_Func() {
setPassportCmd("null", my_uid);
unsafeWindow.addEventListener("message", (event) => {
switch (event.data) {
case "cleanOver":
setTimeout(() => {
window.location.reload();
}, 50);
break;
case "msgCleanOver":
cleanOverTimes++;
if (cleanOverTimes >= 5) {
cleanOverTimes = 0;
setTimeout(() => {
window.location.reload();
}, 50);
}
break;
case "yubaCleanOver":
cleanOverTimes++;
if (cleanOverTimes >= 5) {
cleanOverTimes = 0;
setTimeout(() => {
window.location.reload();
}, 50);
}
break;
case "videoCleanOver":
cleanOverTimes++;
if (cleanOverTimes >= 5) {
cleanOverTimes = 0;
setTimeout(() => {
window.location.reload();
}, 50);
}
break;
case "czCleanOver":
cleanOverTimes++;
if (cleanOverTimes >= 5) {
cleanOverTimes = 0;
setTimeout(() => {
window.location.reload();
}, 50);
}
break;
case "switchOver":
cleanOverTimes++;
if (cleanOverTimes >= 5) {
cleanOverTimes = 0;
setTimeout(() => {
window.location.reload();
}, 50);
}
break;
case "deleteOver":
renderAccountList();
showMessage("【账号管理】删除完毕", "success");
break;
default:
break;
}
})
}
function renderAccountList(obj) {
document.getElementById("ex-accountList-content").innerHTML = getAccountListHtml(obj);
let items = document.getElementsByClassName("ex-accountList-item");
for (let i = 0; i < items.length; i++) {
let item = items[i];
let uid = item.getAttribute("uid");
item.addEventListener("click", () => {
switchAccount(uid, () => {});
setPassportCmd("switch", uid);
setYubaAndMsgAndVideoClean();
})
item.getElementsByClassName("ex-accountList-item__btn")[0].addEventListener("click", (e) => {
e.stopPropagation();
showMessage("【账号管理】正在删除...", "info");
deleteAccount(uid, () => {});
setPassportCmd("delete", uid);
})
}
document.getElementById("ex-accountList-item-add").addEventListener("click", () => {
// 重新登录
cleanCookie(() => {})
setPassportCmd("clean", "null");
});
}
function getAccountListHtml(object) {
let obj = object == undefined ? JSON.parse(GM_getValue("Ex_accountList") || "{}") : object;
let ret = "";
for (const key in obj) {
if (key == "null") {
continue;
}
let item = obj[key];
ret += `
<div class="ex-accountList-item" uid="${item.uid}">
<div class="ex-accountList-item__imgWrap">
<img src=${decodeURIComponent(item.avatar) + "middle.jpg"} alt="" class="ex-accountList-item__img">
</div>
<div class="ex-accountList-item__name">${decodeURIComponent(item.nickname)}</div>
<div class="ex-accountList-item__btn">删除</div>
</div>`
}
ret += `
<div id="ex-accountList-item-add">
<svg t="1613995373702" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2832" width="32" height="32"><path d="M577.088 0H448.96v448.512H0v128h448.96V1024h128.128V576.512H1024v-128H577.088z" p-id="2833" fill="#8A8A8A"></path></svg>
</div>
`;
return ret;
}
function switchAccount(uid, callback) {
let list = JSON.parse(GM_getValue("Ex_accountList"));
// let l = list[uid]["data"];
let l = [];
let delock = 0;
GM_cookie("list", { path: "/" }, function(cookies) {
for(let i = 0; i < cookies.length; i++){
GM_cookie("delete", {name: cookies[i]["name"]}, function(error) {
delock++;
if (delock >= cookies.length) {
let addlock = 0;
for(let i = 0; i < l.length; i++){
GM_cookie("set", {
name: l[i]['name'],
value: l[i]['value'],
domain: l[i]['domain'],
path: l[i]['path'],
secure: l[i]['secure'],
httpOnly: l[i]['httpOnly'],
sameSite: l[i]['sameSite'],
expirationDate: l[i]['expirationDate'],
hostOnly: l[i]['hostOnly']
}, function(error) {
addlock++;
if (addlock >= l.length) {
callback();
};
});
}
};
});
}
});
};
function switchAccountPassport(uid, callback) {
let list = JSON.parse(GM_getValue("Ex_accountListPassport"));
// let l = Array(list.global).concat(list[uid]);
let l = list[uid];
let delock = 0;
GM_cookie("list", { path: "/" }, function(cookies) {
for(let i = 0; i < cookies.length; i++){
GM_cookie("delete", {name: cookies[i]["name"]}, function(error) {
delock++;
if (delock >= cookies.length) {
let addlock = 0;
for(let i = 0; i < l.length; i++){
GM_cookie("set", {
name: l[i]['name'],
value: l[i]['value'],
domain: l[i]['domain'],
path: l[i]['path'],
secure: l[i]['secure'],
httpOnly: l[i]['httpOnly'],
sameSite: l[i]['sameSite'],
expirationDate: l[i]['expirationDate'],
hostOnly: l[i]['hostOnly']
}, function(error) {
addlock++;
if (addlock >= l.length) {
callback();
};
});
}
};
});
}
});
};
// function switchAccountPassport( callback) {
// let l = JSON.parse(GM_getValue("Ex_accountListPassport"));
// let delock = 0;
// GM_cookie("list", { path: "/" }, function(cookies) {
// for(let i = 0; i < cookies.length; i++){
// GM_cookie("delete", {name: cookies[i]["name"]}, function(error) {
// delock++;
// if (delock >= cookies.length) {
// let addlock = 0;
// for(let i = 0; i < l.length; i++){
// GM_cookie("set", {
// name: l[i]['name'],
// value: l[i]['value'],
// domain: l[i]['domain'],
// path: l[i]['path'],
// secure: l[i]['secure'],
// httpOnly: l[i]['httpOnly'],
// sameSite: l[i]['sameSite'],
// expirationDate: l[i]['expirationDate'],
// hostOnly: l[i]['hostOnly']
// }, function(error) {
// addlock++;
// if (addlock >= l.length) {
// callback();
// };
// });
// }
// };
// });
// }
// });
// };
function addAccount() {
let accountListData = JSON.parse(GM_getValue("Ex_accountList") || "{}");
let item = {};
let uid = "";
GM_cookie("list", { path: "/" }, function(cookies) {
let c = [];
if (cookies == undefined) {
document.getElementById("ex-accountList-content").innerHTML = "请升级Tampermonkey版本<br/><a href='https://www.crx4chrome.com/crx/1429/'>点我升级,选择Crx4Chrome</a>";
return;
}
for(let i = 0; i < cookies.length; i++) {
let name = cookies[i]["name"];
let value = cookies[i]["value"];
if (name == "acf_nickname") {
item.nickname = value;
}
if (name == "acf_uid") {
item.uid = value;
uid = value;
}
if (name == "acf_avatar") {
item.avatar = value;
}
c.push(cookies[i]);
}
if (uid == "") {
item.uid = "null";
uid = "null";
}
item.data = c;
item.update_time = String(new Date().getTime());
accountListData[uid] = item;
GM_setValue("Ex_accountList", JSON.stringify(accountListData));
renderAccountList(accountListData);
});
};
function addAccountPassport(uid) {
let accountListData = JSON.parse(GM_getValue("Ex_accountListPassport") || "{}");
let private_arr = [];
let global_arr = [];
GM_cookie("list", { path: "/" }, function(cookies) {
if (cookies == undefined) {
return;
}
for(let i = 0; i < cookies.length; i++) {
if (cookies[i]["name"] == "LTP0") {
private_arr.push(cookies[i]);
} else {
global_arr.push(cookies[i]);
}
}
if (uid == "") {
uid = "null";
}
accountListData.global = null;
accountListData.global = global_arr;
accountListData[uid] = private_arr;
accountListData.update_time = String(new Date().getTime());
GM_setValue("Ex_accountListPassport", JSON.stringify(accountListData));
});
};
// function addAccountPassport() {
// GM_cookie("list", { path: "/" }, function(cookies) {
// let c = [];
// for(let i = 0; i < cookies.length; i++) {
// c.push(cookies[i]);
// }
// GM_setValue("Ex_accountListPassport", JSON.stringify(c));
// });
// };
function cleanCookie(callback) {
let lock = 0;
GM_cookie("list", {
path: "/"
}, (cookies) => {
if (cookies) {
for (let i = 0; i < cookies.length; i++) {
GM_cookie("delete", {
name: cookies[i]["name"]
}, function (error) {
lock++;
if (lock >= cookies.length){
callback();
}
});
}
} else {
callback();
}
});
}
function setPassportCmd(cmd, uid) {
document.getElementById("ex-accountList-iframe").innerHTML = `
<iframe id="login-passport-frame" width="100%" height="100%" scrolling="no" frameborder="0" src="https://passport.douyu.com/index/error/show404?&exid=chun&cmd=${cmd}&uid=${uid}&domain=${encodeURIComponent(window.location.href)}&"></iframe>
`;
}
function setYubaAndMsgAndVideoClean() {
document.getElementById("ex-accountList-iframe2").innerHTML = `
<iframe id="ex-yuba-iframe" width="100%" height="100%" scrolling="no" frameborder="0" src="https://yuba.douyu.com/iframe/tab/6416853?exClean&domain=${encodeURIComponent(window.location.href)}&"></iframe>
<iframe id="ex-msg-iframe" width="100%" height="100%" scrolling="no" frameborder="0" src="https://msg.douyu.com/web/index.html?exClean&domain=${encodeURIComponent(window.location.href)}&"></iframe>
<iframe id="ex-video-iframe" width="100%" height="100%" scrolling="no" frameborder="0" src="https://v.douyu.com/show/0?exClean&domain=${encodeURIComponent(window.location.href)}&"></iframe>
<iframe id="ex-cz-iframe" width="100%" height="100%" scrolling="no" frameborder="0" src="https://cz.douyu.com/item/gold?exClean&domain=${encodeURIComponent(window.location.href)}&"></iframe>
`
}
function deleteAccount(uid, callback) {
let obj = JSON.parse(GM_getValue("Ex_accountList") || "{}");
delete obj[uid];
GM_setValue("Ex_accountList", JSON.stringify(obj));
callback();
}
function deleteAccountPassport(uid, callback) {
let obj = JSON.parse(GM_getValue("Ex_accountListPassport") || "{}");
delete obj[uid];
GM_setValue("Ex_accountListPassport", JSON.stringify(obj));
callback();
}
function initPkg_AdVideo() {
initPkg_Sign_Ad_FishPond();
}
function initPkg_AdVideo_Xiaoxiaole() {
startGetXiaoxiaoleFishBall();
}
async function startGetXiaoxiaoleFishBall() {
let status = await getXiaoxiaoleStatus();
if (status.error == "0") {
let completeNum = Number(status.data['20201021xiaoxiaole_T1'].curCompleteNum);
let limitNum = Number(status.data['20201021xiaoxiaole_T1'].taskLimitNum);
let leftNum = limitNum - completeNum;
if (leftNum > 0) {
showMessage(`【消消乐】开始领取鱼丸,剩余${leftNum}次`, "info")
}
for (let i = 0; i < leftNum; i++) {
await getFishBall_Xiaoxiaole();
}
}
}
async function getFishBall_Xiaoxiaole() {
let adWatchcer = new DyWacthAd("1134396", dyToken, rid);
let isStart = await adWatchcer.start();
if (isStart == true) {
await sleep(15000).then(async () => {
let isFinish = await adWatchcer.finish();
if (isFinish == true) {
showMessage("【消消乐】成功领取40鱼丸", "success");
}
})
}
}
function getXiaoxiaoleStatus() {
return new Promise(resolve => {
fetch("https://www.douyu.com/japi/carnival/nc/actTask/userStatus", {
method: 'POST',
mode: 'no-cors',
credentials: 'include',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: `tasks=20201021xiaoxiaole_T1&token=${dyToken}`
}).then(res => {
return res.json();
}).then(ret => {
resolve(ret);
}).catch(err => {
console.log("请求失败!", err);
})
})
}
function initPkg_Sign_Ad_FishPond() {
getFishBall_Ad_FishPond();
}
function getFishBall_Ad_FishPond() {
GM_xmlhttpRequest({
method: "POST",
url: "https://apiv2.douyucdn.cn/japi/fishpoolTask/m/apinc/taskList?client_sys=android",
data: "rid=" + rid + "&token=" + dyToken,
responseType: "json",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
onload: async function(response) {
let panel = response.response.data.panel;
let ret = null;
for (let i = 0; i < panel.length; i++) {
if (panel[i].id == 37) {
// 每日活跃
ret = panel[i].taskList;
break;
}
}
if (!ret) {
return;
}
for (let i = 0; i < ret.length; i++) {
if (ret[i].task.id == "5578") {
if (ret[i].task.status == "3") {
// showMessage("【鱼塘鱼丸】已领取", "warning");
// initPkg_Sign_Ad_666();
initPkg_Sign_Ad_Yuba();
} else {
for (let j = 0; j < ret[i].task.max - ret[i].task.cur; j++) {
let posid_Ad_FishPond = "1114268";
let token = dyToken;
let uid = getUID();
let info = await getFishBall_Ad_FishPond_info(posid_Ad_FishPond, token, uid);
if (info == false) {
// initPkg_Sign_Ad_666();
initPkg_Sign_Ad_Yuba();
return;
}
let mid = info.mid;
let infoBack = info.infoBack;
let isStart = await getFishBall_Ad_FishPond_start(posid_Ad_FishPond, token, uid, mid, infoBack);
if (isStart == false) {
isStart = await getFishBall_Ad_FishPond_start(posid_Ad_FishPond, token, uid, mid, infoBack);
if (isStart == false) {
isStart = await getFishBall_Ad_FishPond_start(posid_Ad_FishPond, token, uid, mid, infoBack);
// 偷个懒,直接三次重试
}
}
if (isStart == true) {
showMessage("【鱼塘鱼丸】开始领取鱼塘鱼丸,需等待15秒", "info");
await sleep(15555).then(async () => {
let isFinish = await getFishBall_Ad_FishPond_finish(posid_Ad_FishPond, token, uid, mid, infoBack);
if (isFinish == false) {
isFinish = await getFishBall_Ad_FishPond_finish(posid_Ad_FishPond, token, uid, mid, infoBack);
if (isFinish == false) {
isFinish = await getFishBall_Ad_FishPond_finish(posid_Ad_FishPond, token, uid, mid, infoBack);
}
}
if (isFinish == true) {
// let isGet = await getFishBall_Ad_FishPond_Bubble(token);
showMessage("【鱼塘鱼丸】任务完成", "success");
}
})
}
}
// initPkg_Sign_Ad_666();
initPkg_Sign_Ad_Yuba();
}
}
}
}
});
}
function getFishBall_Ad_FishPond_info(posid_Ad_FishPond, token, uid) {
return new Promise(resolve => {
GM_xmlhttpRequest({
method: "POST",
url: "https://rtbapi.douyucdn.cn/japi/sign/app/getinfo?token=" + token + "&mdid=phone" + "&client_sys=android",
data: "posid=" + posid_Ad_FishPond + "&roomid=" + rid + "&cate1=1&cate2=1&chanid=30" + '&device={"nt":"1"}',
responseType: "json",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
onload: function(response) {
let ret = response.response;
if (ret.error == "0") {