Skip to content

Commit 8fe510a

Browse files
committed
feat: 移除跳过【观看高清流畅视频】,新增覆盖.wx-tag的handleClick
1 parent d09c29d commit 8fe510a

8 files changed

+170
-146
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"time": 1746161990253,
3-
"version": "2025.5.2"
2+
"time": 1746514718085,
3+
"version": "2025.5.6"
44
}

scripts-vite/【移动端】bilibili优化/dist/【移动端】bilibili优化.meta.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts-vite/【移动端】bilibili优化/dist/【移动端】bilibili优化.min.meta.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts-vite/【移动端】bilibili优化/dist/【移动端】bilibili优化.min.user.js

Lines changed: 45 additions & 45 deletions
Large diffs are not rendered by default.

scripts-vite/【移动端】bilibili优化/dist/【移动端】bilibili优化.user.js

Lines changed: 58 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name 【移动端】bilibili优化
33
// @namespace https://github.com/WhiteSevs/TamperMonkeyScript
4-
// @version 2025.5.2
4+
// @version 2025.5.6
55
// @author WhiteSevs
66
// @description 阻止跳转App、App端推荐视频流、解锁视频画质(番剧解锁需配合其它插件)、美化显示、去广告等
77
// @license GPL-3.0-only
@@ -2046,13 +2046,6 @@
20462046
true,
20472047
void 0,
20482048
"一般用于处理楼层的回复弹窗内无法选中复制问题"
2049-
),
2050-
UISwitch(
2051-
"跳过【观看高清流畅视频】弹窗",
2052-
"bili-close-wake-app-dialog",
2053-
true,
2054-
void 0,
2055-
"监听页面加载并关闭该弹窗"
20562049
)
20572050
// UISwitch(
20582051
// "自动删除Cookie buvid3",
@@ -2134,6 +2127,13 @@
21342127
void 0,
21352128
"覆盖bili-open-app/m-open-app元素上的opener.open函数,可阻止点击唤醒/下载App,如果存在有效链接,会自动跳转"
21362129
),
2130+
UISwitch(
2131+
"覆盖.wx-tag的handleClick",
2132+
"bili-cover-wx-tag-handleClick",
2133+
true,
2134+
void 0,
2135+
"覆盖.wx-tag元素上的点击事件,让它直接打开视频"
2136+
),
21372137
UISwitch(
21382138
"劫持setTimeout-autoOpenApp",
21392139
"bili-hookSetTimeout_autoOpenApp",
@@ -12591,7 +12591,8 @@
1259112591
windowPlayerAgent: false,
1259212592
hookWebpackJsonp_openApp: false,
1259312593
overRideLaunchAppBtn_Vue_openApp: false,
12594-
overRideBiliOpenApp: false
12594+
overRideBiliOpenApp: false,
12595+
overRideWxTaghandleClick: false
1259512596
},
1259612597
$data: {
1259712598
setTimeout: []
@@ -12679,6 +12680,7 @@
1267912680
childList: true,
1268012681
attributes: true
1268112682
},
12683+
immediate: true,
1268212684
callback() {
1268312685
document.querySelectorAll(".launch-app-btn").forEach(($launchAppBtn) => {
1268412686
let vueObj = VueUtils.getVue($launchAppBtn);
@@ -12711,6 +12713,7 @@
1271112713
childList: true,
1271212714
attributes: true
1271312715
},
12716+
immediate: true,
1271412717
callback() {
1271512718
[
1271612719
...Array.from($$("bili-open-app")),
@@ -12738,6 +12741,48 @@
1273812741
});
1273912742
}
1274012743
});
12744+
},
12745+
/**
12746+
* 覆盖页面上的className为wx-tag的元素的点击事件
12747+
*/
12748+
overRideWxTaghandleClick() {
12749+
if (this.$isHook.overRideWxTaghandleClick) {
12750+
return;
12751+
}
12752+
this.$isHook.overRideWxTaghandleClick = true;
12753+
utils.mutationObserver(document, {
12754+
config: {
12755+
subtree: true,
12756+
childList: true,
12757+
attributes: true
12758+
},
12759+
immediate: true,
12760+
callback() {
12761+
[...Array.from($$(".wx-tag"))].forEach(($el) => {
12762+
if ($el.hasAttribute("data-inject-vueins-handle-click")) {
12763+
return;
12764+
}
12765+
let vueIns = VueUtils.getVue($el);
12766+
if (vueIns) {
12767+
if (typeof (vueIns == null ? void 0 : vueIns.handleClick) === "function") {
12768+
vueIns.handleClick = function() {
12769+
if (typeof vueIns["goToVideo"] === "function") {
12770+
vueIns.goToVideo();
12771+
} else {
12772+
Qmsg.error(".wx-tag不存在goToVideo函数", {
12773+
consoleLogContent: true
12774+
});
12775+
}
12776+
};
12777+
$el.setAttribute("data-inject-vueins-handle-click", "true");
12778+
}
12779+
if (Array.isArray(vueIns == null ? void 0 : vueIns.$children) && vueIns.$children.length && typeof vueIns.$children[0].handleClick === "function") {
12780+
vueIns.$children[0].handleClick = vueIns.handleClick;
12781+
}
12782+
}
12783+
});
12784+
}
12785+
});
1274112786
}
1274212787
};
1274312788
const BilibiliRecommendCSS = '#app .m-head .m-recommend-view {\r\n display: none;\r\n}\r\n\r\n#app\r\n .m-head\r\n .suspension\r\n .channel-menu:has(.recommend-tag.is-avtive)\r\n .v-switcher__header__anchor {\r\n display: none !important;\r\n}\r\n#app\r\n .m-head\r\n .suspension\r\n .channel-menu:has(.recommend-tag.is-avtive)\r\n a.v-switcher__header__tabs__item {\r\n color: #505050 !important;\r\n}\r\n#app\r\n .m-head\r\n .suspension\r\n .channel-menu:has(.recommend-tag.is-avtive)\r\n a.recommend-tag {\r\n color: var(--bili-color) !important;\r\n}\r\n#app\r\n .m-head\r\n .suspension\r\n .channel-menu:has(.recommend-tag.is-avtive)\r\n a.recommend-tag\r\n span:after {\r\n content: " ";\r\n position: relative;\r\n background: var(--bili-color);\r\n width: 30.4375px;\r\n height: 0.53333vmin;\r\n display: block;\r\n bottom: 3px;\r\n}\r\n\r\n#app .m-head:has(.recommend-tag.is-avtive) .suspension + div {\r\n display: none;\r\n}\r\n#app .m-head:has(.recommend-tag.is-avtive) .m-recommend-view {\r\n display: unset;\r\n}\r\n\r\n#app .m-head .m-recommend-view {\r\n background-color: #f0f1f3;\r\n}\r\n#app .m-head .m-recommend-view .list-view .video-list-box .video-list {\r\n padding: 0 1.33333vmin;\r\n margin-bottom: 5.33333vmin;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box {\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -ms-flex-wrap: wrap;\r\n flex-wrap: wrap;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card {\r\n position: relative;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card\r\n .bfs-img-wrap {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n overflow: hidden;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card\r\n .bfs-img-wrap\r\n .bfs-img.b-img {\r\n position: relative;\r\n width: 100%;\r\n height: 100%;\r\n overflow: hidden;\r\n background: transparent;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card\r\n .bfs-img-wrap\r\n .bfs-img.b-img\r\n picture.b-img__inner {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card\r\n .bfs-img-wrap\r\n .bfs-img.b-img\r\n picture.b-img__inner\r\n img {\r\n width: 100%;\r\n height: 100%;\r\n -o-object-fit: cover;\r\n object-fit: cover;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .card\r\n .count {\r\n position: absolute;\r\n bottom: 0;\r\n left: 0;\r\n width: 100%;\r\n font-size: 3.2vmin;\r\n padding: 1.33333vmin 1.6vmin;\r\n display: -webkit-box;\r\n display: -ms-flexbox;\r\n display: flex;\r\n -webkit-box-pack: justify;\r\n -ms-flex-pack: justify;\r\n justify-content: space-between;\r\n color: #fff;\r\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .title {\r\n font-size: 3.2vmin;\r\n color: #212121;\r\n margin-top: 1.6vmin;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n}\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .gm-up-info\r\n .gm-up-name\r\n .gm-picture-text {\r\n padding: 1px 4px;\r\n border: 1px solid var(--bili-color);\r\n color: var(--bili-color);\r\n border-radius: 2px;\r\n margin-right: 4px;\r\n font-size: 2vmin;\r\n}\r\n\r\n#app\r\n .m-head\r\n .m-recommend-view\r\n .list-view\r\n .video-list-box\r\n .video-list\r\n .card-box\r\n .v-card\r\n .count\r\n > span {\r\n display: flex;\r\n align-items: center;\r\n gap: 1.33333vmin;\r\n}\r\n';
@@ -14606,6 +14651,10 @@
1460614651
log.info(`覆盖元素bili-open-app上的opener.open`);
1460714652
BilibiliHook.overRideBiliOpenApp();
1460814653
});
14654+
PopsPanel.execMenuOnce("bili-cover-wx-tag-handleClick", () => {
14655+
log.info(`覆盖元素.wx-tag的handleClick函数`);
14656+
BilibiliHook.overRideWxTaghandleClick();
14657+
});
1460914658
PopsPanel.execMenuOnce("bili-head-beautify", () => {
1461014659
log.info("添加美化CSS");
1461114660
return addStyle(BilibiliBeautifyCSS);
@@ -14649,9 +14698,6 @@
1464914698
log.error("该Router暂未适配,可能是首页之类:" + window.location.href);
1465014699
}
1465114700
domutils.ready(() => {
14652-
PopsPanel.execMenuOnce("bili-close-wake-app-dialog", () => {
14653-
return this.watchCloseWakeAppDialog();
14654-
});
1465514701
});
1465614702
},
1465714703
/**
@@ -14731,41 +14777,6 @@
1473114777
);
1473214778
}
1473314779
});
14734-
},
14735-
/**
14736-
* 自动观察并关闭 观看高清流畅视频 的弹窗
14737-
*/
14738-
watchCloseWakeAppDialog() {
14739-
log.info(`自动观察并关闭 观看高清流畅视频 的弹窗`);
14740-
let lockFn = new utils.LockFunction(() => {
14741-
let $dialog = $(".v-dialog");
14742-
if ($dialog && domutils.text($dialog).includes("观看高清流畅视频")) {
14743-
let $iconClose = $dialog.querySelector(".icon-close") || $dialog.querySelector(".btn.cancel");
14744-
if ($iconClose) {
14745-
$iconClose.click();
14746-
log.success(`出现【观看高清流畅视频】弹窗,关闭成功!`);
14747-
} else {
14748-
log.error($dialog);
14749-
Qmsg.error("【观看高清流畅视频】弹窗关闭失败", {
14750-
consoleLogContent: true
14751-
});
14752-
}
14753-
}
14754-
});
14755-
utils.mutationObserver(document, {
14756-
config: {
14757-
subtree: true,
14758-
childList: true
14759-
},
14760-
immediate: true,
14761-
callback: () => {
14762-
lockFn.run();
14763-
}
14764-
});
14765-
return CommonUtil.addBlockCSS(
14766-
".open-app-dialog.v-dialog",
14767-
".v-dialog:has(m-open-app)"
14768-
);
1476914780
}
1477014781
};
1477114782
PopsPanel.init();

scripts-vite/【移动端】bilibili优化/src/hook/BilibiliHook.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { $$, OriginPrototype, log, utils } from "@/env";
1+
import { $$, OriginPrototype, Qmsg, log, utils } from "@/env";
22
import { BilibiliUtils } from "@/utils/BilibiliUtils";
33
import { VueUtils } from "@/utils/VueUtils";
44
import { Vue2Instance } from "@whitesev/utils/dist/types/src/types/Vue2";
@@ -10,6 +10,7 @@ export const BilibiliHook = {
1010
hookWebpackJsonp_openApp: false,
1111
overRideLaunchAppBtn_Vue_openApp: false,
1212
overRideBiliOpenApp: false,
13+
overRideWxTaghandleClick: false,
1314
},
1415
$data: {
1516
setTimeout: <(string | RegExp)[]>[],
@@ -71,7 +72,7 @@ export const BilibiliHook = {
7172
log.info("window.setTimeout hook新增劫持判断参数:" + matchStr);
7273
return;
7374
}
74-
(unsafeWindow as any).setTimeout = function (...args: any[]): any {
75+
unsafeWindow.setTimeout = function (...args: any[]): any {
7576
let callBackString = args[0].toString();
7677
if (callBackString.match(matchStr)) {
7778
log.success("劫持setTimeout的函数", callBackString);
@@ -111,6 +112,7 @@ export const BilibiliHook = {
111112
childList: true,
112113
attributes: true,
113114
},
115+
immediate: true,
114116
callback() {
115117
document
116118
.querySelectorAll<HTMLDivElement>(".launch-app-btn")
@@ -146,6 +148,7 @@ export const BilibiliHook = {
146148
childList: true,
147149
attributes: true,
148150
},
151+
immediate: true,
149152
callback() {
150153
[
151154
...Array.from($$<HTMLDivElement>("bili-open-app")),
@@ -174,4 +177,50 @@ export const BilibiliHook = {
174177
},
175178
});
176179
},
180+
/**
181+
* 覆盖页面上的className为wx-tag的元素的点击事件
182+
*/
183+
overRideWxTaghandleClick() {
184+
if (this.$isHook.overRideWxTaghandleClick) {
185+
return;
186+
}
187+
this.$isHook.overRideWxTaghandleClick = true;
188+
utils.mutationObserver(document, {
189+
config: {
190+
subtree: true,
191+
childList: true,
192+
attributes: true,
193+
},
194+
immediate: true,
195+
callback() {
196+
[...Array.from($$<HTMLDivElement>(".wx-tag"))].forEach(($el) => {
197+
if ($el.hasAttribute("data-inject-vueins-handle-click")) {
198+
return;
199+
}
200+
let vueIns = VueUtils.getVue($el);
201+
if (vueIns) {
202+
if (typeof vueIns?.handleClick === "function") {
203+
vueIns.handleClick = function () {
204+
if (typeof vueIns["goToVideo"] === "function") {
205+
vueIns.goToVideo();
206+
} else {
207+
Qmsg.error(".wx-tag不存在goToVideo函数", {
208+
consoleLogContent: true,
209+
});
210+
}
211+
};
212+
$el.setAttribute("data-inject-vueins-handle-click", "true");
213+
}
214+
if (
215+
Array.isArray(vueIns?.$children) &&
216+
vueIns.$children.length &&
217+
typeof vueIns.$children[0].handleClick === "function"
218+
) {
219+
vueIns.$children[0].handleClick = vueIns.handleClick;
220+
}
221+
}
222+
});
223+
},
224+
});
225+
},
177226
};

scripts-vite/【移动端】bilibili优化/src/main/Bilibili.ts

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import "./css/common.css";
33
import BilibiliBeautifyCSS from "./css/beautify.css?raw";
44
import { BilibiliPCRouter, BilibiliRouter } from "@/router/BilibiliRouter";
55
import { BilibiliVideo } from "./video/BilibiliVideo";
6-
import { $, addStyle, DOMUtils, GMCookie, log, Qmsg, utils } from "@/env";
6+
import { $, $$, addStyle, DOMUtils, GMCookie, log, Qmsg, utils } from "@/env";
77
import { PopsPanel } from "@/setting/panel";
88
import { BilibiliBangumi } from "./bangumi/BilibiliBangumi";
99
import { BilibiliSearch } from "./search/BilibiliSearch";
@@ -52,6 +52,10 @@ const Bilibili = {
5252
log.info(`覆盖元素bili-open-app上的opener.open`);
5353
BilibiliHook.overRideBiliOpenApp();
5454
});
55+
PopsPanel.execMenuOnce("bili-cover-wx-tag-handleClick", () => {
56+
log.info(`覆盖元素.wx-tag的handleClick函数`);
57+
BilibiliHook.overRideWxTaghandleClick();
58+
});
5559
PopsPanel.execMenuOnce("bili-head-beautify", () => {
5660
log.info("添加美化CSS");
5761
return addStyle(BilibiliBeautifyCSS);
@@ -119,9 +123,6 @@ const Bilibili = {
119123
// );
120124
// }, 1000);
121125
// });
122-
PopsPanel.execMenuOnce("bili-close-wake-app-dialog", () => {
123-
return this.watchCloseWakeAppDialog();
124-
});
125126
});
126127
},
127128
/**
@@ -227,43 +228,6 @@ const Bilibili = {
227228
},
228229
});
229230
},
230-
/**
231-
* 自动观察并关闭 观看高清流畅视频 的弹窗
232-
*/
233-
watchCloseWakeAppDialog() {
234-
log.info(`自动观察并关闭 观看高清流畅视频 的弹窗`);
235-
let lockFn = new utils.LockFunction(() => {
236-
let $dialog = $<HTMLElement>(".v-dialog");
237-
if ($dialog && DOMUtils.text($dialog).includes("观看高清流畅视频")) {
238-
let $iconClose =
239-
$dialog.querySelector<HTMLElement>(".icon-close") ||
240-
$dialog.querySelector<HTMLElement>(".btn.cancel");
241-
if ($iconClose) {
242-
$iconClose.click();
243-
log.success(`出现【观看高清流畅视频】弹窗,关闭成功!`);
244-
} else {
245-
log.error($dialog);
246-
Qmsg.error("【观看高清流畅视频】弹窗关闭失败", {
247-
consoleLogContent: true,
248-
});
249-
}
250-
}
251-
});
252-
utils.mutationObserver(document, {
253-
config: {
254-
subtree: true,
255-
childList: true,
256-
},
257-
immediate: true,
258-
callback: () => {
259-
lockFn.run();
260-
},
261-
});
262-
return CommonUtil.addBlockCSS(
263-
".open-app-dialog.v-dialog",
264-
".v-dialog:has(m-open-app)"
265-
);
266-
},
267231
};
268232

269233
export { Bilibili };

scripts-vite/【移动端】bilibili优化/src/setting/view/Common.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ const SettingUICommon: PopsPanelContentConfig = {
5252
void 0,
5353
"一般用于处理楼层的回复弹窗内无法选中复制问题"
5454
),
55-
UISwitch(
56-
"跳过【观看高清流畅视频】弹窗",
57-
"bili-close-wake-app-dialog",
58-
true,
59-
void 0,
60-
"监听页面加载并关闭该弹窗"
61-
),
6255
// UISwitch(
6356
// "自动删除Cookie buvid3",
6457
// "common_auto_delete_cookie_buvid3",
@@ -139,6 +132,13 @@ const SettingUICommon: PopsPanelContentConfig = {
139132
void 0,
140133
"覆盖bili-open-app/m-open-app元素上的opener.open函数,可阻止点击唤醒/下载App,如果存在有效链接,会自动跳转"
141134
),
135+
UISwitch(
136+
"覆盖.wx-tag的handleClick",
137+
"bili-cover-wx-tag-handleClick",
138+
true,
139+
void 0,
140+
"覆盖.wx-tag元素上的点击事件,让它直接打开视频"
141+
),
142142
UISwitch(
143143
"劫持setTimeout-autoOpenApp",
144144
"bili-hookSetTimeout_autoOpenApp",

0 commit comments

Comments
 (0)