PureLive

移除直播网站广告

目前為 2018-01-15 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name PureLive
// @version 0.0.2
// @description:zh-cn 移除直播网站广告
// @namespace Violentmonkey Scripts
// @include https://www.zhanqi.tv/*   
// @include https://www.showroom-live.com/*
// @grant none
// @description 移除直播网站广告
// ==/UserScript==

/**
 * WARNING
 * 本脚本仅支持 Violentmonkey Scripts
 */
$(document).ready(() => {
  const applyCSS = (css) => {
    let styleTag = $(css);
    $('html > head').append(styleTag);
  }
  const zhanqi = () => {
    $('.live-chat-content').remove(); // 聊天窗口
    $('.live-side-content').remove(); // 左侧边栏
    $('.want-headlines-btn').remove(); // 上头条
    $('.js-room-fun-area').remove(); // 礼物区域
    $('.sdk-zhanqiMall').remove(); // 商城按钮
    $('.anchor-info-area').remove(); // 主播信息
    applyCSS(`<style>
    .no-play-down-ibox {display: none !important;} /* 客户端下载广告 */
    #js-flash-layer {width: 100vw !important; height: 100vh !important;} /* 拉伸播放器 */
    .live-room-content {padding: 0 !important;} /* 砍掉主容器左内间距 */
    .sdk-zhanqiMall {display: none !important;} /* 商城按钮 */
    .room-rank-ibox,.ranking-btn {display: none !important;} /* 排名展示和排名按钮 */
    .zb-task .zb-task-entrance { display: none !important } /* 主播任务 */
    </style>`);
    $(window).trigger('resize');
  }

  const showroom = () => {
    applyCSS(`<style>
      #js-avatar { display: none !important; } /* 垃圾头像 */
      #gift-area, #gift-log  { display: none !important; }  /* 礼物区域 */
      #event-and-support-area  { display: none !important; }  /* 活动和赞助区域 */
      .l-room-footer { display: none !important; }  /* 底栏 */
      .room-inner {background-image: none !important;} /* 垃圾背景图 */
      .l-room-video {position: relative !important; }
    </style>`);
  }
  
  switch(location.host){
    case 'www.zhanqi.tv':
    case 'zhanqi.tv':
      zhanqi(); break;
    case 'www.showroom-live.com':
      showroom(); break;
  }
});