Bilibili 纯净播放页

必须与广告屏蔽规则配套使用

当前为 2021-09-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Bilibili Pure Player Page
// @name:zh-CN  Bilibili 纯净播放页
// @description MUST be used with AD rules
// @description:zh-CN 必须与广告屏蔽规则配套使用
// @namespace   https://greasyfork.org/users/197529
// @version     0.1.0
// @author      kkocdko
// @license     Unlicense
// @match       *://*.bilibili.com/*
// ==/UserScript==
"use strict";

if (v_tag.offsetHeight !== 0) {
  alert("[Bilibili Pure Player Page] user script MUST be used with AD rules!");
  throw 1;
}

document.lastChild.appendChild(document.createElement("style")).textContent = `
  #bilibili-player { height: auto; }
  .bilibili-player-video { margin: 0; }
`.replace(/;/g, "!important;");

let last;
const once = () => {
  const el = document.querySelector("video");
  if (!el || last === el) return;
  last = el;
  el.addEventListener("click", () => el.click());
  el.controls = true;
};
const container = document.querySelector("#bilibili-player");
const options = { childList: true, subtree: true };
new MutationObserver(once).observe(container, options);
once();