From b95a40b16e1d1b49fe3b51862680d2192f31c2a9 Mon Sep 17 00:00:00 2001 From: rlauu <46294892+rlauu@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:20:36 +0200 Subject: [PATCH] dont need send --- .../Configuration/inject.js | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js index 6a28b96..abbb75e 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js @@ -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) {