Files
kiss-translator/src/injector.js

20 lines
549 B
JavaScript
Raw Normal View History

2025-10-07 16:35:00 +08:00
(function () {
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (...args) {
const url = args[1];
if (typeof url === "string" && url.includes("timedtext")) {
this.addEventListener("load", function () {
window.postMessage(
{
2025-10-14 22:41:18 +08:00
type: "KISS_XHR_DATA_YOUTUBE",
2025-10-07 16:35:00 +08:00
url: this.responseURL,
response: this.responseText,
},
window.location.origin
);
});
}
return originalOpen.apply(this, args);
};
})();