Greasy Fork is available in English.
自动关闭哔哩哔哩 HTML5 播放器弹幕
当前为
// ==UserScript==
// @name bilibili Danmaku Disabler
// @name:en-US bilibili Danmaku Disabler
// @name:zh-CN bilibili 弹幕关闭
// @description Auto disable bilibili HTML5 player danmaku
// @description:en-US Auto disable bilibili HTML5 player danmaku
// @description:zh-CN 自动关闭哔哩哔哩 HTML5 播放器弹幕
// @namespace bilibili-danmaku-disabler
// @version 2020.07.27.2
// @author Akatsuki
// @license MIT License
// @grant GM_info
// @run-at document-idle
// @match *://www.bilibili.com/*video/*
// @match *://www.bilibili.com/bangumi/play/*
// @match *://www.bilibili.com/blackboard/*
// @match *://player.bilibili.com/*
// ==/UserScript==
'use strict'
var selector_native = {
on: "input[class='bui-switch-input']:checked",
off: "input[class='bui-switch-input']:not(:checked)"
}
var selector_embed = {
on: "div[class~='bilibili-player-video-btn-danmaku'][data-text='打开弹幕']",
off: "div[class~='bilibili-player-video-btn-danmaku'][data-text='关闭弹幕']"
}
if (document.location.hostname === 'player.bilibili.com') {
var selector = selector_embed
} else {
var selector = selector_native
}
// Danmaku disabler
function disable_danmaku() {
var button_on = document.querySelector(selector.on)
if (button_on !== null) {
button_on.click()
}
setTimeout(() => {
if (document.querySelector(selector.off) === null) {
disable_danmaku()
}
}, 500)
}
disable_danmaku()