网易CC直播净化

自定义屏蔽CC直播HTML5网页大部分不想看到的碍眼特效和内容

  1. // ==UserScript==
  2. // @name 网易CC直播净化
  3. // @namespace indefined
  4. // @supportURL https://github.com/indefined/UserScripts/issues
  5. // @version 0.1.17.1
  6. // @description 自定义屏蔽CC直播HTML5网页大部分不想看到的碍眼特效和内容
  7. // @author indefined
  8. // @match *://cc.163.com/*
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @run-at document-idle
  12. // ==/UserScript==
  13. (function() {
  14. 'use strict';
  15. const configList = {
  16. noWaterMask:{
  17. title:'去除LOGO水印',
  18. style:`
  19. /*LOGO水印*/
  20. .video-watermark {
  21. display: none !important;
  22. }
  23. `
  24. },
  25. noPiP:{
  26. title:'去除小窗口播放',
  27. style:`
  28. /*画中画小窗口按钮*/
  29. #pic-in-pic-btn {
  30. display: none !important;
  31. }
  32. `
  33. },
  34. miniBorder:{
  35. title:'缩小播放器边距',
  36. style:`
  37. body {
  38. min-width: unset !important;
  39. }
  40. /*网页导航栏高度调整*/
  41. div#header {
  42. height: 40px !important;
  43. }
  44. .header-center,
  45. .menu-location,
  46. .user-do-item:not(#searchBoss),
  47. .user-do-item .def-font,
  48. .my-info-label{
  49. line-height: 30px !important;
  50. height: 30px !important;
  51. }
  52. .padding-block .location-item {
  53. margin: 0 5px;
  54. }
  55. .padding-block .menu-classification {
  56. padding: 0;
  57. }
  58. div#searchBoss {
  59. margin: -3px 0 0 0;
  60. }
  61. .my-info-label .my-info-portrait {
  62. margin-top: 0 !important;
  63. }
  64. .anchor-live {
  65. margin: 0 10px;
  66. }
  67. .hover-list {
  68. top: 33px;
  69. }
  70. .header-match-rcm-imgswrap {
  71. margin-top: -2px;
  72. }
  73. /*缩小标题栏高度后增加主框体高度*/
  74. body:not(.blizzardtv-iframe-body) .main-container {
  75. height: calc(100% - 40px) !important;
  76. }
  77. /*主框体对齐到顶部*/
  78. body:not(.blizzardtv-iframe-body) .main-wrapper {
  79. margin-top: 0px !important;
  80. }
  81. /*左侧栏,平时隐藏,同时播放器往左靠*/
  82. .collapse .side-nav-collapse {
  83. display: none;
  84. }
  85. .collapse .side-nav-container {
  86. width: 0;
  87. }
  88. .collapse .side-nav-container+.page-right-container {
  89. float: none !important;
  90. width: 100% !important;
  91. }
  92. /*强制播放器主体无外边距*/
  93. .scrollContainer ,
  94. .room-main-container {
  95. margin-top: 0 !important;
  96. padding: 0 !important;
  97. }
  98. .main-container {
  99. padding: 20px;
  100. }
  101. /*解除网页宽度限制*/
  102. body.normal-game-room{
  103. min-width: unset !important;
  104. }
  105. `
  106. },
  107. noFriendRooms:{
  108. title:'去除好友房间',
  109. style:`
  110. /*播放器上方好友房间*/
  111. ul.friend-rooms {
  112. display: none;
  113. }
  114. `
  115. },
  116. noWebchat:{
  117. title:'去除好友聊天',
  118. style:`
  119. /*好友聊天*/
  120. div#webChat {
  121. display: none;
  122. }
  123. `
  124. },
  125. noLimitAlert:{
  126. title:'去除清晰度登录(不可用)提醒',
  127. action:'unloginUnlimit',
  128. style:`
  129. /*登录(不可用)提醒*/
  130. div#vbr-limit-alert {
  131. display: none!important;
  132. }
  133. `
  134. },
  135. noLuckGift:{
  136. title:'去除抽奖弹窗',
  137. style:`
  138. /*弹幕风暴(或者还有其它插件的容器*/
  139. #pluginModal,
  140. /*幸运抽奖*/
  141. #lucky-lottery-modal{
  142. display: none;
  143. }
  144. `
  145. },
  146. noPlayerHeightLimit:{
  147. title:'解除播放器高度限制',
  148. style:`
  149. /*解除播放器高度锁定,根据网页宽度自动缩放*/
  150. body:not(.blizzardtv-iframe-body) div#live_player {
  151. height: 100% !important;
  152. }
  153. /*解除高度限制后停播状态的聊天区高度竟然需要手动指定,醉了
  154. #chat {
  155. height: calc(100% - 88px);
  156. }
  157. #chat>div {
  158. height: 100%;
  159. }
  160. .chat-list {
  161. height: calc(100% - 100px) !important;
  162. }*/
  163. `
  164. },
  165. noRecommend:{
  166. title:'去除底部推荐',
  167. style:`
  168. div#recommend-module {
  169. display: none !important;
  170. }
  171. `,
  172. },
  173. noDynamicMsg:{
  174. title:'去除千里传音',
  175. default:true,
  176. style:`
  177. /*网页千里传音*/
  178. div#js-dynamic-msg-container {
  179. display: none;
  180. }
  181. /*播放器内千里传音横幅*/
  182. .qianli-banner-item.js-qianli-banner-item {
  183. display: none;
  184. }
  185. /*播放器内的横幅,似乎有很多种*/
  186. div#player-banner {
  187. display: none;
  188. }
  189. /*去除千里传音后关注对齐到右侧*/
  190. .follow-tool{
  191. right: 10px !important;
  192. }
  193. /*工具对齐到左侧*/
  194. .right-tools {
  195. float: none;
  196. position: static;
  197. margin-left: 10px;
  198. display: inline-block;
  199. }
  200. /*解除标题宽度限制*/
  201. .anchor-nick,
  202. span.js-live-title.nick{
  203. max-width: unset !important;
  204. }
  205. .live-title .nick {
  206. width: calc(100% - 230px) !important;
  207. }
  208. /*强制显示头像*/
  209. .anchor-portrait-wrapper.anchor-portrait {
  210. display: block !important;
  211. }
  212. `
  213. },
  214. noPlayerBanner:{
  215. title:'去除播放器内横幅',
  216. default:true,
  217. style:`
  218. /*播放器内的横幅,似乎有很多种*/
  219. div#player-banner,
  220. #new-player-banner,
  221. /*<!-- 贵族视频区进场横幅 -->*/
  222. div#nobility_screen_enter,
  223. /*<!-- 坐骑动效和横幅动效 -->*/
  224. div#mounts_player,
  225. div#mounts_banner,
  226. div#mounts_player_png,
  227. /*<!-- 贵族开通升级续费动效 -->*/
  228. div#nobility_upgrade,
  229. /*<!-- 新游戏类型坐骑上线提醒弹窗 -->*/
  230. div#newMountRemindWin {
  231. display: none !important;
  232. }
  233. `
  234. },
  235. noPlayerAd:{
  236. title:'去除播放器内广告',
  237. default:true,
  238. style:`
  239. /*播放器超值守护?*/
  240. #live_left_bottom_box_wrap,
  241. /*播放器内广告*/
  242. div#advertising {
  243. display: none !important;
  244. }
  245. `
  246. },
  247. foldRank:{
  248. title:'自动折叠榜单区',
  249. default:true,
  250. style:`
  251. /*右侧榜单区,平时折叠*/
  252. div#room-tabs {
  253. height: 40px;
  254. min-height: unset !important;
  255. }
  256. #room-tabs>div>div:not(:first-child) {
  257. display: none !important;
  258. }
  259.  
  260. /*鼠标悬停时展开榜单*/
  261. div#room-tabs:hover>div>div[style*="display: block;"]{
  262. display: block !important;
  263. }
  264. div#room-tabs:hover {
  265. height: 190px;
  266. }
  267. .chat-list {
  268. height: calc(100% - 46px) !important;
  269. }
  270. div#room-tabs:hover+.chat-list {
  271. height: calc(100% - 190px);
  272. }
  273. /*网页全屏时隐藏公告*/
  274. .gameH5TheaterBar .room-boardcast {
  275. display: none;
  276. }
  277. .gameH5TheaterBar .room-tabs-chat-list {
  278. height: calc(100% - 100px) !important;
  279. }
  280. `
  281. },
  282. noThreaterRank:{
  283. title:'去除网页全屏榜单',
  284. default:true,
  285. style:`
  286. /*网页全屏时隐藏公告和榜单*/
  287. .gameH5TheaterBar .room-boardcast,
  288. .gameH5TheaterBar #room-tabs{
  289. display: none;
  290. }
  291. .gameH5TheaterBar .chat-list {
  292. height: calc(100% - 4px) !important;
  293. }
  294. /*隐藏公告和榜单后*/
  295. .gameH5TheaterBar .room-tabs-chat-list {
  296. height: calc(100% - 100px);
  297. }
  298. `
  299. },
  300. noTheaterGiftBar:{
  301. title:'去除网页全屏/全屏礼物栏',
  302. style:`
  303. /*网页全屏/全屏礼物栏*/
  304. .gameH5Theater .user-tool-bar,
  305. .gameH5FullScreen .user-tool-bar {
  306. display: none !important;
  307. }
  308. .gameH5Theater div#live-wrapper ,
  309. .gameFlashTheater #live_player,
  310. .gameH5Theater #live_player,
  311. .gameH5FullScreen div#live-wrapper {
  312. height: 100% !important;
  313. }
  314. .gameH5FullScreen .show-controls {
  315. bottom: 0 !important;
  316. }
  317. `
  318. },
  319. noFullAnchor:{
  320. title:'去除全屏主播信息',
  321. style:`
  322. /*全屏关注消息*/
  323. div#fullscreen-anchorInfo {
  324. display: none !important;
  325. }
  326. `
  327. },
  328. noGiftBanner:{
  329. title:'去除聊天区礼物横幅',
  330. style:`
  331. /*<!-- 礼物大动效展示区 -->*/
  332. div#giftBigEffectWrap,
  333. /*第一次*/
  334. div#first-reward-panel,#first-reward-entry,
  335. /*聊天区礼物连击*/
  336. .gift-simp-banner.js-gift-simp-banner,
  337. /*聊天区感谢礼物栏*/
  338. div#gift-banner {
  339. display: none !important;
  340. }
  341. `
  342. },
  343. noBoxDrop:{
  344. title:'去除抢宝箱消息',
  345. style:`
  346. div#pluginModal,
  347. /*<!-- 圣旨礼物掉落区 -->*/
  348. div#decreeBoxDropWrap,
  349. /*<!-- 圣旨礼物点击区 -->*/
  350. div#decreeBoxShowWrap,
  351. /*<!-- 周星宝箱掉落区 -->*/
  352. div#weekStarBoxDropWrap,
  353. /*<!-- 周星宝箱点击区 -->*/
  354. div#weekStarBoxShowWrap,
  355. /*<!-- 礼物宝箱掉落区 -->*/
  356. div#giftBoxDropWrap,
  357. /*<!-- 礼物宝箱点击区 -->*/
  358. div#giftBoxShowWrap {
  359. display: none !important;
  360. }
  361. `
  362. },
  363. noChatTip:{
  364. title:'去除粉丝勋章',
  365. style:`
  366. /*粉丝勋章*/
  367. .fansbadge-badge,
  368. div.js-fans-medal-icon{
  369. display: none !important;
  370. }
  371. `
  372. },
  373. noIcon:{
  374. title:'去除用户前缀图标',
  375. style:`
  376. /*用户前缀图标*/
  377. img[class*=personal-info-module],
  378. a[class*=personal-info-module],
  379. img[class*=riches-level-hover-tips],
  380. li[class*=styles-module_msg]>img,
  381. .chat_item>img,
  382. .chat_item .chat_priv_img img,
  383. .chat_item.notify>img{
  384. display: none !important;
  385. }
  386. `
  387. },
  388. noMsgImg:{
  389. title:'去除聊天图片',
  390. style:`
  391. /*聊天图片*/
  392. [class*=styles-module_chatContent] img,
  393. .chat_msg_content img {
  394. display: none !important;
  395. }
  396. .chat_msg>img {
  397. display: none !important;
  398. }
  399. `
  400. },
  401. noChatPriv:{
  402. title:'去除聊天气泡',
  403. style:`
  404. /*聊天气泡同行,去除背景和聊天框*/
  405. .chat_info,
  406. .chat_msg_con,
  407. .chat_msg_normal {
  408. display: inline !important;
  409. border: none !important;
  410. background: none !important;
  411. }
  412. [class*="chat-bubble-module_bubble"]{
  413. border: none !important;
  414. padding: 0 !important;
  415. background: none !important;
  416. }
  417. /*去除聊天气泡图片和换行*/
  418. [class*="chat-bubble-module_adorn"],
  419. .chat_msg>div,
  420. .chat_item_bubble>div>br,
  421. .chat_item_bubble>br{
  422. display: none !important;
  423. }
  424. .chat_msg,
  425. .chat_msg_normal>*{
  426. display: inline !important;
  427. background: none !important;
  428. color: #000 !important;
  429. border: none !important;
  430. padding: 0 !important;
  431. margin: 0 !important;
  432. }
  433. `
  434. },
  435. noSendGift:{
  436. title:'去除送礼消息',
  437. style:`
  438. /*聊天区礼物*/
  439. li.gift_item {
  440. display: none;
  441. }
  442. `
  443. },
  444. noWelcome:{
  445. title:'去除欢迎消息',
  446. style:`
  447. /*进入房间欢迎消息*/
  448. li.chat_item.notify.enter-room-notify,
  449. /*骑士欢迎消息*/
  450. .chat_item.activity-notify-nobility,
  451. /*<!-- 贵族视频区进场横幅 -->*/
  452. div#nobility_screen_enter,
  453. /*<!-- 坐骑动效和横幅动效 -->*/
  454. div#mounts_player,
  455. div#mounts_banner,
  456. div#mounts_player_png,
  457. /*聊天区贵族欢迎消息*/
  458. div#nobility_chat_enter {
  459. display: none !important;
  460. }
  461. `
  462. },
  463. noFollow:{
  464. title:'去除关注消息',
  465. style:`
  466. /*关注消息*/
  467. .follow-anchor-notify {
  468. display: none;
  469. }
  470. `
  471. },
  472. noSysMsg:{
  473. title:'去除系统消息',
  474. style:`
  475. /*管理员消息*/
  476. li.chat_item.admin-notify {
  477. display: none;
  478. }
  479. /*活动消息*/
  480. li.chat_item.notify.activity-notify {
  481. display: none;
  482. }
  483. `
  484. },
  485. noNotChat:{
  486. title:'去除其它非聊天消息',
  487. style:`
  488. .screen-msg-wrap>li:not(.chat_item) {
  489. display:none;
  490. }
  491. `
  492. },
  493. noShout:{
  494. title:'去除喇叭消息',
  495. style:`
  496. /*聊天区喇叭消息*/
  497. .bun-shout-dynamic-area {
  498. display: none !important;
  499. }
  500. `
  501. },
  502. noDMStash:{
  503. title:'去除弹幕点赞/引用',
  504. style:`
  505. span.comment-stash-group-warpper,
  506. .comment-stash-group {
  507. display: none !important;
  508. }
  509. div.comment-canvas>* {
  510. pointer-events: none !important;
  511. }
  512. `
  513. },
  514. noDMStorm:{
  515. title:'去除弹幕风暴',
  516. style:`
  517. .cmt .storm_bulletScreen_icon,
  518. .cmt .storm_bulletScreen_icon+span{
  519. display: none !important;
  520. }
  521. `
  522. },
  523. noDMColor:{
  524. title:'去除弹幕颜色',
  525. style:`
  526. /*弹幕*/
  527. .cmt {
  528. color: #fff !important;
  529. }
  530. `
  531. },
  532. noDMBullet:{
  533. title:'去除弹幕气泡',
  534. style:`
  535. /*弹幕气泡,去除所有弹幕下的背景边框并隐藏所有弹幕下图片*/
  536. .cmt *{
  537. display: inline !important;
  538. background: none !important;
  539. border: none !important;
  540. padding: 0 5px 0 !important;
  541. margin: 0 !important;
  542. }
  543. .cmt img{
  544. display: none !important;
  545. }
  546. /*喊话气泡,不知道内部怎么样的*/
  547. div#bunShoutDynamic{}
  548. `
  549. },
  550. };
  551. const CCLiveCleaner = {
  552. styleDiv:undefined,
  553. configDiv:document.querySelector('ul.ban-effect-list'),
  554. config:(()=>{
  555. try{
  556. if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_getValue)) {
  557. return JSON.parse(GM_getValue('ccLiveConfig','{}'));
  558. }
  559. else {
  560. return JSON.parse(localStorage.getItem('ccLiveConfig')||'{}');
  561. }
  562. }catch(e){
  563. console.error('CC直播净化:读取配置失败,使用默认配置',e);
  564. return {};
  565. }
  566. })(),
  567. saveConfig(){
  568. for(const i in this.config) {
  569. if(!configList[i]) delete this.config[i];
  570. }
  571. try{
  572. if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_setValue)){
  573. GM_setValue('ccLiveConfig',JSON.stringify(this.config));
  574. }
  575. else {
  576. localStorage.setItem('ccLiveConfig',JSON.stringify(this.config));
  577. }
  578. }catch(e){
  579. console.error('CC直播净化:存储配置失败',e);
  580. }
  581. },
  582. applyConfig(){
  583. let styleContent = '';
  584. for(const i in configList) {
  585. if(
  586. this.config[i] ||
  587. (this.config[i]==undefined&&configList[i].default)
  588. ) styleContent += configList[i].style;
  589. }
  590. this.styleDiv.innerHTML = styleContent;
  591. },
  592. changeConfig(target){
  593. target.classList.toggle('selected');
  594. this.config[target.id] = target.classList.contains('selected');
  595. this.applyConfig();
  596. this.saveConfig();
  597. },
  598. createItem(id,config){
  599. const item = document.createElement('li');
  600. item.id = id;
  601. item.innerHTML = '<i></i>'+config.title;
  602. item.className = (this.config[id]||(this.config[id]==undefined&&config.default))?'selected':'';
  603. item.onclick = ({target})=>this.changeConfig(target);
  604. this.configDiv.appendChild(item);
  605. },
  606. initSettingPanel(){
  607. if(this.configDiv && !this.configDiv.dataset.inited) {
  608. this.configDiv.dataset.inited = true;
  609. this.configDiv.style = "max-height:calc(100vh - 200px);overflow:auto";
  610. for(const id in configList) {
  611. this.createItem(id,configList[id]);
  612. }
  613. }
  614. },
  615. init(){
  616. if (document.querySelector('.js-main-container')) {
  617. this.styleDiv = document.createElement('style');
  618. document.head.appendChild(this.styleDiv);
  619. this.applyConfig();
  620. }
  621. if(this.configDiv) {
  622. this.initSettingPanel();
  623. }
  624. else {
  625. new MutationObserver((mutations, observer)=>{
  626. //console.log(mutations)
  627. for (const mutation of mutations){
  628. if(!mutation.target) continue;
  629. if(/effectSwitch/.test(mutation.target.id)){
  630. observer.disconnect();
  631. this.configDiv = document.querySelector('ul.ban-effect-list');
  632. return this.initSettingPanel();
  633. }
  634. }
  635. }).observe(document.body,{
  636. childList: true,
  637. subtree: true,
  638. });
  639. }
  640. }
  641. };
  642. CCLiveCleaner.init();
  643. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址