dont need send

This commit is contained in:
rlauu 2024-10-16 13:20:36 +02:00
parent f14fd06b43
commit b95a40b16e

View File

@ -1,7 +1,6 @@
const introSkipper = {
originalFetch: window.fetch.bind(window),
originalXHROpen: XMLHttpRequest.prototype.open,
originalXHRSend: XMLHttpRequest.prototype.send,
d: msg => console.debug("[intro skipper] ", msg),
setup() {
const self = this;
@ -12,9 +11,6 @@ const introSkipper = {
XMLHttpRequest.prototype.open = function(...args) {
self.xhrOpenWrapper(this, ...args);
};
XMLHttpRequest.prototype.send = function(...args) {
self.xhrSendWrapper(this, ...args);
};
document.addEventListener("viewshow", this.viewShow.bind(this));
this.videoPositionChanged = this.videoPositionChanged.bind(this);
this.handleEscapeKey = this.handleEscapeKey.bind(this);
@ -39,23 +35,9 @@ const introSkipper = {
return response;
},
xhrOpenWrapper(xhr, method, url, ...rest) {
this.d(`XHR Open: ${method} ${url}`);
xhr._introSkipperUrl = url;
url.includes("/PlaybackInfo") && this.processPlaybackInfo(url);
return this.originalXHROpen.apply(xhr, [method, url, ...rest]);
},
xhrSendWrapper(xhr, body) {
const originalOnReadyStateChange = xhr.onreadystatechange;
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr._introSkipperUrl.includes("/PlaybackInfo")) {
this.processPlaybackInfo(xhr._introSkipperUrl);
}
if (originalOnReadyStateChange) {
originalOnReadyStateChange.apply(xhr, arguments);
}
};
return this.originalXHRSend.apply(xhr, [body]);
},
async processPlaybackInfo(url) {
const id = this.extractId(url);
if (id) {