Last active
March 12, 2023 10:02
-
-
Save avin/ac7afcaafa40c2671e2c595cdcf69449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SuperAjax for AppLinks | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Allow to do cross-domain AJAX requests | |
// @author You | |
// @run-at document-start | |
// @connect * | |
// @match https://localhost:5173/* | |
// @match https://web.rbsdev.com/front-utils/app-links/* | |
// @icon https://web.rbsdev.com/front-utils/app-links/favicon.svg | |
// @grant GM.xmlHttpRequest | |
// @grant unsafeWindow | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
unsafeWindow._superAjax = (url) => { | |
if(!(url.endsWith('/template.json') || url.endsWith('/version.txt'))){ | |
console.log(url); | |
return Promise.reject('not allowed url') | |
} | |
return new Promise((resolve, reject) => { | |
GM.xmlHttpRequest({ | |
method: "GET", | |
url, | |
onload: resolve, | |
onerror: reject, | |
}); | |
}) | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment