// ==UserScript==
// @name 抖音优化
// @namespace https://github.com/WhiteSevs/TamperMonkeyScript
// @version 2024.12.17
// @author WhiteSevs
// @description 视频过滤,包括广告、直播或自定义规则,伪装登录、屏蔽登录弹窗、自定义清晰度选择、未登录解锁画质选择、禁止自动播放、自动进入全屏、双击进入全屏、屏蔽弹幕和礼物特效、手机模式、修复进度条拖拽、自定义视频和评论区背景色等
// @license GPL-3.0-only
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAF19JREFUeF7tnQl8U1X2x38vabqlLWOFrpStUMrWsrdUEARkEREQCoiAghswHQdQEFREGXfhD24MjOiMIqKD4IyICCObFCgt1JaC0ELpmq0L3ZLuyft/bkpL8pI07yUvaVre/Xz6KTT3nnvOud93381dzqXAU+riGzJarMMoGogGqD4A3RXAPQC8eKribhSjBVBJA0UUkAfgGgXq90YRzpZUybL4cAhlj5BAn9DxoOkFAGYB8LdHllCWsweuAfgvDWpvkUaWzrn07QI2ARDkExpPg14FGqNsrVgox58HaFCHAd2HRRrFEa5SOQEQ7B08VEdR7wCYxLUiIb8TPEDjB0qke1WpVv7BtjbWAARJQ9bQwPtsBQv52tID9CqVRrGNjQZsAKACpSG7ATzORqCQxzU8QIHerdQoFlvTplUAuvp19W/Q0gcAeqw1QcLnrugB+qRELJ5dWFl4y5J2FgFoanztYYAa6YqmCTqx9QCdLBGLp1qCwCIAgdLgEwA1jm01Qj5X9gB1SqWRPQCAZmppFoAgafBXNKhFrmySoBtnD+xRaeQLrQIQKA1eCVBbOYsXCri8ByhgrVIj/8BQUaMeIMgnqD9Ni664vCWCgjZ7QETTwxTVitRmAUYABHqHHACln9YVUsf1wFGVRj7ZBIAAafBkCtQvHddu85aJ40bYbbL2bIrdMpwpgKKouUq1bB+ps6UHCJCG/kyBnupMRVyhLj/VZbvUqN/5FWpfa2cTpBTOqdTyuBYAAqSh0RToNLs80U4L2wtAw76DqElY3/6sp6gJKrXs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MQb06X36q9f7cvhssXWqjxWXYYj1bfwc3VpuznOZYcLW4rSoAYXaWTpLfeqBfqEnAWNUXwId4aMkZ5+eNDbHz3cPPVnCMlvc68JQ11qaZ0+vJxCW4eDmlIc1JTcVY3e7Asa1OEijewh8v8WAIJ8QuNpmv63MxrPUXWQbdrNQHR384RSW3+7wcnvOn3sYCEBNOgpRRrFESMAbg8GyR8nCU7qwB6g8YOqWt50YMOwByD/CfYOHqqjqPa/xNWB289e0yhKN0CpVv5hFgDyR1ebGLLXYKG8oQfoVSqNYpvhX4wv1739iStNDwsNyI8HKNC7lRrFYqY0swA07RUMPQHQHG534EdRQYojPECfVGkUD5iTbAkAdPXr6t+g1R4GKMetyDjCVkEmwwN0skQsnlpYWXiLEwAk820I9gPUOMGv7dED1CmJmHrUUuObfAuwZGKQNPgrGtSi9uiCu1jnPSqNnLRZq9G1Lb4CmI4LlAavBKitd7FD243pFLBWqZF/wEZh1gDovyL6BPWndaI3QWEWG+FCHqd74KiIptcrqhWsI2tzAqDZnABp8GRA9FcK9FSnmyhUaOoBCucoUFuVatk+ru6xCYA7IIRGU6BJrFWyiY/9ldtctRTym/MAGdX/AIr6RqWWHbfVRXYBYFhpZ9/QCDcd4mjQJMxmJA10pwASG44E/bXzinBbzesQ5Ui0zDKAKgTo6xSQrhXhXHGVPJEP6/4fAayH1yFvEgIAAAAASUVORK5CYII=
// @supportURL https://github.com/WhiteSevs/TamperMonkeyScript/issues
// @match *://*.douyin.com/*
// @match *://*.iesdouyin.com/*
// @require https://update.greasyfork.org/scripts/494167/1413255/CoverUMD.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/utils@2.5.5/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/domutils@1.4.8/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/@whitesev/pops@1.9.5/dist/index.umd.js
// @require https://fastly.jsdelivr.net/npm/qmsg@1.2.8/dist/index.umd.js
// @connect *
// @grant GM_deleteValue
// @grant GM_getResourceText
// @grant GM_getValue
// @grant GM_info
// @grant GM_registerMenuCommand
// @grant GM_setValue
// @grant GM_unregisterMenuCommand
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @run-at document-start
// ==/UserScript==
(function (Qmsg, Utils, DOMUtils, pops) {
'use strict';
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var _a;
var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)();
var _GM_getResourceText = /* @__PURE__ */ (() => typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0)();
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_registerMenuCommand = /* @__PURE__ */ (() => typeof GM_registerMenuCommand != "undefined" ? GM_registerMenuCommand : void 0)();
var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
var _GM_unregisterMenuCommand = /* @__PURE__ */ (() => typeof GM_unregisterMenuCommand != "undefined" ? GM_unregisterMenuCommand : void 0)();
var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)();
var _monkeyWindow = /* @__PURE__ */ (() => window)();
const KEY = "GM_Panel";
const ATTRIBUTE_INIT = "data-init";
const ATTRIBUTE_KEY = "data-key";
const ATTRIBUTE_DEFAULT_VALUE = "data-default-value";
const ATTRIBUTE_INIT_MORE_VALUE = "data-init-more-value";
const PROPS_STORAGE_API = "data-storage-api";
const UISelect = function(text, key, defaultValue, data, callback, description) {
let selectData = [];
if (typeof data === "function") {
selectData = data();
} else {
selectData = data;
}
let result = {
text,
type: "select",
description,
attributes: {},
props: {},
getValue() {
return this.props[PROPS_STORAGE_API].get(key, defaultValue);
},
callback(event, isSelectedValue, isSelectedText) {
let value = isSelectedValue;
log.info(`选择:${isSelectedText}`);
this.props[PROPS_STORAGE_API].set(key, value);
if (typeof callback === "function") {
callback(event, value, isSelectedText);
}
},
data: selectData
};
Reflect.set(result.attributes, ATTRIBUTE_KEY, key);
Reflect.set(result.attributes, ATTRIBUTE_DEFAULT_VALUE, defaultValue);
Reflect.set(result.props, PROPS_STORAGE_API, {
get(key2, defaultValue2) {
return PopsPanel.getValue(key2, defaultValue2);
},
set(key2, value) {
PopsPanel.setValue(key2, value);
}
});
return result;
};
const UISwitch = function(text, key, defaultValue, clickCallBack, description, afterAddToUListCallBack) {
let result = {
text,
type: "switch",
description,
attributes: {},
props: {},
getValue() {
return Boolean(
this.props[PROPS_STORAGE_API].get(key, defaultValue)
);
},
callback(event, __value) {
let value = Boolean(__value);
log.success(`${value ? "开启" : "关闭"} ${text}`);
this.props[PROPS_STORAGE_API].set(key, value);
},
afterAddToUListCallBack
};
Reflect.set(result.attributes, ATTRIBUTE_KEY, key);
Reflect.set(result.attributes, ATTRIBUTE_DEFAULT_VALUE, defaultValue);
Reflect.set(result.props, PROPS_STORAGE_API, {
get(key2, defaultValue2) {
return PopsPanel.getValue(key2, defaultValue2);
},
set(key2, value) {
PopsPanel.setValue(key2, value);
}
});
return result;
};
const afterEnterDeepMenuCallBack = (formConfig, container) => {
let $oneClickOpen = container.sectionBodyContainer.querySelector(
".keyboard-oneClickOpen"
);
let $oneClickClose = container.sectionBodyContainer.querySelector(
".keyboard-oneClickClose"
);
let clickCallBack = (isOpen) => {
var _a2;
(_a2 = container.sectionBodyContainer) == null ? void 0 : _a2.querySelectorAll(".pops-panel-switch").forEach(($ele) => {
let $input = $ele.querySelector(
".pops-panel-switch__input"
);
let $checkbox = $ele.querySelector(
".pops-panel-switch__core"
);
if (isOpen) {
if (!$input.checked) {
$checkbox.click();
}
} else {
if ($input.checked) {
$checkbox.click();
}
}
});
};
domUtils.on($oneClickOpen, "click", (event) => {
utils.preventEvent(event);
clickCallBack(true);
});
domUtils.on($oneClickClose, "click", (event) => {
utils.preventEvent(event);
clickCallBack(false);
});
};
const AutoOpenOrClose = {
text: (
/*html*/
`
一键开启
一键关闭
`
),
afterEnterDeepMenuCallBack
};
const PanelCommonConfig = {
id: "panel-config-common",
title: "通用",
forms: [
{
text: "",
type: "forms",
forms: [
{
text: "Toast配置",
type: "deepMenu",
forms: [
{
text: "",
type: "forms",
forms: [
UISelect(
"Toast位置",
"qmsg-config-position",
"bottom",
[
{
value: "topleft",
text: "左上角"
},
{
value: "top",
text: "顶部"
},
{
value: "topright",
text: "右上角"
},
{
value: "left",
text: "左边"
},
{
value: "center",
text: "中间"
},
{
value: "right",
text: "右边"
},
{
value: "bottomleft",
text: "左下角"
},
{
value: "bottom",
text: "底部"
},
{
value: "bottomright",
text: "右下角"
}
],
(event, isSelectValue, isSelectText) => {
log.info("设置当前Qmsg弹出位置" + isSelectText);
},
"Toast显示在页面九宫格的位置"
),
UISelect(
"最多显示的数量",
"qmsg-config-maxnums",
3,
[
{
value: 1,
text: "1"
},
{
value: 2,
text: "2"
},
{
value: 3,
text: "3"
},
{
value: 4,
text: "4"
},
{
value: 5,
text: "5"
}
],
void 0,
"限制Toast显示的数量"
),
UISwitch(
"逆序弹出",
"qmsg-config-showreverse",
false,
void 0,
"修改Toast弹出的顺序"
)
]
}
]
}
]
},
{
type: "forms",
text: "",
forms: [
{
text: "功能",
type: "deepMenu",
forms: [
{
text: "",
type: "forms",
forms: [
UISwitch(
"伪装登录",
"disguiseLogin",
false,
void 0,
"使用随机UID进行伪装"
),
UISwitch(
"initial-scale=1",
"dy-initialScale",
false,
void 0,
"可配合手机模式放大页面"
),
UISwitch(
"移除 apple-itunes-app",
"dy-apple-removeMetaAppleItunesApp",
true,
void 0,
"Safari使用,移除顶部横幅【Open in the 抖音 app】"
),
UISwitch(
"监听Router改变",
"dy-common-listenRouterChange",
true,
void 0,
"功能重载"
),
UISwitch(
"移除某些Cookie",
"dy-cookie-remove__ac__",
false,
void 0,
""
)
]
},
{
text: "Url重定向",
type: "forms",
forms: [
UISwitch(
"重定向/home",
"douyin-redirect-url-home-to-root",
false,
void 0,
"/home => /"
)
]
}
]
},
{
type: "deepMenu",
text: "快捷键禁用",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
type: "forms",
text: AutoOpenOrClose.text,
forms: [
UISwitch(
"赞|取消赞",
"dy-keyboard-hook-likeOrDislike",
false,
void 0,
"Z"
),
UISwitch(
"评论",
"dy-keyboard-hook-comment",
false,
void 0,
"X"
),
UISwitch(
"开启/关闭弹幕",
"dy-keyboard-hook-danmaku-enable",
false,
void 0,
"B"
),
UISwitch(
"收藏/取消收藏",
"dy-keyboard-hook-collect-enable",
false,
void 0,
"C"
),
UISwitch(
"复制分享口令",
"dy-keyboard-hook-copyShareLink",
false,
void 0,
"V"
),
UISwitch(
"清屏",
"dy-keyboard-hook-clearScreen",
false,
void 0,
"J"
),
UISwitch(
"自动连播",
"dy-keyboard-hook-automaticBroadcast",
false,
void 0,
"K"
),
UISwitch(
"视频信息",
"dy-keyboard-hook-videoInfo",
false,
void 0,
"I"
),
UISwitch(
"不感兴趣",
"dy-keyboard-hook-notInterested",
false,
void 0,
"R"
),
UISwitch(
"进入作者主页",
"dy-keyboard-hook-enterAuthorHomePage",
false,
void 0,
"F"
),
UISwitch(
"关注/取消关注",
"dy-keyboard-hook-follow",
false,
void 0,
"G"
),
UISwitch(
"抖音搜索",
"dy-keyboard-hook-search",
false,
void 0,
"Shift+F"
),
UISwitch(
"一键关闭当前页",
"dy-keyboard-hook-closeTheCurrentPageWithOneClick",
false,
void 0,
"Shift+Q"
),
UISwitch(
"上下翻页",
"dy-keyboard-hook-pageUpAndDown",
false,
void 0,
"↑↓"
),
UISwitch(
"快进快退",
"dy-keyboard-hook-fastForwardAndFastBack",
false,
void 0,
"← →"
),
UISwitch(
"暂停",
"dy-keyboard-hook-pause",
false,
void 0,
"空格"
),
UISwitch(
"网页内全屏",
"dy-keyboard-hook-fullScreenInsideThePage",
false,
void 0,
"Y"
),
UISwitch(
"全屏",
"dy-keyboard-hook-fullScreen",
false,
void 0,
"H"
),
UISwitch(
"稍后再看",
"dy-keyboard-hook-watchItOutLater",
false,
void 0,
"L"
),
UISwitch(
"音量调整",
"dy-keyboard-hook-volumeAdjustment",
false,
void 0,
"Shift + / Shift -"
),
UISwitch(
"呼出快捷键列表",
"dy-keyboard-hook-listOfCallShortcutKeys",
false,
void 0,
"?"
),
UISwitch(
"关闭快捷键列表",
"dy-keyboard-hook-closeTheShortcutKeyList",
false,
void 0,
"ESC"
),
UISwitch(
"相关推荐",
"dy-keyboard-hook-relevantRecommendation",
false,
void 0,
"N"
)
]
}
]
}
]
},
{
text: "",
type: "forms",
forms: [
{
text: "屏蔽-通用",
type: "deepMenu",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
type: "forms",
text: AutoOpenOrClose.text,
forms: [
UISwitch(
"【屏蔽】登录弹窗",
"watchLoginDialogToClose",
true,
void 0,
"屏蔽元素且自动等待元素出现并关闭登录弹窗"
),
UISwitch(
"【屏蔽】底部?按钮",
"shieldBottomQuestionButton",
true,
void 0,
"屏蔽元素"
)
]
}
]
},
{
text: "屏蔽-左侧导航栏",
type: "deepMenu",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
type: "forms",
text: AutoOpenOrClose.text,
forms: [
UISwitch(
"【屏蔽】左侧导航栏",
"shieldLeftNavigator",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】首页",
"shieldLeftNavigator-tab-home",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】推荐",
"shieldLeftNavigator-tab-recommend",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】关注",
"shieldLeftNavigator-tab-follow",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】朋友",
"shieldLeftNavigator-tab-friend",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】我的",
"shieldLeftNavigator-tab-user_self",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】喜欢",
"shieldLeftNavigator-tab-user_self_like",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】收藏",
"shieldLeftNavigator-tab-user_self_collection",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】观看历史",
"shieldLeftNavigator-tab-user_self_record",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】看奥运",
"shieldLeftNavigator-tab-olympics",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】直播",
"shieldLeftNavigator-tab-live",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】放映厅",
"shieldLeftNavigator-tab-vs",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】短剧",
"shieldLeftNavigator-tab-series",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】知识",
"shieldLeftNavigator-tab-channel_300203",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】游戏",
"shieldLeftNavigator-tab-channel_300205",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】二次元",
"shieldLeftNavigator-tab-channel_300206",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】音乐",
"shieldLeftNavigator-tab-channel_300209",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】美食",
"shieldLeftNavigator-tab-channel_300204",
false,
void 0,
"屏蔽元素"
)
]
}
]
},
{
text: "屏蔽-顶部导航栏",
type: "deepMenu",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
text: AutoOpenOrClose.text,
type: "forms",
forms: [
UISwitch(
"【屏蔽】顶部导航栏",
"shieldTopNavigator",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】客户端提示",
"shieldClientTip",
true,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】充钻石",
"shieldFillingBricksAndStones",
true,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】客户端",
"shieldClient",
true,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】快捷访问",
"shieldQuickAccess",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】通知",
"shieldNotifitation",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】私信",
"shieldPrivateMessage",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】投稿",
"shieldSubmission",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】壁纸",
"shieldWallpaper",
false,
void 0,
"屏蔽元素"
)
]
}
]
},
{
text: "屏蔽-搜索",
type: "deepMenu",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
text: AutoOpenOrClose.text,
type: "forms",
forms: [
UISwitch(
"【屏蔽】搜索框",
"shieldSearch",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】搜索框的提示",
"shieldSearchPlaceholder",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】猜你想搜",
"shieldSearchGuessYouWantToSearch",
false,
void 0,
"屏蔽元素"
),
UISwitch(
"【屏蔽】抖音热点",
"shieldSearchTiktokHotspot",
false,
void 0,
"屏蔽元素"
)
]
}
]
},
{
type: "deepMenu",
text: "屏蔽-鼠标悬浮提示",
afterEnterDeepMenuCallBack: AutoOpenOrClose.afterEnterDeepMenuCallBack,
forms: [
{
type: "forms",
text: AutoOpenOrClose.text + "
视频区域-右侧工具栏",
forms: [
UISwitch(
"进入作者主页",
"dy-video-mouseHoverTip-rightToolBar-enterUserHome",
false
),
UISwitch(
"关注",
"dy-video-mouseHoverTip-rightToolBar-follow",
false
),
UISwitch(
"点赞",
"dy-video-mouseHoverTip-rightToolBar-addLike",
false
),
UISwitch(
"评论",
"dy-video-mouseHoverTip-rightToolBar-comment",
false
),
UISwitch(
"收藏",
"dy-video-mouseHoverTip-rightToolBar-collect",
false
),
UISwitch(
"分享",
"dy-video-mouseHoverTip-rightToolBar-share",
false
),
UISwitch(
"看相关",
"dy-video-mouseHoverTip-rightToolBar-seeCorrelation",
false
)
]
},
{
type: "forms",
text: "视频区域-底部工具栏",
forms: [
UISwitch(
"自动连播",
"dy-video-mouseHoverTip-bottomToolBar-automaticBroadcast",
false
),
UISwitch(
"清屏",
"dy-video-mouseHoverTip-bottomToolBar-clearScreen",
false
),
UISwitch(
"稍后再看",
"dy-video-mouseHoverTip-bottomToolBar-watchLater",
false
),
UISwitch(
"网页全屏",
"dy-video-mouseHoverTip-bottomToolBar-pageFullScreen",
false
),
UISwitch(
"全屏",
"dy-video-mouseHoverTip-bottomToolBar-fullScreen",
false
)
]
}
]
}
]
}
]
};
const DouYinDanmuFilter = {
key: "douyin-live-danmu-rule",
$data: {
rule: [],
isFilterAttrName: "data-is-filter"
},
init() {
this.resetRule();
this.initRule();
},
/**
* 初始化解析规则
*/
initRule() {
let localRule = this.get().trim();
let localRuleSplit = localRule.split("\n");
localRuleSplit.forEach((item) => {
if (item.trim() == "") return;
item = item.trim();
let itemRegExp = new RegExp(item.trim());
this.$data.rule.push(itemRegExp);
});
},
/**
* 重置规则数据
*/
resetRule() {
this.$data.rule = [];
},
/**
* 通知弹幕改变(可能是新增)
*/
change() {
var _a2, _b, _c, _d, _e, _f, _g;
let danmakuQueue = Array.from(
document.querySelectorAll("xg-danmu.xgplayer-danmu > div > div")
);
if (!danmakuQueue.length) {
return;
}
for (let messageIndex = 0; messageIndex < danmakuQueue.length; messageIndex++) {
let $danmuItem = danmakuQueue[messageIndex];
if ($danmuItem.hasAttribute(this.$data.isFilterAttrName)) {
continue;
}
let $messageObj = (_d = (_c = (_b = (_a2 = utils.getReactObj($danmuItem)) == null ? void 0 : _a2.reactFiber) == null ? void 0 : _b.return) == null ? void 0 : _c.memoizedProps) == null ? void 0 : _d.message;
let message = ((_e = $messageObj == null ? void 0 : $messageObj.payload) == null ? void 0 : _e.content) || ((_g = (_f = $messageObj == null ? void 0 : $messageObj.payload) == null ? void 0 : _f.common) == null ? void 0 : _g.describe);
for (let index = 0; index < this.$data.rule.length; index++) {
const ruleRegExp = this.$data.rule[index];
if (typeof message === "string") {
if (ruleRegExp.test(message)) {
log.info("过滤弹幕: " + message);
$danmuItem.setAttribute(this.$data.isFilterAttrName, "true");
domUtils.hide($danmuItem);
break;
}
}
}
}
},
set(value) {
_GM_setValue(this.key, value);
},
get() {
return _GM_getValue(this.key, "");
}
};
const DouYinLiveDanmuku = {
/**
* 弹幕过滤
*/
filterDanmu() {
utils.waitNode("xg-danmu.xgplayer-danmu", 1e5).then(($danmu) => {
if (!$danmu) {
log.error("xg-danmu.xgplayer-danmu获取失败");
return;
}
log.success("弹幕过滤");
DouYinDanmuFilter.init();
utils.mutationObserver($danmu, {
config: {
childList: true,
subtree: true
},
callback: () => {
DouYinDanmuFilter.change();
}
});
});
}
};
const ReactUtils = {
/**
* 等待react某个属性并进行设置
*/
async waitReactPropsToSet($target, propName, needSetList) {
function getTarget() {
let __target__ = null;
if (typeof $target === "string") {
__target__ = document.querySelector($target);
} else if (typeof $target === "function") {
__target__ = $target();
} else if ($target instanceof HTMLElement) {
__target__ = $target;
}
return __target__;
}
if (typeof $target === "string") {
let $ele = await utils.waitNode($target, 1e4);
if (!$ele) {
return;
}
}
needSetList.forEach((needSetOption) => {
if (typeof needSetOption.msg === "string") {
log.info(needSetOption.msg);
}
function checkObj() {
let target = getTarget();
if (target == null) {
return false;
}
let targetObj = utils.getReactObj(target);
if (targetObj == null) {
return false;
}
let targetObjProp = targetObj[propName];
if (targetObjProp == null) {
return false;
}
let needOwnCheck = needSetOption.check(targetObjProp);
return Boolean(needOwnCheck);
}
utils.waitPropertyByInterval(
() => {
return getTarget();
},
checkObj,
250,
1e4
).then(() => {
let target = getTarget();
if (target == null) {
return;
}
let targetObj = utils.getReactObj(target);
if (targetObj == null) {
return;
}
let targetObjProp = targetObj[propName];
if (targetObjProp == null) {
return;
}
needSetOption.set(targetObjProp);
});
});
}
};
const CommonUtil = {
/**
* 添加屏蔽CSS
* @param args
* @example
* addBlockCSS("")
* addBlockCSS("","")
* addBlockCSS(["",""])
*/
addBlockCSS(...args) {
let selectorList = [];
if (args.length === 0) {
return;
}
if (args.length === 1 && typeof args[0] === "string" && args[0].trim() === "") {
return;
}
args.forEach((selector) => {
if (Array.isArray(selector)) {
selectorList = selectorList.concat(selector);
} else {
selectorList.push(selector);
}
});
return addStyle(`${selectorList.join(",\n")}{display: none !important;}`);
},
/**
* 设置GM_getResourceText的style内容
* @param resourceMapData 资源数据
* @example
* setGMResourceCSS({
* keyName: "ViewerCSS",
* url: "https://example.com/example.css",
* })
*/
setGMResourceCSS(resourceMapData) {
let cssText = typeof _GM_getResourceText === "function" ? _GM_getResourceText(resourceMapData.keyName) : "";
if (typeof cssText === "string" && cssText) {
addStyle(cssText);
} else {
CommonUtil.loadStyleLink(resourceMapData.url);
}
},
/**
* 添加标签
* @param url
* @example
* loadStyleLink("https://example.com/example.css")
*/
async loadStyleLink(url) {
let $link = document.createElement("link");
$link.rel = "stylesheet";
$link.type = "text/css";
$link.href = url;
domUtils.ready(() => {
document.head.appendChild($link);
});
},
/**
* 添加