dont need send
This commit is contained in:
parent
f14fd06b43
commit
b95a40b16e
@ -1,7 +1,6 @@
|
|||||||
const introSkipper = {
|
const introSkipper = {
|
||||||
originalFetch: window.fetch.bind(window),
|
originalFetch: window.fetch.bind(window),
|
||||||
originalXHROpen: XMLHttpRequest.prototype.open,
|
originalXHROpen: XMLHttpRequest.prototype.open,
|
||||||
originalXHRSend: XMLHttpRequest.prototype.send,
|
|
||||||
d: msg => console.debug("[intro skipper] ", msg),
|
d: msg => console.debug("[intro skipper] ", msg),
|
||||||
setup() {
|
setup() {
|
||||||
const self = this;
|
const self = this;
|
||||||
@ -12,9 +11,6 @@ const introSkipper = {
|
|||||||
XMLHttpRequest.prototype.open = function(...args) {
|
XMLHttpRequest.prototype.open = function(...args) {
|
||||||
self.xhrOpenWrapper(this, ...args);
|
self.xhrOpenWrapper(this, ...args);
|
||||||
};
|
};
|
||||||
XMLHttpRequest.prototype.send = function(...args) {
|
|
||||||
self.xhrSendWrapper(this, ...args);
|
|
||||||
};
|
|
||||||
document.addEventListener("viewshow", this.viewShow.bind(this));
|
document.addEventListener("viewshow", this.viewShow.bind(this));
|
||||||
this.videoPositionChanged = this.videoPositionChanged.bind(this);
|
this.videoPositionChanged = this.videoPositionChanged.bind(this);
|
||||||
this.handleEscapeKey = this.handleEscapeKey.bind(this);
|
this.handleEscapeKey = this.handleEscapeKey.bind(this);
|
||||||
@ -39,23 +35,9 @@ const introSkipper = {
|
|||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
xhrOpenWrapper(xhr, method, url, ...rest) {
|
xhrOpenWrapper(xhr, method, url, ...rest) {
|
||||||
this.d(`XHR Open: ${method} ${url}`);
|
url.includes("/PlaybackInfo") && this.processPlaybackInfo(url);
|
||||||
xhr._introSkipperUrl = url;
|
|
||||||
return this.originalXHROpen.apply(xhr, [method, url, ...rest]);
|
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) {
|
async processPlaybackInfo(url) {
|
||||||
const id = this.extractId(url);
|
const id = this.extractId(url);
|
||||||
if (id) {
|
if (id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user