bilibili_quiet

默认关闭B站弹幕、 将/s/的搜索入口路径自动转向正常视频路径、 隐藏B站视频的浮动弹出通知

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @license   GPLv3
// @name         bilibili_quiet
// @namespace    http://tampermonkey.net/
// @version      0.11
// @description  默认关闭B站弹幕、 将/s/的搜索入口路径自动转向正常视频路径、 隐藏B站视频的浮动弹出通知
// @author       You
// @match        *://www.bilibili.com/video/*
// @match        *://live.bilibili.com/*
// @match        *://www.bilibili.com/s/video/*
// @require      https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @grant        none
// ==/UserScript==

(function(window) {
    'use strict';

    // 自动转向

    if(/^\/s\/video\/([^\/\?]+)/.test(location.pathname)){
        top.location.href = 'https://www.bilibili.com/video/'+RegExp.$1;
        return
    }


    // 播放
    const f = () => {
            document.arrive('input.bui-switch-input, .bui-danmaku-switch-input', {'onceOnly':1}, function(el){
                if(el.checked) {
                    el.click();
                }
        });
    };


    let _src = null;
    document.arrive('div.bilibili-player-video > video', {'existing':1}, function(el){
       document.unbindArrive('input.bui-switch-input');
       const src = this.src;
       if(src === _src) return;
        _src = src;
        f();
    });

    var style_el = document.createElement('style');
    style_el.textContent = `
.bilibili-player-video-popup {
   display: none!important;
}
`;
    document.head.appendChild(style_el);

})(window);