Bilibili Pure Player Page

MUST be used with AD rules

目前為 2021-09-23 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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();