// ==UserScript==
// @name B站UP主个性化弹幕屏蔽
// @namespace https://kayanouriko.cc
// @version 2.2.1
// @author kayanouriko
// @description 这功能 up 如果用得好还说得过去, 用的不好就是挡视频挡字幕, 通通干掉.
// @license MIT
// @icon https://static.hdslb.com/images/favicon.ico
// @match *://www.bilibili.com/video/*
// @require https://cdn.jsdelivr.net/npm/vue@3.2.47/dist/vue.global.prod.js
// @grant GM_getValue
// @grant GM_info
// @grant GM_setValue
// ==/UserScript==
(e=>{const t=document.createElement("style");t.dataset.source="vite-plugin-monkey",t.textContent=e,document.head.append(t)})(" .bpx-player-ctrl-setting-block[data-v-31e1f91a]{margin-bottom:4px}.bpx-player-ctrl-setting-block-content[data-v-31e1f91a]{display:flex;display:-webkit-flex;display:-ms-flexbox;width:100%;-ms-flex-wrap:wrap;flex-wrap:wrap}.bpx-player-ctrl-setting-block-content .bpx-player-ctrl-setting-checkbox[data-v-31e1f91a]{margin-right:10px;margin-top:4px} ");
(function (vue) {
'use strict';
const version = "2.2.1";
var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
var _GM_info = /* @__PURE__ */ (() => typeof GM_info != "undefined" ? GM_info : void 0)();
var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
const log = (...data) => {
console.log(
`%c ${_GM_info.script.name} %c v${version} `,
"padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;",
"padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;",
`${data}`
);
};
const STORE_SETTING = "cc.kayanouriko.setting";
function getStores() {
const setting = _GM_getValue(STORE_SETTING, JSON.stringify(["guide", "link", "vote", "score", "reserve"]));
return JSON.parse(setting);
}
function setStores(stores) {
_GM_setValue(STORE_SETTING, JSON.stringify(stores));
}
function initBlock() {
const stores = getStores();
const selectors = stores.map((s) => `.bili-${s}.bili-show`);
const element = document.createElement("style");
element.innerText = `
${selectors.join(",")} {
display: none !important;
}
.bpx-player-dm-setting-wrap .bui-panel-item:first-child {
height: 424px !important;
}
`;
document.body.appendChild(element);
log("屏蔽项已经生效");
}
const _withScopeId = (n) => (vue.pushScopeId("data-v-31e1f91a"), n = n(), vue.popScopeId(), n);
const _hoisted_1 = { class: "bpx-player-ctrl-setting-block" };
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "bpx-player-ctrl-setting-block-title" }, "按UP主个性化弹幕类型屏蔽", -1));
const _hoisted_3 = { class: "bpx-player-ctrl-setting-block-content" };
const _hoisted_4 = { class: "bpx-player-ctrl-setting-checkbox bui bui-checkbox bui-dark" };
const _hoisted_5 = { class: "bui-area" };
const _hoisted_6 = ["id", "value", "aria-label"];
const _hoisted_7 = { class: "bui-checkbox-label" };
const _hoisted_8 = /* @__PURE__ */ vue.createStaticVNode('<span class="bui-checkbox-icon bui-checkbox-icon-default" data-v-31e1f91a><svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 32 32" data-v-31e1f91a><path d="M8 6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2H8zm0-2h16c2.21 0 4 1.79 4 4v16c0 2.21-1.79 4-4 4H8c-2.21 0-4-1.79-4-4V8c0-2.21 1.79-4 4-4z" data-v-31e1f91a></path></svg></span><span class="bui-checkbox-icon bui-checkbox-icon-selected" data-v-31e1f91a><svg xmlns="http://www.w3.org/2000/svg" data-pointer="none" viewBox="0 0 32 32" data-v-31e1f91a><path d="m13 18.25-1.8-1.8c-.6-.6-1.65-.6-2.25 0s-.6 1.5 0 2.25l2.85 2.85c.318.318.762.468 1.2.448.438.02.882-.13 1.2-.448l8.85-8.85c.6-.6.6-1.65 0-2.25s-1.65-.6-2.25 0l-7.8 7.8zM8 4h16c2.21 0 4 1.79 4 4v16c0 2.21-1.79 4-4 4H8c-2.21 0-4-1.79-4-4V8c0-2.21 1.79-4 4-4z" data-v-31e1f91a></path></svg></span>', 2);
const _hoisted_10 = { class: "bui-checkbox-name" };
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
__name: "Section",
setup(__props) {
const checkboxs = [
{
class: "guide",
name: "互动引导"
},
{
class: "link",
name: "关联视频"
},
{
class: "vote",
name: "投票弹幕"
},
{
class: "reserve",
name: "下期预告"
},
{
class: "score",
name: "评分弹幕"
},
{
class: "clock",
name: "打卡"
}
];
const checkedClasses = vue.ref(getStores());
vue.watch(checkedClasses, (classes) => {
setStores(classes);
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
_hoisted_2,
vue.createElementVNode("div", _hoisted_3, [
(vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(checkboxs, (checkbox) => {
return vue.createElementVNode("div", _hoisted_4, [
vue.createElementVNode("div", _hoisted_5, [
vue.withDirectives(vue.createElementVNode("input", {
id: `bpx-player-ctrl-setting-block-${checkbox.class}`,
class: "bui-checkbox-input",
type: "checkbox",
value: checkbox.class,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => checkedClasses.value = $event),
"aria-label": checkbox.name
}, null, 8, _hoisted_6), [
[vue.vModelCheckbox, checkedClasses.value]
]),
vue.createElementVNode("label", _hoisted_7, [
_hoisted_8,
vue.createElementVNode("span", _hoisted_10, vue.toDisplayString(checkbox.name), 1)
])
])
]);
}), 64))
])
]);
};
}
});
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const Section = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-31e1f91a"]]);
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "App",
setup(__props) {
log("设置项已经初始化完成");
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(Section);
};
}
});
function addSettings() {
const timer = setInterval(() => initVue(() => clearInterval(timer)), 1e3);
}
function initVue(callback) {
const setting = document.querySelector(".bpx-player-dm-setting-left-block");
if (!setting) {
return;
}
callback();
vue.createApp(_sfc_main).mount(
(() => {
const app = document.createElement("div");
app.id = "bili-show-block";
setting.before(app);
return app;
})()
);
addObserver();
}
function addObserver() {
const observer = new MutationObserver((mutations) => {
mutations.forEach((record) => {
var _a;
const element = record.target;
let wrap;
if (element.className === "bpx-player-dm-setting-wrap") {
wrap = element.querySelector(".bui-panel-wrap");
} else if (element.className === "bui-panel-wrap") {
wrap = element;
} else {
wrap = null;
}
const value = (_a = wrap == null ? void 0 : wrap.attributes.getNamedItem("style")) == null ? void 0 : _a.value;
if (value && value === "width: 320px; height: 359px;") {
wrap == null ? void 0 : wrap.setAttribute("style", "width: 320px; height: 424px;");
}
});
});
const setting = document.querySelector(".bpx-player-dm-setting-wrap");
if (setting == null) {
return;
}
observer.observe(setting, {
subtree: true,
attributes: true,
attributeFilter: ["style"]
});
}
initBlock();
addSettings();
})(Vue);