// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
function GM_xhr(url) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
url,
method: 'GET',
onload: (xhr) => resolve(xhr.responseText)
})
})
}
let ajaxHookerScript = GM_getValue('ajaxHooker')
if (!ajaxHookerScript) {
ajaxHookerScript = await GM_xhr('https://scriptcat.org/lib/637/1.0.1/ajaxHooker.js')
GM_setValue('ajaxHookerScript', ajaxHookerScript)
}
eval(ajaxHookerScript)
let jQueryScript = GM_getValue('jQuery')
if (!jQueryScript) {
jQueryScript = await GM_xhr('https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js')
GM_setValue('jQuery', jQueryScript)
}
eval(jQueryScript)
把代码下载到本地存储然后直接读