-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathneteaseCCLiveCleaner.user.js
643 lines (642 loc) · 16.1 KB
/
neteaseCCLiveCleaner.user.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
// ==UserScript==
// @name 网易CC直播净化
// @namespace indefined
// @supportURL https://github.com/indefined/UserScripts/issues
// @version 0.1.17.1
// @description 自定义屏蔽CC直播HTML5网页大部分不想看到的碍眼特效和内容
// @author indefined
// @match *://cc.163.com/*
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-idle
// ==/UserScript==
(function() {
'use strict';
const configList = {
noWaterMask:{
title:'去除LOGO水印',
style:`
/*LOGO水印*/
.video-watermark {
display: none !important;
}
`
},
noPiP:{
title:'去除小窗口播放',
style:`
/*画中画小窗口按钮*/
#pic-in-pic-btn {
display: none !important;
}
`
},
miniBorder:{
title:'缩小播放器边距',
style:`
body {
min-width: unset !important;
}
/*网页导航栏高度调整*/
div#header {
height: 40px !important;
}
.header-center,
.menu-location,
.user-do-item:not(#searchBoss),
.user-do-item .def-font,
.my-info-label{
line-height: 30px !important;
height: 30px !important;
}
.padding-block .location-item {
margin: 0 5px;
}
.padding-block .menu-classification {
padding: 0;
}
div#searchBoss {
margin: -3px 0 0 0;
}
.my-info-label .my-info-portrait {
margin-top: 0 !important;
}
.anchor-live {
margin: 0 10px;
}
.hover-list {
top: 33px;
}
.header-match-rcm-imgswrap {
margin-top: -2px;
}
/*缩小标题栏高度后增加主框体高度*/
body:not(.blizzardtv-iframe-body) .main-container {
height: calc(100% - 40px) !important;
}
/*主框体对齐到顶部*/
body:not(.blizzardtv-iframe-body) .main-wrapper {
margin-top: 0px !important;
}
/*左侧栏,平时隐藏,同时播放器往左靠*/
.collapse .side-nav-collapse {
display: none;
}
.collapse .side-nav-container {
width: 0;
}
.collapse .side-nav-container+.page-right-container {
float: none !important;
width: 100% !important;
}
/*强制播放器主体无外边距*/
.scrollContainer ,
.room-main-container {
margin-top: 0 !important;
padding: 0 !important;
}
.main-container {
padding: 20px;
}
/*解除网页宽度限制*/
body.normal-game-room{
min-width: unset !important;
}
`
},
noFriendRooms:{
title:'去除好友房间',
style:`
/*播放器上方好友房间*/
ul.friend-rooms {
display: none;
}
`
},
noWebchat:{
title:'去除好友聊天',
style:`
/*好友聊天*/
div#webChat {
display: none;
}
`
},
noLimitAlert:{
title:'去除清晰度登录提醒',
action:'unloginUnlimit',
style:`
/*登录提醒*/
div#vbr-limit-alert {
display: none!important;
}
`
},
noLuckGift:{
title:'去除抽奖弹窗',
style:`
/*弹幕风暴(或者还有其它插件的容器*/
#pluginModal,
/*幸运抽奖*/
#lucky-lottery-modal{
display: none;
}
`
},
noPlayerHeightLimit:{
title:'解除播放器高度限制',
style:`
/*解除播放器高度锁定,根据网页宽度自动缩放*/
body:not(.blizzardtv-iframe-body) div#live_player {
height: 100% !important;
}
/*解除高度限制后停播状态的聊天区高度竟然需要手动指定,醉了
#chat {
height: calc(100% - 88px);
}
#chat>div {
height: 100%;
}
.chat-list {
height: calc(100% - 100px) !important;
}*/
`
},
noRecommend:{
title:'去除底部推荐',
style:`
div#recommend-module {
display: none !important;
}
`,
},
noDynamicMsg:{
title:'去除千里传音',
default:true,
style:`
/*网页千里传音*/
div#js-dynamic-msg-container {
display: none;
}
/*播放器内千里传音横幅*/
.qianli-banner-item.js-qianli-banner-item {
display: none;
}
/*播放器内的横幅,似乎有很多种*/
div#player-banner {
display: none;
}
/*去除千里传音后关注对齐到右侧*/
.follow-tool{
right: 10px !important;
}
/*工具对齐到左侧*/
.right-tools {
float: none;
position: static;
margin-left: 10px;
display: inline-block;
}
/*解除标题宽度限制*/
.anchor-nick,
span.js-live-title.nick{
max-width: unset !important;
}
.live-title .nick {
width: calc(100% - 230px) !important;
}
/*强制显示头像*/
.anchor-portrait-wrapper.anchor-portrait {
display: block !important;
}
`
},
noPlayerBanner:{
title:'去除播放器内横幅',
default:true,
style:`
/*播放器内的横幅,似乎有很多种*/
div#player-banner,
#new-player-banner,
/*<!-- 贵族视频区进场横幅 -->*/
div#nobility_screen_enter,
/*<!-- 坐骑动效和横幅动效 -->*/
div#mounts_player,
div#mounts_banner,
div#mounts_player_png,
/*<!-- 贵族开通升级续费动效 -->*/
div#nobility_upgrade,
/*<!-- 新游戏类型坐骑上线提醒弹窗 -->*/
div#newMountRemindWin {
display: none !important;
}
`
},
noPlayerAd:{
title:'去除播放器内广告',
default:true,
style:`
/*播放器超值守护?*/
#live_left_bottom_box_wrap,
/*播放器内广告*/
div#advertising {
display: none !important;
}
`
},
foldRank:{
title:'自动折叠榜单区',
default:true,
style:`
/*右侧榜单区,平时折叠*/
div#room-tabs {
height: 40px;
min-height: unset !important;
}
#room-tabs>div>div:not(:first-child) {
display: none !important;
}
/*鼠标悬停时展开榜单*/
div#room-tabs:hover>div>div[style*="display: block;"]{
display: block !important;
}
div#room-tabs:hover {
height: 190px;
}
.chat-list {
height: calc(100% - 46px) !important;
}
div#room-tabs:hover+.chat-list {
height: calc(100% - 190px);
}
/*网页全屏时隐藏公告*/
.gameH5TheaterBar .room-boardcast {
display: none;
}
.gameH5TheaterBar .room-tabs-chat-list {
height: calc(100% - 100px) !important;
}
`
},
noThreaterRank:{
title:'去除网页全屏榜单',
default:true,
style:`
/*网页全屏时隐藏公告和榜单*/
.gameH5TheaterBar .room-boardcast,
.gameH5TheaterBar #room-tabs{
display: none;
}
.gameH5TheaterBar .chat-list {
height: calc(100% - 4px) !important;
}
/*隐藏公告和榜单后*/
.gameH5TheaterBar .room-tabs-chat-list {
height: calc(100% - 100px);
}
`
},
noTheaterGiftBar:{
title:'去除网页全屏/全屏礼物栏',
style:`
/*网页全屏/全屏礼物栏*/
.gameH5Theater .user-tool-bar,
.gameH5FullScreen .user-tool-bar {
display: none !important;
}
.gameH5Theater div#live-wrapper ,
.gameFlashTheater #live_player,
.gameH5Theater #live_player,
.gameH5FullScreen div#live-wrapper {
height: 100% !important;
}
.gameH5FullScreen .show-controls {
bottom: 0 !important;
}
`
},
noFullAnchor:{
title:'去除全屏主播信息',
style:`
/*全屏关注消息*/
div#fullscreen-anchorInfo {
display: none !important;
}
`
},
noGiftBanner:{
title:'去除聊天区礼物横幅',
style:`
/*<!-- 礼物大动效展示区 -->*/
div#giftBigEffectWrap,
/*第一次*/
div#first-reward-panel,#first-reward-entry,
/*聊天区礼物连击*/
.gift-simp-banner.js-gift-simp-banner,
/*聊天区感谢礼物栏*/
div#gift-banner {
display: none !important;
}
`
},
noBoxDrop:{
title:'去除抢宝箱消息',
style:`
div#pluginModal,
/*<!-- 圣旨礼物掉落区 -->*/
div#decreeBoxDropWrap,
/*<!-- 圣旨礼物点击区 -->*/
div#decreeBoxShowWrap,
/*<!-- 周星宝箱掉落区 -->*/
div#weekStarBoxDropWrap,
/*<!-- 周星宝箱点击区 -->*/
div#weekStarBoxShowWrap,
/*<!-- 礼物宝箱掉落区 -->*/
div#giftBoxDropWrap,
/*<!-- 礼物宝箱点击区 -->*/
div#giftBoxShowWrap {
display: none !important;
}
`
},
noChatTip:{
title:'去除粉丝勋章',
style:`
/*粉丝勋章*/
.fansbadge-badge,
div.js-fans-medal-icon{
display: none !important;
}
`
},
noIcon:{
title:'去除用户前缀图标',
style:`
/*用户前缀图标*/
img[class*=personal-info-module],
a[class*=personal-info-module],
img[class*=riches-level-hover-tips],
li[class*=styles-module_msg]>img,
.chat_item>img,
.chat_item .chat_priv_img img,
.chat_item.notify>img{
display: none !important;
}
`
},
noMsgImg:{
title:'去除聊天图片',
style:`
/*聊天图片*/
[class*=styles-module_chatContent] img,
.chat_msg_content img {
display: none !important;
}
.chat_msg>img {
display: none !important;
}
`
},
noChatPriv:{
title:'去除聊天气泡',
style:`
/*聊天气泡同行,去除背景和聊天框*/
.chat_info,
.chat_msg_con,
.chat_msg_normal {
display: inline !important;
border: none !important;
background: none !important;
}
[class*="chat-bubble-module_bubble"]{
border: none !important;
padding: 0 !important;
background: none !important;
}
/*去除聊天气泡图片和换行*/
[class*="chat-bubble-module_adorn"],
.chat_msg>div,
.chat_item_bubble>div>br,
.chat_item_bubble>br{
display: none !important;
}
.chat_msg,
.chat_msg_normal>*{
display: inline !important;
background: none !important;
color: #000 !important;
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
`
},
noSendGift:{
title:'去除送礼消息',
style:`
/*聊天区礼物*/
li.gift_item {
display: none;
}
`
},
noWelcome:{
title:'去除欢迎消息',
style:`
/*进入房间欢迎消息*/
li.chat_item.notify.enter-room-notify,
/*骑士欢迎消息*/
.chat_item.activity-notify-nobility,
/*<!-- 贵族视频区进场横幅 -->*/
div#nobility_screen_enter,
/*<!-- 坐骑动效和横幅动效 -->*/
div#mounts_player,
div#mounts_banner,
div#mounts_player_png,
/*聊天区贵族欢迎消息*/
div#nobility_chat_enter {
display: none !important;
}
`
},
noFollow:{
title:'去除关注消息',
style:`
/*关注消息*/
.follow-anchor-notify {
display: none;
}
`
},
noSysMsg:{
title:'去除系统消息',
style:`
/*管理员消息*/
li.chat_item.admin-notify {
display: none;
}
/*活动消息*/
li.chat_item.notify.activity-notify {
display: none;
}
`
},
noNotChat:{
title:'去除其它非聊天消息',
style:`
.screen-msg-wrap>li:not(.chat_item) {
display:none;
}
`
},
noShout:{
title:'去除喇叭消息',
style:`
/*聊天区喇叭消息*/
.bun-shout-dynamic-area {
display: none !important;
}
`
},
noDMStash:{
title:'去除弹幕点赞/引用',
style:`
span.comment-stash-group-warpper,
.comment-stash-group {
display: none !important;
}
div.comment-canvas>* {
pointer-events: none !important;
}
`
},
noDMStorm:{
title:'去除弹幕风暴',
style:`
.cmt .storm_bulletScreen_icon,
.cmt .storm_bulletScreen_icon+span{
display: none !important;
}
`
},
noDMColor:{
title:'去除弹幕颜色',
style:`
/*弹幕*/
.cmt {
color: #fff !important;
}
`
},
noDMBullet:{
title:'去除弹幕气泡',
style:`
/*弹幕气泡,去除所有弹幕下的背景边框并隐藏所有弹幕下图片*/
.cmt *{
display: inline !important;
background: none !important;
border: none !important;
padding: 0 5px 0 !important;
margin: 0 !important;
}
.cmt img{
display: none !important;
}
/*喊话气泡,不知道内部怎么样的*/
div#bunShoutDynamic{}
`
},
};
const CCLiveCleaner = {
styleDiv:undefined,
configDiv:document.querySelector('ul.ban-effect-list'),
config:(()=>{
try{
if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_getValue)) {
return JSON.parse(GM_getValue('ccLiveConfig','{}'));
}
else {
return JSON.parse(localStorage.getItem('ccLiveConfig')||'{}');
}
}catch(e){
console.error('CC直播净化:读取配置失败,使用默认配置',e);
return {};
}
})(),
saveConfig(){
for(const i in this.config) {
if(!configList[i]) delete this.config[i];
}
try{
if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_setValue)){
GM_setValue('ccLiveConfig',JSON.stringify(this.config));
}
else {
localStorage.setItem('ccLiveConfig',JSON.stringify(this.config));
}
}catch(e){
console.error('CC直播净化:存储配置失败',e);
}
},
applyConfig(){
let styleContent = '';
for(const i in configList) {
if(
this.config[i] ||
(this.config[i]==undefined&&configList[i].default)
) styleContent += configList[i].style;
}
this.styleDiv.innerHTML = styleContent;
},
changeConfig(target){
target.classList.toggle('selected');
this.config[target.id] = target.classList.contains('selected');
this.applyConfig();
this.saveConfig();
},
createItem(id,config){
const item = document.createElement('li');
item.id = id;
item.innerHTML = '<i></i>'+config.title;
item.className = (this.config[id]||(this.config[id]==undefined&&config.default))?'selected':'';
item.onclick = ({target})=>this.changeConfig(target);
this.configDiv.appendChild(item);
},
initSettingPanel(){
if(this.configDiv && !this.configDiv.dataset.inited) {
this.configDiv.dataset.inited = true;
this.configDiv.style = "max-height:calc(100vh - 200px);overflow:auto";
for(const id in configList) {
this.createItem(id,configList[id]);
}
}
},
init(){
if (document.querySelector('.js-main-container')) {
this.styleDiv = document.createElement('style');
document.head.appendChild(this.styleDiv);
this.applyConfig();
}
if(this.configDiv) {
this.initSettingPanel();
}
else {
new MutationObserver((mutations, observer)=>{
//console.log(mutations)
for (const mutation of mutations){
if(!mutation.target) continue;
if(/effectSwitch/.test(mutation.target.id)){
observer.disconnect();
this.configDiv = document.querySelector('ul.ban-effect-list');
return this.initSettingPanel();
}
}
}).observe(document.body,{
childList: true,
subtree: true,
});
}
}
};
CCLiveCleaner.init();
})();