fix: subtitle

This commit is contained in:
Gabe
2025-10-09 11:55:02 +08:00
parent aeec5e361c
commit 2d0ea09e06
5 changed files with 54 additions and 91 deletions

View File

@@ -1,34 +1,5 @@
import {
MSG_XHR_DATA_YOUTUBE,
MSG_GLOBAL_VAR_FETCH,
MSG_GLOBAL_VAR_BACK,
} from "./config";
import { MSG_XHR_DATA_YOUTUBE } from "./config";
// 响应window全局对象查询
(function () {
window.addEventListener("message", (event) => {
if (
event.source === window &&
event.data &&
event.data.type === MSG_GLOBAL_VAR_FETCH
) {
const { varName, requestId } = event.data;
if (varName) {
const value = window[varName];
window.postMessage(
{
type: MSG_GLOBAL_VAR_BACK,
payload: value,
requestId: requestId,
},
window.location.origin
);
}
}
});
})();
// 拦截字幕数据
(function () {
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (...args) {