网易CC直播净化

自定义屏蔽CC直播HTML5网页大部分不想看到的东西

目前为 2019-05-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 网易CC直播净化
  3. // @namespace indefined
  4. // @supportURL https://github.com/indefined/UserScripts/issues
  5. // @version 0.1.2
  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-watermask {
  21. display: none;
  22. }
  23. `
  24. },
  25. miniBorder:{
  26. title:'缩小播放器边距',
  27. style:`
  28. /*网页标题栏高度*/
  29. div#header {
  30. height: 30px !important;
  31. }
  32. .header-center {
  33. height: 30px !important;
  34. }
  35. .hover-list {
  36. top: 30px;
  37. }
  38. .padding-block .location-item {
  39. margin: 0 5px;
  40. font-size: 15px;
  41. }
  42. .padding-block .menu-classification {
  43. padding: 0;
  44. }
  45. .menu-location {
  46. height: 30px !important;
  47. }
  48. div#searchBoss {
  49. margin: 0;
  50. }
  51. .user-do-item {
  52. line-height: 30px !important;
  53. }
  54. .anchor-live {
  55. margin: 0 10px;
  56. }
  57. .header-match-rcm-imgs,
  58. .header-match-rcm-imgs .match-rcm-imgs-list .match-rcm-imgs-item,
  59. .header-match-rcm-imgs .match-rcm-imgs-list .match-rcm-imgs-item a,
  60. .header-match-rcm-imgs .match-rcm-imgs-list .match-rcm-imgs-item img {
  61. height: 16px;
  62. width: 25px;
  63. }
  64. .header-match-rcm-imgs .match-rcm-imgs-list .match-rcm-imgs-item img {
  65. background-size: cover;
  66. }
  67. .header-match-rcm-imgswrap .match-arrow-left {
  68. margin-top: 6px !important;
  69. }
  70. /*缩小标题栏高度后增加主框体高度*/
  71. body:not(.blizzardtv-iframe-body) .main-container {
  72. height: calc(100% - 30px) !important;
  73. }
  74. /*主框体对齐到顶部*/
  75. body:not(.blizzardtv-iframe-body) .main-wrapper {
  76. margin-top: 0px !important;
  77. }
  78. /*左侧栏,平时隐藏,同时播放器往左靠*/
  79. .collapse .side-nav-collapse {
  80. display: none;
  81. }
  82. .collapse .side-nav-container {
  83. width: 0;
  84. }
  85. .collapse .side-nav-container+.main-container {
  86. padding-left: 20px;
  87. }
  88. /*强制播放器主体无外边距*/
  89. main.room-main-container {
  90. padding: 0 20px 0 0!important;
  91. }
  92. `
  93. },
  94. noFriendRooms:{
  95. title:'去除好友房间',
  96. style:`
  97. /*播放器上方好友房间*/
  98. ul.friend-rooms {
  99. display: none;
  100. }
  101. `
  102. },
  103. noWebchat:{
  104. title:'去除好友聊天',
  105. style:`
  106. /*好友聊天*/
  107. div#webChat {
  108. display: none;
  109. }
  110. `
  111. },
  112. noLimitAlert:{
  113. title:'去除清晰度登录(不可用)提醒',
  114. action:'unloginUnlimit',
  115. style:`
  116. /*登录(不可用)提醒*/
  117. div#vbr-limit-alert {
  118. display: none!important;
  119. }
  120. `
  121. },
  122. noLuckGift:{
  123. title:'去除幸运抽奖',
  124. style:`
  125. /*幸运抽奖*/
  126. #lucky-lottery-modal{
  127. display: none;
  128. }
  129. `
  130. },
  131. noPlayerHeightLimit:{
  132. title:'解除播放器高度限制',
  133. style:`
  134. /*解除播放器高度锁定,根据网页宽度自动缩放*/
  135. body:not(.blizzardtv-iframe-body) div#live_player {
  136. height: unset !important;
  137. }
  138. /*解除高度限制后停播状态的聊天区高度竟然需要手动指定,醉了
  139. #chat {
  140. height: calc(100% - 88px);
  141. }
  142. #chat>div {
  143. height: 100%;
  144. }
  145. .chat-list {
  146. height: calc(100% - 100px) !important;
  147. }*/
  148. `
  149. },
  150. noDynamicMsg:{
  151. title:'去除千里传音',
  152. default:true,
  153. style:`
  154. /*网页千里传音*/
  155. div#js-dynamic-msg-container {
  156. display: none;
  157. }
  158. /*播放器内千里传音横幅*/
  159. .qianli-banner-item.js-qianli-banner-item {
  160. display: none;
  161. }
  162. /*播放器内的横幅,似乎有很多种*/
  163. div#player-banner {
  164. display: none;
  165. }
  166. /*去除千里传音后关注对齐到右侧*/
  167. .follow-tool{
  168. right: 10px !important;
  169. }
  170. /*工具对齐到左侧*/
  171. .right-tools {
  172. float: none;
  173. position: static;
  174. margin-left: 10px;
  175. display: inline-block;
  176. }
  177. /*解除标题宽度限制*/
  178. .anchor-nick,
  179. span.js-live-title.nick{
  180. max-width: unset !important;
  181. }
  182. .live-title .nick {
  183. width: calc(100% - 230px) !important;
  184. }
  185. /*强制显示头像*/
  186. .anchor-portrait-wrapper.anchor-portrait {
  187. display: block !important;
  188. }
  189. `
  190. },
  191. noPlayerBanner:{
  192. title:'去除播放器内横幅',
  193. default:true,
  194. style:`
  195. /*播放器内的横幅,似乎有很多种*/
  196. div#player-banner,
  197. /*<!-- 贵族视频区进场横幅 -->*/
  198. div#nobility_screen_enter,
  199. /*<!-- 坐骑动效和横幅动效 -->*/
  200. div#mounts_player,
  201. div#mounts_banner,
  202. div#mounts_player_png,
  203. /*<!-- 贵族开通升级续费动效 -->*/
  204. div#nobility_upgrade,
  205. /*<!-- 新游戏类型坐骑上线提醒弹窗 -->*/
  206. div#newMountRemindWin {
  207. display: none !important;
  208. }
  209. `
  210. },
  211. foldRank:{
  212. title:'自动折叠榜单区',
  213. default:true,
  214. style:`
  215. /*右侧榜单区,平时折叠*/
  216. div#room-tabs {
  217. height: 40px;
  218. }
  219. #room-tabs>div>div:not(:first-child) {
  220. display: none !important;
  221. }
  222.  
  223. /*鼠标悬停时展开榜单*/
  224. div#room-tabs:hover>div>div[style*="display: block;"]{
  225. display: block !important;
  226. }
  227. div#room-tabs:hover {
  228. height: 190px;
  229. }
  230. .chat-list {
  231. height: calc(100% - 46px) !important;
  232. }
  233. div#room-tabs:hover+.chat-list {
  234. height: calc(100% - 190px);
  235. }
  236. /*网页全屏时隐藏公告*/
  237. .gameH5TheaterBar .room-boardcast {
  238. display: none;
  239. }
  240. .gameH5TheaterBar .room-tabs-chat-list {
  241. height: calc(100% - 104px) !important;
  242. }
  243. `
  244. },
  245. noThreaterRank:{
  246. title:'去除网页全屏榜单',
  247. default:true,
  248. style:`
  249. /*网页全屏时隐藏公告和榜单*/
  250. .gameH5TheaterBar .room-boardcast,
  251. .gameH5TheaterBar #room-tabs{
  252. display: none;
  253. }
  254. .gameH5TheaterBar .chat-list {
  255. height: calc(100% - 4px) !important;
  256. }
  257. /*隐藏公告和榜单后*/
  258. .gameH5TheaterBar .room-tabs-chat-list {
  259. height: calc(100% - 104px);
  260. }
  261. `
  262. },
  263. noTheaterGiftBar:{
  264. title:'去除网页全屏/全屏礼物栏',
  265. style:`
  266. /*网页全屏/全屏礼物栏*/
  267. .gameH5Theater .user-tool-bar,
  268. .gameH5FullScreen .user-tool-bar {
  269. display: none !important;
  270. }
  271. .gameH5Theater div#live-wrapper ,
  272. .gameH5FullScreen div#live-wrapper {
  273. height: 100% !important;
  274. }
  275. .gameH5FullScreen .show-controls {
  276. bottom: 0 !important;
  277. }
  278. `
  279. },
  280. noFullAnchor:{
  281. title:'去除全屏主播信息',
  282. style:`
  283. /*全屏关注消息*/
  284. div#fullscreen-anchorInfo {
  285. display: none !important;
  286. }
  287. `
  288. },
  289. noGiftBanner:{
  290. title:'去除聊天区礼物横幅',
  291. style:`
  292. /*<!-- 礼物大动效展示区 -->*/
  293. div#giftBigEffectWrap,
  294. /*第一次*/
  295. div#first-reward-panel,#first-reward-entry,
  296. /*聊天区礼物连击*/
  297. .gift-simp-banner.js-gift-simp-banner,
  298. /*聊天区感谢礼物栏*/
  299. div#gift-banner {
  300. display: none !important;
  301. }
  302. `
  303. },
  304. noBoxDrop:{
  305. title:'去除抢宝箱消息',
  306. style:`
  307. /*<!-- 圣旨礼物掉落区 -->*/
  308. div#decreeBoxDropWrap,
  309. /*<!-- 圣旨礼物点击区 -->*/
  310. div#decreeBoxShowWrap,
  311. /*<!-- 周星宝箱掉落区 -->*/
  312. div#weekStarBoxDropWrap,
  313. /*<!-- 周星宝箱点击区 -->*/
  314. div#weekStarBoxShowWrap,
  315. /*<!-- 礼物宝箱掉落区 -->*/
  316. div#giftBoxDropWrap,
  317. /*<!-- 礼物宝箱点击区 -->*/
  318. div#giftBoxShowWrap {
  319. display: none !important;
  320. }
  321. `
  322. },
  323. noChatTip:{
  324. title:'去除粉丝勋章',
  325. style:`
  326. /*粉丝勋章*/
  327. span.chat-tip-container{
  328. display: none
  329. }
  330. `
  331. },
  332. noIcon:{
  333. title:'去除用户前缀图标',
  334. style:`
  335. /*用户前缀图标*/
  336. .chat_item .chat_priv_img img,
  337. .chat_item.notify>img{
  338. display: none;
  339. }
  340. `
  341. },
  342. noMsgImg:{
  343. title:'去除聊天图片',
  344. style:`
  345. /*聊天图片*/
  346. .chat_msg_content img {
  347. display: none !important;
  348. }
  349. .chat_msg>img {
  350. display: none !important;
  351. }
  352. `
  353. },
  354. noChatPriv:{
  355. title:'去除聊天气泡',
  356. style:`
  357. /*聊天气泡同行*/
  358. .chat_info,
  359. .chat_msg_con,
  360. .chat_msg_normal{
  361. display: inline !important;
  362. }
  363. /*去除聊天气泡*/
  364. .chat_msg>div {
  365. display: none !important;
  366. }
  367. .chat_msg,
  368. .chat_msg_normal>span{
  369. display: inline !important;
  370. background: none !important;
  371. color: #000 !important;
  372. border: none !important;
  373. padding: 0 !important;
  374. margin: 0 !important;
  375. }
  376. `
  377. },
  378. noSendGift:{
  379. title:'去除送礼消息',
  380. style:`
  381. /*聊天区礼物*/
  382. li.gift_item {
  383. display: none;
  384. }
  385. `
  386. },
  387. noWelcome:{
  388. title:'去除欢迎消息',
  389. style:`
  390. /*进入房间欢迎消息*/
  391. li.chat_item.notify.enter-room-notify,
  392. /*骑士欢迎消息*/
  393. .chat_item.activity-notify-nobility,
  394. /*<!-- 贵族视频区进场横幅 -->*/
  395. div#nobility_screen_enter,
  396. /*<!-- 坐骑动效和横幅动效 -->*/
  397. div#mounts_player,
  398. div#mounts_banner,
  399. div#mounts_player_png,
  400. /*聊天区贵族欢迎消息*/
  401. div#nobility_chat_enter {
  402. display: none !important;
  403. }
  404. `
  405. },
  406. noFollow:{
  407. title:'去除关注消息',
  408. style:`
  409. /*关注消息*/
  410. .follow-anchor-notify {
  411. display: none;
  412. }
  413. `
  414. },
  415. noSysMsg:{
  416. title:'去除系统消息',
  417. style:`
  418. /*管理员消息*/
  419. li.chat_item.admin-notify {
  420. display: none;
  421. }
  422. /*活动消息*/
  423. li.chat_item.notify.activity-notify {
  424. display: none;
  425. }
  426. `
  427. },
  428. noShout:{
  429. title:'去除喇叭消息',
  430. style:`
  431. /*聊天区喇叭消息*/
  432. .bun-shout-dynamic-area {
  433. display: none !important;
  434. }
  435. `
  436. },
  437. noDMColor:{
  438. title:'去除弹幕颜色',
  439. style:`
  440. /*弹幕*/
  441. .cmt {
  442. color: #fff !important;
  443. }
  444. `
  445. },
  446. noDMBullet:{
  447. title:'去除弹幕气泡',
  448. style:`
  449. /*弹幕气泡*/
  450. .nobility_bulletScreen {
  451. display: inline !important;
  452. background: none !important;
  453. border: none !important;
  454. padding: 0 !important;
  455. margin: 0 !important;
  456. }
  457. .nobility_bulletScreen img,
  458. span.nobility_bulletScreen_adrom {
  459. display: none
  460. }
  461. /*喊话气泡,不知道内部怎么样的*/
  462. div#bunShoutDynamic{}
  463. `
  464. },
  465. };
  466. const CCLiveCleaner = {
  467. styleDiv:undefined,
  468. configDiv:document.querySelector('ul.ban-effect-list'),
  469. config:(()=>{
  470. try{
  471. if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_getValue)) {
  472. return JSON.parse(GM_getValue('ccLiveConfig','{}'));
  473. }
  474. else {
  475. return JSON.parse(localStorage.getItem('ccLiveConfig')||'{}');
  476. }
  477. }catch(e){
  478. console.error('CC直播净化:读取配置失败,使用默认配置',e);
  479. return {};
  480. }
  481. })(),
  482. saveConfig(){
  483. for(const i in this.config) {
  484. if(!configList[i]) delete this.config[i];
  485. }
  486. try{
  487. if('undefined'!=typeof(GM_info)&&'undefined'!=typeof(GM_setValue)){
  488. GM_setValue('ccLiveConfig',JSON.stringify(this.config));
  489. }
  490. else {
  491. localStorage.setItem('ccLiveConfig',JSON.stringify(this.config));
  492. }
  493. }catch(e){
  494. console.error('CC直播净化:存储配置失败',e);
  495. }
  496. },
  497. applyConfig(){
  498. let styleContent = '';
  499. for(const i in configList) {
  500. if(
  501. this.config[i] ||
  502. (this.config[i]==undefined&&configList[i].default)
  503. ) styleContent += configList[i].style;
  504. }
  505. this.styleDiv.innerHTML = styleContent;
  506. },
  507. changeConfig(target){
  508. target.classList.toggle('selected');
  509. this.config[target.id] = target.classList.contains('selected');
  510. this.applyConfig();
  511. this.saveConfig();
  512. },
  513. createItem(id,config){
  514. const item = document.createElement('li');
  515. item.id = id;
  516. item.innerHTML = '<i></i>'+config.title;
  517. item.className = (this.config[id]||(this.config[id]==undefined&&config.default))?'selected':'';
  518. item.onclick = ({target})=>this.changeConfig(target);
  519. this.configDiv.appendChild(item);
  520. },
  521. init(){
  522. if(this.configDiv) {
  523. this.styleDiv = document.createElement('style');
  524. document.head.appendChild(this.styleDiv);
  525. this.applyConfig();
  526. this.configDiv.style = "max-height:calc(100vh - 200px);overflow:auto";
  527. for(const id in configList) {
  528. this.createItem(id,configList[id]);
  529. }
  530. }
  531. }
  532. };
  533. CCLiveCleaner.init();
  534. })();

QingJ © 2025

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