mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 10:52:20 +01:00
Add native XMLHttpRequest in case all else fails
This commit is contained in:
1 file changed
+10
-1
@@ -29,7 +29,16 @@ function doXHR(opts) {
|
|||||||
return GM.xmlHttpRequest(opts);
|
return GM.xmlHttpRequest(opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Unable to detect UserScript plugin.');
|
console.warn('Unable to detect UserScript plugin, falling back to native XHR.');
|
||||||
|
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
|
xhr.open(opts.method, opts.url, true);
|
||||||
|
xhr.onload = () => opts.onload({
|
||||||
|
response: JSON.parse(xhr.responseText),
|
||||||
|
});
|
||||||
|
xhr.onerror = err => console.error('XHR Failed', err);
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getButtons() {
|
function getButtons() {
|
||||||
|
|||||||
Reference in new issue
Block a user